From b5802659c229060d46ab5f12849ee2a21215418a Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Wed, 23 Jul 2014 20:11:10 -0700 Subject: [PATCH] Add support for showing debug borders This can help debug issues with the compositor and show when a page is creating layers. --- src/components/compositing/compositor.rs | 4 +++- src/components/embedding/core.rs | 1 + src/components/util/opts.rs | 6 ++++++ src/support/layers/rust-layers | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/compositing/compositor.rs b/src/components/compositing/compositor.rs index 9a808cfd052..2ce5199cb08 100644 --- a/src/components/compositing/compositor.rs +++ b/src/components/compositing/compositor.rs @@ -143,11 +143,13 @@ impl IOCompositor { let window_size = window.framebuffer_size(); let hidpi_factor = window.hidpi_factor(); + let show_debug_borders = opts.show_debug_borders; IOCompositor { window: window, port: port, opts: opts, - context: rendergl::init_render_context(CompositorTask::create_graphics_context()), + context: rendergl::RenderContext::new(CompositorTask::create_graphics_context(), + show_debug_borders), root_pipeline: None, scene: Scene::new(window_size.as_f32().to_untyped(), identity()), window_size: window_size, diff --git a/src/components/embedding/core.rs b/src/components/embedding/core.rs index b3517af877c..1968b94282c 100644 --- a/src/components/embedding/core.rs +++ b/src/components/embedding/core.rs @@ -64,6 +64,7 @@ pub extern "C" fn cef_run_message_loop() { headless: false, hard_fail: false, bubble_inline_sizes_separately: false, + show_debug_borders: false, }; native::start(0, 0 as **u8, proc() { servo::run(opts); diff --git a/src/components/util/opts.rs b/src/components/util/opts.rs index abf460bb46d..6ef778a0d31 100644 --- a/src/components/util/opts.rs +++ b/src/components/util/opts.rs @@ -68,6 +68,10 @@ pub struct Opts { /// may wish to turn this flag on in order to benchmark style recalculation against other /// browser engines. pub bubble_inline_sizes_separately: bool, + + /// True if we should show borders on all layers and tiles for + /// debugging purposes (`--show-debug-borders`). + pub show_debug_borders: bool, } fn print_usage(app: &str, opts: &[getopts::OptGroup]) { @@ -99,6 +103,7 @@ pub fn from_cmdline_args(args: &[String]) -> Option { getopts::optflag("z", "headless", "Headless mode"), getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"), getopts::optflag("b", "bubble-widths", "Bubble intrinsic widths separately like other engines"), + getopts::optflag("", "show-debug-borders", "Show debugging borders on layers and tiles."), getopts::optflag("h", "help", "Print this message") ); @@ -187,6 +192,7 @@ pub fn from_cmdline_args(args: &[String]) -> Option { headless: opt_match.opt_present("z"), hard_fail: opt_match.opt_present("f"), bubble_inline_sizes_separately: opt_match.opt_present("b"), + show_debug_borders: opt_match.opt_present("show-debug-borders"), }) } diff --git a/src/support/layers/rust-layers b/src/support/layers/rust-layers index 0f47c0a7486..10e34dbdf9b 160000 --- a/src/support/layers/rust-layers +++ b/src/support/layers/rust-layers @@ -1 +1 @@ -Subproject commit 0f47c0a74863ccc7819c6667a4556f7b9b585670 +Subproject commit 10e34dbdf9b9d4a437fedc412d37f13a42182e44