aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-10-21 17:06:40 -0600
committerbors-servo <metajack+bors@gmail.com>2014-10-21 17:06:40 -0600
commit3936d142607ef5a9b4a49d48e207daf4975cc7d5 (patch)
tree2a81bbdf6b7659fc18e129aaa185aef5ae74627b
parent70299a71f99cf08adc152ce306ad830ccda2328c (diff)
parent2d5168a1e5858fce5801931b8009f07942edb23e (diff)
downloadservo-3936d142607ef5a9b4a49d48e207daf4975cc7d5.tar.gz
servo-3936d142607ef5a9b4a49d48e207daf4975cc7d5.zip
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.
-rw-r--r--components/layout/fragment.rs26
-rw-r--r--components/util/opts.rs5
-rw-r--r--ports/cef/core.rs1
3 files changed, 18 insertions, 14 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 1546605fdf0..80d6c68be2a 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -42,6 +42,7 @@ use servo_net::local_image_cache::LocalImageCache;
use servo_util::geometry::{Au, ZERO_RECT};
use servo_util::geometry;
use servo_util::logical_geometry::{LogicalRect, LogicalSize, LogicalMargin, WritingMode};
+use servo_util::opts;
use servo_util::range::*;
use servo_util::smallvec::SmallVec;
use servo_util::str::is_whitespace;
@@ -1339,24 +1340,21 @@ impl Fragment {
});
}
- // Draw debug frames for text bounds.
- //
- // FIXME(#2263, pcwalton): This is a bit of an abuse of the logging infrastructure.
- // We should have a real `SERVO_DEBUG` system.
- debug!("{:?}", self.build_debug_borders_around_text_fragments(display_list,
- flow_origin,
- text_fragment,
- clip_rect))
+ if opts::get().show_debug_fragment_borders {
+ self.build_debug_borders_around_text_fragments(display_list,
+ flow_origin,
+ text_fragment,
+ clip_rect);
+ }
}
GenericFragment | IframeFragment(..) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment |
InlineAbsoluteHypotheticalFragment(_) => {
- // FIXME(pcwalton): This is a bit of an abuse of the logging infrastructure. We
- // should have a real `SERVO_DEBUG` system.
- debug!("{:?}",
- self.build_debug_borders_around_fragment(display_list,
- flow_origin,
- clip_rect))
+ if opts::get().show_debug_fragment_borders {
+ self.build_debug_borders_around_fragment(display_list,
+ flow_origin,
+ clip_rect);
+ }
}
ImageFragment(ref mut image_fragment) => {
let image_ref = &mut image_fragment.image;
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 0bf6ab923f8..8a201d81329 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -74,6 +74,9 @@ pub struct Opts {
/// debugging purposes (`--show-debug-borders`).
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
/// where pixel perfect results are required when using fonts such as the Ahem
/// 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("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-fragment-borders", "Show debugging borders on fragments."),
getopts::optflag("", "disable-text-aa", "Disable antialiasing for text rendering."),
getopts::optflag("", "trace-layout", "Write layout trace to external file for debugging."),
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"),
bubble_inline_sizes_separately: bubble_inline_sizes_separately,
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"),
trace_layout: trace_layout,
devtools_port: devtools_port,
diff --git a/ports/cef/core.rs b/ports/cef/core.rs
index b6738b95b5b..5a51c351398 100644
--- a/ports/cef/core.rs
+++ b/ports/cef/core.rs
@@ -67,6 +67,7 @@ pub extern "C" fn cef_run_message_loop() {
hard_fail: false,
bubble_inline_sizes_separately: false,
show_debug_borders: false,
+ show_debug_fragment_borders: false,
enable_text_antialiasing: true,
trace_layout: false,
devtools_port: None,