auto merge of #3746 : mrobinson/servo/debug-fragment-borders, r=pcwalton

This is quite a bit cleaner than abusing the rust debug functionality.
If we start collecting too many debugging options in the servo
executable we could opt to organize them into a single option.

Fixes #2263.
This commit is contained in:
bors-servo 2014-10-21 17:06:40 -06:00
commit 3936d14260
3 changed files with 18 additions and 14 deletions

View file

@ -42,6 +42,7 @@ use servo_net::local_image_cache::LocalImageCache;
use servo_util::geometry::{Au, ZERO_RECT}; use servo_util::geometry::{Au, ZERO_RECT};
use servo_util::geometry; use servo_util::geometry;
use servo_util::logical_geometry::{LogicalRect, LogicalSize, LogicalMargin, WritingMode}; use servo_util::logical_geometry::{LogicalRect, LogicalSize, LogicalMargin, WritingMode};
use servo_util::opts;
use servo_util::range::*; use servo_util::range::*;
use servo_util::smallvec::SmallVec; use servo_util::smallvec::SmallVec;
use servo_util::str::is_whitespace; use servo_util::str::is_whitespace;
@ -1339,24 +1340,21 @@ impl Fragment {
}); });
} }
// Draw debug frames for text bounds. if opts::get().show_debug_fragment_borders {
// self.build_debug_borders_around_text_fragments(display_list,
// FIXME(#2263, pcwalton): This is a bit of an abuse of the logging infrastructure. flow_origin,
// We should have a real `SERVO_DEBUG` system. text_fragment,
debug!("{:?}", self.build_debug_borders_around_text_fragments(display_list, clip_rect);
flow_origin, }
text_fragment,
clip_rect))
} }
GenericFragment | IframeFragment(..) | TableFragment | TableCellFragment | GenericFragment | IframeFragment(..) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment | TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment |
InlineAbsoluteHypotheticalFragment(_) => { InlineAbsoluteHypotheticalFragment(_) => {
// FIXME(pcwalton): This is a bit of an abuse of the logging infrastructure. We if opts::get().show_debug_fragment_borders {
// should have a real `SERVO_DEBUG` system. self.build_debug_borders_around_fragment(display_list,
debug!("{:?}", flow_origin,
self.build_debug_borders_around_fragment(display_list, clip_rect);
flow_origin, }
clip_rect))
} }
ImageFragment(ref mut image_fragment) => { ImageFragment(ref mut image_fragment) => {
let image_ref = &mut image_fragment.image; let image_ref = &mut image_fragment.image;

View file

@ -74,6 +74,9 @@ pub struct Opts {
/// debugging purposes (`--show-debug-borders`). /// debugging purposes (`--show-debug-borders`).
pub show_debug_borders: bool, pub show_debug_borders: bool,
/// True if we should show borders on all fragments for debugging purposes (`--show-debug-fragment-borders`).
pub show_debug_fragment_borders: bool,
/// If set with --disable-text-aa, disable antialiasing on fonts. This is primarily useful for reftests /// If set with --disable-text-aa, disable antialiasing on fonts. This is primarily useful for reftests
/// where pixel perfect results are required when using fonts such as the Ahem /// where pixel perfect results are required when using fonts such as the Ahem
/// font for layout tests. /// font for layout tests.
@ -137,6 +140,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"), 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("b", "bubble-widths", "Bubble intrinsic widths separately like other engines"),
getopts::optflag("", "show-debug-borders", "Show debugging borders on layers and tiles."), getopts::optflag("", "show-debug-borders", "Show debugging borders on layers and tiles."),
getopts::optflag("", "show-debug-fragment-borders", "Show debugging borders on fragments."),
getopts::optflag("", "disable-text-aa", "Disable antialiasing for text rendering."), getopts::optflag("", "disable-text-aa", "Disable antialiasing for text rendering."),
getopts::optflag("", "trace-layout", "Write layout trace to external file for debugging."), getopts::optflag("", "trace-layout", "Write layout trace to external file for debugging."),
getopts::optflagopt("", "devtools", "Start remote devtools server on port", "6000"), getopts::optflagopt("", "devtools", "Start remote devtools server on port", "6000"),
@ -238,6 +242,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
hard_fail: opt_match.opt_present("f"), hard_fail: opt_match.opt_present("f"),
bubble_inline_sizes_separately: bubble_inline_sizes_separately, bubble_inline_sizes_separately: bubble_inline_sizes_separately,
show_debug_borders: opt_match.opt_present("show-debug-borders"), show_debug_borders: opt_match.opt_present("show-debug-borders"),
show_debug_fragment_borders: opt_match.opt_present("show-debug-fragment-borders"),
enable_text_antialiasing: !opt_match.opt_present("disable-text-aa"), enable_text_antialiasing: !opt_match.opt_present("disable-text-aa"),
trace_layout: trace_layout, trace_layout: trace_layout,
devtools_port: devtools_port, devtools_port: devtools_port,

View file

@ -67,6 +67,7 @@ pub extern "C" fn cef_run_message_loop() {
hard_fail: false, hard_fail: false,
bubble_inline_sizes_separately: false, bubble_inline_sizes_separately: false,
show_debug_borders: false, show_debug_borders: false,
show_debug_fragment_borders: false,
enable_text_antialiasing: true, enable_text_antialiasing: true,
trace_layout: false, trace_layout: false,
devtools_port: None, devtools_port: None,