From 2507bfb2cf3a5d16d457bb8ebc56545d8d6cee09 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Tue, 1 Mar 2016 15:09:04 -0700 Subject: Suppress reflows before RefreshTick or FirstLoad This fixes a bug where partially loaded content is displayed to the user before it should be, usually before stylesheets have loaded. This commit supresses reflows until either FirstLoad or RefreshTick, whichever comes first. Unfortunately, hit_test and mouse_over did not do reflows if they were necessary, and so by suppressing the initial spurious reflows, these methods started to panic without a display list to query. This patch also transforms these into queries similar to the other existing queries. --- components/script/layout_interface.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'components/script/layout_interface.rs') diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index 3976f0a8d20..9a8cddf97e1 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -105,7 +105,7 @@ pub trait LayoutRPC { /// Requests the geometry of this node. Used by APIs such as `clientTop`. fn node_geometry(&self) -> NodeGeometryResponse; /// Requests the node containing the point of interest - fn hit_test(&self, point: Point2D, update_cursor: bool) -> Result; + fn hit_test(&self) -> HitTestResponse; /// Query layout for the resolved value of a given CSS property fn resolved_style(&self) -> ResolvedStyleResponse; fn offset_parent(&self) -> OffsetParentResponse; @@ -134,10 +134,12 @@ impl MarginStyleResponse { pub struct ContentBoxResponse(pub Rect); pub struct ContentBoxesResponse(pub Vec>); +pub struct HitTestResponse { + pub node_address: Option, +} pub struct NodeGeometryResponse { pub client_rect: Rect, } -pub struct HitTestResponse(pub UntrustedNodeAddress); pub struct ResolvedStyleResponse(pub Option); #[derive(Clone)] @@ -161,6 +163,7 @@ pub enum ReflowQueryType { NoQuery, ContentBoxQuery(TrustedNodeAddress), ContentBoxesQuery(TrustedNodeAddress), + HitTestQuery(Point2D, bool), NodeGeometryQuery(TrustedNodeAddress), ResolvedStyleQuery(TrustedNodeAddress, Option, Atom), OffsetParentQuery(TrustedNodeAddress), -- cgit v1.2.3