diff --git a/components/config/opts.rs b/components/config/opts.rs index 5b31ba595cf..83cc99d8d2b 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -20,9 +20,6 @@ pub struct Opts { /// Whether or not the legacy layout system is enabled. pub legacy_layout: bool, - /// The maximum size of each tile in pixels (`-s`). - pub tile_size: usize, - /// `None` to disable the time profiler or `Some` to enable it with: /// /// - an interval in seconds to cause it to produce output on that interval. @@ -124,12 +121,6 @@ pub struct DebugOptions { /// List all the debug options. pub help: bool, - /// True if we should bubble intrinsic widths sequentially. If this is true, - /// then intrinsic widths are computed as a separate pass instead of during - /// flow construction. You may wish to turn this flag on in order to - /// benchmark style recalculation against other browser engines. - pub bubble_inline_sizes_separately: 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. @@ -159,21 +150,12 @@ pub struct DebugOptions { /// Print the display list after each layout. pub dump_display_list: bool, - /// Print the display list in JSON form. - pub dump_display_list_json: bool, - /// Print notifications when there is a relayout. pub relayout_event: bool, /// Periodically print out on which events script threads spend their processing time. pub profile_script_events: bool, - /// Paint borders along fragment boundaries. - pub show_fragment_borders: bool, - - /// Mark which thread laid each flow out with colors. - pub show_parallel_layout: bool, - /// True if each step of layout is traced to an external JSON file /// for debugging purposes. Setting this implies sequential layout /// and paint. @@ -216,14 +198,12 @@ impl DebugOptions { for option in debug_string.split(',') { match option { "help" => self.help = true, - "bubble-inline-sizes-separately" => self.bubble_inline_sizes_separately = true, "convert-mouse-to-touch" => self.convert_mouse_to_touch = true, "disable-canvas-aa" => self.disable_canvas_antialiasing = true, "disable-share-style-cache" => self.disable_share_style_cache = true, "disable-subpixel-aa" => self.disable_subpixel_text_antialiasing = true, "disable-text-aa" => self.disable_text_antialiasing = true, "dump-display-list" => self.dump_display_list = true, - "dump-display-list-json" => self.dump_display_list_json = true, "dump-stacking-context-tree" => self.dump_stacking_context_tree = true, "dump-flow-tree" => self.dump_flow_tree = true, "dump-rule-tree" => self.dump_rule_tree = true, @@ -234,8 +214,6 @@ impl DebugOptions { "profile-script-events" => self.profile_script_events = true, "relayout-event" => self.relayout_event = true, "replace-surrogates" => self.replace_surrogates = true, - "show-fragment-borders" => self.show_fragment_borders = true, - "show-parallel-layout" => self.show_parallel_layout = true, "signpost" => self.signpost = true, "dump-style-stats" => self.dump_style_statistics = true, "trace-layout" => self.trace_layout = true, @@ -245,10 +223,6 @@ impl DebugOptions { }; } - if self.trace_layout { - self.bubble_inline_sizes_separately = true; - } - Ok(()) } } @@ -263,7 +237,6 @@ pub enum OutputOptions { pub fn default_opts() -> Opts { Opts { legacy_layout: false, - tile_size: 512, time_profiling: None, time_profiler_trace_path: None, mem_profiler_period: None, diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 7761a9482e4..74e2400faa0 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -23,7 +23,6 @@ use script_layout_interface::wrapper_traits::{ PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, }; use script_layout_interface::{LayoutElementType, LayoutNodeType}; -use servo_config::opts; use servo_url::ServoUrl; use style::computed_values::caption_side::T as CaptionSide; use style::computed_values::display::T as Display; @@ -2075,13 +2074,11 @@ impl FlowRef { /// All flows must be finished at some point, or they will not have their intrinsic inline-sizes /// properly computed. (This is not, however, a memory safety problem.) fn finish(&mut self) { - if !opts::get().debug.bubble_inline_sizes_separately { - FlowRef::deref_mut(self).bubble_inline_sizes(); - FlowRef::deref_mut(self) - .mut_base() - .restyle_damage - .remove(ServoRestyleDamage::BUBBLE_ISIZES); - } + FlowRef::deref_mut(self).bubble_inline_sizes(); + FlowRef::deref_mut(self) + .mut_base() + .restyle_damage + .remove(ServoRestyleDamage::BUBBLE_ISIZES); } } diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 4046f45f314..a0a63f4dc7f 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -28,7 +28,6 @@ use range::Range; use script_layout_interface::{ combine_id_with_fragment_type, FragmentType, IFrameSize, IFrameSizes, }; -use servo_config::opts; use servo_geometry::{self, MaxRect}; use style::color::AbsoluteColor; use style::computed_values::border_style::T as BorderStyle; @@ -48,9 +47,9 @@ use style::values::specified::ui::CursorKind; use style_traits::ToCss; use webrender_api::units::{LayoutRect, LayoutTransform, LayoutVector2D}; use webrender_api::{ - self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF, ColorU, - ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LineStyle, NinePatchBorder, - NinePatchBorderSource, NormalBorder, PropertyBinding, StickyOffsetBounds, + self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF, ExternalScrollId, + FilterOp, GlyphInstance, ImageRendering, LineStyle, NinePatchBorder, NinePatchBorderSource, + NormalBorder, PropertyBinding, StickyOffsetBounds, }; use webrender_traits::display_list::ScrollSensitivity; @@ -76,57 +75,6 @@ use crate::model::MaybeAuto; use crate::table_cell::CollapsedBordersForCell; use crate::text_run::TextRun; -static THREAD_TINT_COLORS: [ColorF; 8] = [ - ColorF { - r: 6.0 / 255.0, - g: 153.0 / 255.0, - b: 198.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 1.0, - g: 212.0 / 255.0, - b: 83.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 116.0 / 255.0, - g: 29.0 / 255.0, - b: 109.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 204.0 / 255.0, - g: 158.0 / 255.0, - b: 199.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 242.0 / 255.0, - g: 46.0 / 255.0, - b: 121.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 116.0 / 255.0, - g: 203.0 / 255.0, - b: 196.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 1.0, - g: 249.0 / 255.0, - b: 201.0 / 255.0, - a: 0.7, - }, - ColorF { - r: 137.0 / 255.0, - g: 196.0 / 255.0, - b: 78.0 / 255.0, - a: 0.7, - }, -]; - // An internal WebRender limit. // // See: https://github.com/servo/servo/issues/17230#issuecomment-564307277 @@ -1375,104 +1323,6 @@ impl Fragment { ))); } - /// Adds display items necessary to draw debug boxes around a scanned text fragment. - fn build_debug_borders_around_text_fragments( - &self, - state: &mut DisplayListBuildState, - style: &ComputedValues, - stacking_relative_border_box: Rect, - stacking_relative_content_box: Rect, - text_fragment: &ScannedTextFragmentInfo, - clip: Rect, - ) { - // FIXME(pcwalton, #2795): Get the real container size. - let container_size = Size2D::zero(); - - // Compute the text fragment bounds and draw a border surrounding them. - let base = state.create_base_display_item( - clip, - self.node, - self.unique_id(), - get_cursor(style, Cursor::Default), - DisplayListSection::Content, - ); - state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data( - base, - webrender_api::BorderDisplayItem { - bounds: stacking_relative_border_box.to_layout(), - common: items::empty_common_item_properties(), - widths: SideOffsets2D::new_all_same(Au::from_px(1)).to_layout(), - details: BorderDetails::Normal(border::simple( - ColorU::new(0, 0, 200, 1).into(), - webrender_api::BorderStyle::Solid, - )), - }, - Vec::new(), - ))); - - // Draw a rectangle representing the baselines. - let mut baseline = LogicalRect::from_physical( - self.style.writing_mode, - stacking_relative_content_box, - container_size, - ); - baseline.start.b += text_fragment.run.ascent(); - baseline.size.block = Au(0); - let baseline = baseline.to_physical(self.style.writing_mode, container_size); - - let base = state.create_base_display_item( - clip, - self.node, - self.unique_id(), - get_cursor(style, Cursor::Default), - DisplayListSection::Content, - ); - // TODO(gw): Use a better estimate for wavy line thickness. - let area = baseline.to_layout(); - let wavy_line_thickness = (0.33 * area.size().height).ceil(); - state.add_display_item(DisplayItem::Line(CommonDisplayItem::new( - base, - webrender_api::LineDisplayItem { - common: items::empty_common_item_properties(), - area, - orientation: webrender_api::LineOrientation::Horizontal, - wavy_line_thickness, - color: ColorU::new(0, 200, 0, 1).into(), - style: LineStyle::Dashed, - }, - ))); - } - - /// Adds display items necessary to draw debug boxes around this fragment. - fn build_debug_borders_around_fragment( - &self, - state: &mut DisplayListBuildState, - stacking_relative_border_box: Rect, - clip: Rect, - ) { - // This prints a debug border around the border of this fragment. - let base = state.create_base_display_item( - clip, - self.node, - self.unique_id(), - get_cursor(&self.style, Cursor::Default), - DisplayListSection::Content, - ); - state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data( - base, - webrender_api::BorderDisplayItem { - bounds: stacking_relative_border_box.to_layout(), - common: items::empty_common_item_properties(), - widths: SideOffsets2D::new_all_same(Au::from_px(1)).to_layout(), - details: BorderDetails::Normal(border::simple( - ColorU::new(0, 0, 200, 1).into(), - webrender_api::BorderStyle::Solid, - )), - }, - Vec::new(), - ))); - } - /// Builds the display items necessary to paint the selection and/or caret for this fragment, /// if any. fn build_display_items_for_selection_if_necessary( @@ -1758,10 +1608,6 @@ impl Fragment { clip, ); }); - - if opts::get().debug.show_fragment_borders { - self.build_debug_borders_around_fragment(state, stacking_relative_border_box, clip) - } } /// A helper method that `build_display_list` calls to create per-fragment-type display items. @@ -1818,17 +1664,6 @@ impl Fragment { &self.style.get_inherited_text().text_shadow.0, clip, ); - - if opts::get().debug.show_fragment_borders { - self.build_debug_borders_around_text_fragments( - state, - self.style(), - stacking_relative_border_box, - stacking_relative_content_box, - text_fragment, - clip, - ); - } }, SpecificFragmentInfo::ScannedText(ref text_fragment) => { // Create the main text display item. @@ -1839,17 +1674,6 @@ impl Fragment { &self.style.get_inherited_text().text_shadow.0, clip, ); - - if opts::get().debug.show_fragment_borders { - self.build_debug_borders_around_text_fragments( - state, - self.style(), - stacking_relative_border_box, - stacking_relative_content_box, - text_fragment, - clip, - ); - } }, SpecificFragmentInfo::Generic | SpecificFragmentInfo::GeneratedContent(..) | @@ -1863,15 +1687,7 @@ impl Fragment { SpecificFragmentInfo::InlineAbsoluteHypothetical(_) | SpecificFragmentInfo::InlineAbsolute(_) | SpecificFragmentInfo::TruncatedFragment(_) | - SpecificFragmentInfo::Svg(_) => { - if opts::get().debug.show_fragment_borders { - self.build_debug_borders_around_fragment( - state, - stacking_relative_border_box, - clip, - ); - } - }, + SpecificFragmentInfo::Svg(_) => {}, SpecificFragmentInfo::Iframe(ref fragment_info) => { if !stacking_relative_content_box.is_empty() { let Some(browsing_context_id) = fragment_info.browsing_context_id else { @@ -2888,9 +2704,6 @@ impl BlockFlow { content_size, ); - self.base - .build_display_items_for_debugging_tint(state, self.fragment.node); - state.processing_scrolling_overflow_element = false; } @@ -2960,50 +2773,6 @@ impl BlockFlow { } } -impl BaseFlow { - pub fn build_display_items_for_debugging_tint( - &self, - state: &mut DisplayListBuildState, - node: OpaqueNode, - ) { - if !opts::get().debug.show_parallel_layout { - return; - } - - let thread_id = self.thread_id; - let stacking_context_relative_bounds = Rect::new( - self.stacking_relative_position.to_point(), - self.position.size.to_physical(self.writing_mode), - ); - - let mut color = THREAD_TINT_COLORS[thread_id as usize % THREAD_TINT_COLORS.len()]; - color.a = 1.0; - let base = state.create_base_display_item( - self.clip, - node, - // This item will never become a spatial tree node, so it's fine - // to pass 0 here. - 0, - None, - DisplayListSection::Content, - ); - let bounds = stacking_context_relative_bounds.inflate(Au::from_px(2), Au::from_px(2)); - state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data( - base, - webrender_api::BorderDisplayItem { - bounds: bounds.to_layout(), - common: items::empty_common_item_properties(), - widths: SideOffsets2D::new_all_same(Au::from_px(2)).to_layout(), - details: BorderDetails::Normal(border::simple( - color, - webrender_api::BorderStyle::Solid, - )), - }, - Vec::new(), - ))); - } -} - /// Gets the cursor to use given the specific ComputedValues. `default_cursor` specifies /// the cursor to use if `cursor` is `auto`. Typically, this will be `PointerCursor`, but for /// text display items it may be `TextCursor` or `VerticalTextCursor`. diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 53540f1bc54..aa851a29ed3 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -1948,11 +1948,6 @@ impl Flow for InlineFlow { state.current_stacking_context_id = parent_stacking_context_id } } - - if !self.fragments.fragments.is_empty() { - self.base - .build_display_items_for_debugging_tint(state, self.fragments.fragments[0].node); - } } fn repair_style(&mut self, _: &ServoArc) {} diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 4b3f5c694c5..9148e18cfc7 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -13,16 +13,13 @@ use std::{mem, ptr}; use profile_traits::time::{self, TimerMetadata}; use profile_traits::time_profile; -use servo_config::opts; use smallvec::SmallVec; use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::flow::{Flow, GetBaseFlow}; use crate::flow_ref::FlowRef; -use crate::traversal::{ - AssignBSizes, AssignISizes, BubbleISizes, PostorderFlowTraversal, PreorderFlowTraversal, -}; +use crate::traversal::{AssignBSizes, AssignISizes, PostorderFlowTraversal, PreorderFlowTraversal}; /// Traversal chunk size. const CHUNK_SIZE: usize = 16; @@ -213,13 +210,6 @@ pub fn reflow( context: &LayoutContext, queue: &rayon::ThreadPool, ) { - if opts::get().debug.bubble_inline_sizes_separately { - let bubble_inline_sizes = BubbleISizes { - layout_context: context, - }; - bubble_inline_sizes.traverse(root); - } - let assign_isize_traversal = &AssignISizes { layout_context: context, }; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index cc6fd9e6316..89a2eb26b33 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -6,7 +6,6 @@ use app_units::Au; use euclid::default::{Point2D, Rect, Size2D, Vector2D}; -use servo_config::opts; use style::servo::restyle_damage::ServoRestyleDamage; use webrender_api::units::LayoutPoint; use webrender_api::{ColorF, PropertyBinding, RectangleDisplayItem}; @@ -21,8 +20,8 @@ use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator}; use crate::generated_content::ResolveGeneratedContent; use crate::incremental::RelayoutMode; use crate::traversal::{ - AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList, InorderFlowTraversal, - PostorderFlowTraversal, PreorderFlowTraversal, + AssignBSizes, AssignISizes, BuildDisplayList, InorderFlowTraversal, PostorderFlowTraversal, + PreorderFlowTraversal, }; pub fn resolve_generated_content(root: &mut dyn Flow, layout_context: &LayoutContext) { @@ -58,11 +57,6 @@ pub fn reflow(root: &mut dyn Flow, layout_context: &LayoutContext, relayout_mode } } - if opts::get().debug.bubble_inline_sizes_separately { - let bubble_inline_sizes = BubbleISizes { layout_context }; - bubble_inline_sizes.traverse(root); - } - let assign_inline_sizes = AssignISizes { layout_context }; let assign_block_sizes = AssignBSizes { layout_context }; diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index d0eae9afb45..514600cf89a 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -796,9 +796,6 @@ impl LayoutThread { if self.debug.dump_display_list { display_list.print(); } - if self.debug.dump_display_list_json { - println!("{}", serde_json::to_string_pretty(&display_list).unwrap()); - } debug!("Layout done!"); diff --git a/ports/servoshell/prefs.rs b/ports/servoshell/prefs.rs index 79e7d8540ae..870926bf871 100644 --- a/ports/servoshell/prefs.rs +++ b/ports/servoshell/prefs.rs @@ -359,13 +359,6 @@ pub(crate) fn parse_command_line_arguments(args: Vec) -> ArgumentParsing print_debug_options_usage(app_name); } - let tile_size: usize = match opt_match.opt_str("s") { - Some(tile_size_str) => tile_size_str - .parse() - .unwrap_or_else(|err| args_fail(&format!("Error parsing option: -s ({})", err))), - None => 512, - }; - // If only the flag is present, default to a 5 second period for both profilers let time_profiling = if opt_match.opt_present("p") { match opt_match.opt_str("p") { @@ -560,7 +553,6 @@ pub(crate) fn parse_command_line_arguments(args: Vec) -> ArgumentParsing let opts = Opts { debug: debug_options.clone(), legacy_layout, - tile_size, time_profiling, time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"), mem_profiler_period,