mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Fix MightHave{State,Attribute}Dependency for XBL.
Bug: 1375969 Reviewed-By: heycam MozReview-Commit-ID: 8I29pMHq4uf
This commit is contained in:
parent
f8346e598e
commit
9558d2d918
2 changed files with 48 additions and 6 deletions
|
@ -1936,12 +1936,15 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_StyleSet_MightHaveAttributeDependency(set:
|
pub fn Servo_StyleSet_MightHaveAttributeDependency(set:
|
||||||
RawServoStyleSetBorrowed,
|
RawServoStyleSetBorrowed,
|
||||||
|
element:
|
||||||
|
RawGeckoElementBorrowed,
|
||||||
local_name:
|
local_name:
|
||||||
*mut nsIAtom)
|
*mut nsIAtom)
|
||||||
-> bool;
|
-> bool;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_StyleSet_HasStateDependency(set: RawServoStyleSetBorrowed,
|
pub fn Servo_StyleSet_HasStateDependency(set: RawServoStyleSetBorrowed,
|
||||||
|
element: RawGeckoElementBorrowed,
|
||||||
state: u64) -> bool;
|
state: u64) -> bool;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -3171,17 +3171,56 @@ pub extern "C" fn Servo_StyleSet_ResolveForDeclarations(raw_data: RawServoStyleS
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_MightHaveAttributeDependency(raw_data: RawServoStyleSetBorrowed,
|
pub extern "C" fn Servo_StyleSet_MightHaveAttributeDependency(
|
||||||
local_name: *mut nsIAtom) -> bool {
|
raw_data: RawServoStyleSetBorrowed,
|
||||||
|
element: RawGeckoElementBorrowed,
|
||||||
|
local_name: *mut nsIAtom,
|
||||||
|
) -> bool {
|
||||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
unsafe { Atom::with(local_name, |atom| data.stylist.might_have_attribute_dependency(atom)) }
|
let element = GeckoElement(element);
|
||||||
|
let mut has_dep = false;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
Atom::with(local_name, |atom| {
|
||||||
|
has_dep = data.stylist.might_have_attribute_dependency(atom);
|
||||||
|
|
||||||
|
if !has_dep {
|
||||||
|
// TODO(emilio): Consider optimizing this storing attribute
|
||||||
|
// dependencies from UA sheets separately, so we could optimize
|
||||||
|
// the above lookup if cut_off_inheritance is true.
|
||||||
|
element.each_xbl_stylist(|stylist| {
|
||||||
|
has_dep =
|
||||||
|
has_dep || stylist.might_have_attribute_dependency(atom);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
has_dep
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_HasStateDependency(raw_data: RawServoStyleSetBorrowed,
|
pub extern "C" fn Servo_StyleSet_HasStateDependency(
|
||||||
state: u64) -> bool {
|
raw_data: RawServoStyleSetBorrowed,
|
||||||
|
element: RawGeckoElementBorrowed,
|
||||||
|
state: u64,
|
||||||
|
) -> bool {
|
||||||
|
let element = GeckoElement(element);
|
||||||
|
|
||||||
|
let state = ElementState::from_bits_truncate(state);
|
||||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
data.stylist.might_have_state_dependency(ElementState::from_bits_truncate(state))
|
|
||||||
|
let mut has_dep = data.stylist.might_have_state_dependency(state);
|
||||||
|
if !has_dep {
|
||||||
|
// TODO(emilio): Consider optimizing this storing attribute
|
||||||
|
// dependencies from UA sheets separately, so we could optimize
|
||||||
|
// the above lookup if cut_off_inheritance is true.
|
||||||
|
element.each_xbl_stylist(|stylist| {
|
||||||
|
has_dep = has_dep || stylist.might_have_state_dependency(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
has_dep
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue