From 64db84d4c5187303fec48f935ba7b148ddd78c4e Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 15 Dec 2016 14:46:09 +0800 Subject: [PATCH] stylo: Don't keep around cached style after one-off style resolutions. --- ports/geckolib/glue.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index e110f043c72..394653afd8e 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -807,6 +807,8 @@ pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed, consume: structs::ConsumeStyleBehavior, compute: structs::LazyComputeBehavior) -> ServoComputedValuesStrong { + use style::context::StyleContext; + let element = GeckoElement(element); debug!("Servo_ResolveStyle: {:?}, consume={:?}, compute={:?}", element, consume, compute); @@ -833,6 +835,9 @@ pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed, recalc_style_at::<_, _, RecalcStyleOnly>(&context, &mut traversal_data, element, &mut data); + // We don't want to keep any cached style around after this one-off style resolution. + context.local_context().style_sharing_candidate_cache.borrow_mut().clear(); + // The element was either unstyled or needed restyle. If it was unstyled, it may have // additional unstyled children that subsequent traversals won't find now that the style // on this element is up-to-date. Mark dirty descendants in that case.