Auto merge of #18571 - bholley:primary_reuse_api, r=emilio

Add a geckolib API to check for primary style reuse

https://bugzilla.mozilla.org/show_bug.cgi?id=1401317

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18571)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-20 02:05:57 -05:00 committed by GitHub
commit 3cea16e18f
4 changed files with 21 additions and 3 deletions

View file

@ -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;
@ -842,13 +842,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;