diff --git a/components/layout/layout_impl.rs b/components/layout/layout_impl.rs index 77f5a70582e..7507e705d30 100644 --- a/components/layout/layout_impl.rs +++ b/components/layout/layout_impl.rs @@ -181,6 +181,11 @@ pub struct LayoutThread { /// Debug options, copied from configuration to this `LayoutThread` in order /// to avoid having to constantly access the thread-safe global options. debug: DebugOptions, + + /// Tracks the node that was highlighted by the devtools during the last reflow. + /// + /// If this changed, then we need to create a new display list. + previously_highlighted_dom_node: Cell>, } pub struct LayoutFactoryImpl(); @@ -555,6 +560,7 @@ impl LayoutThread { stylist: Stylist::new(device, QuirksMode::NoQuirks), resolved_images_cache: Default::default(), debug: opts::get().debug.clone(), + previously_highlighted_dom_node: Cell::new(None), } } @@ -648,6 +654,12 @@ impl LayoutThread { &snapshot_map, ); + if self.previously_highlighted_dom_node.get() != reflow_request.highlighted_dom_node { + // Need to manually force layout to build a new display list regardless of whether the box tree + // changed or not. + self.need_new_display_list.set(true); + } + let mut layout_context = LayoutContext { id: self.id, origin: reflow_request.origin.clone(), @@ -992,6 +1004,8 @@ impl LayoutThread { self.have_ever_generated_display_list.set(true); self.need_new_display_list.set(false); + self.previously_highlighted_dom_node + .set(reflow_request.highlighted_dom_node); true }