From 8000d425821f2017a1c97f77e6ee97c0627b1b86 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 19 Sep 2017 21:43:31 -0700 Subject: [PATCH] Bug 1401317 - Disable lazy pseudo caching when the originating element's primary style was reused via the rule node. r=emilio MozReview-Commit-ID: IkBa39E1bR1 --- components/style/gecko/generated/bindings.rs | 5 +++++ ports/geckolib/glue.rs | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index 3487ec2f534..59c97a0658e 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -1936,6 +1936,11 @@ extern "C" { pub fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool; } +extern "C" { + pub fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: + RawGeckoElementBorrowed) + -> bool; +} extern "C" { pub fn Servo_StyleSheet_FromUTF8Bytes(loader: *mut Loader, gecko_stylesheet: diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index eda8d6f8b4c..0211a0a0387 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -18,7 +18,7 @@ use std::ptr; use style::applicable_declarations::ApplicableDeclarationBlock; use style::context::{CascadeInputs, QuirksMode, SharedStyleContext, StyleContext}; use style::context::ThreadLocalStyleContext; -use style::data::ElementStyles; +use style::data::{ElementStyles, self}; use style::dom::{ShowSubtreeData, TElement, TNode}; use style::driver; use style::element_state::ElementState; @@ -836,13 +836,20 @@ pub extern "C" fn Servo_Element_GetPseudoComputedValues(element: RawGeckoElement } #[no_mangle] -pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool -{ +pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool { let element = GeckoElement(element); let data = element.borrow_data().expect("Invoking Servo_Element_IsDisplayNone on unstyled element"); data.styles.is_display_none() } +#[no_mangle] +pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: RawGeckoElementBorrowed) -> bool { + let element = GeckoElement(element); + let data = element.borrow_data() + .expect("Invoking Servo_Element_IsPrimaryStyleReusedViaRuleNode on unstyled element"); + data.flags.contains(data::PRIMARY_STYLE_REUSED_VIA_RULE_NODE) +} + #[no_mangle] pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetContentsStrong { let global_style_data = &*GLOBAL_STYLE_DATA;