mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Make checks for attribute/state dependencies take stylist dirty state into account.
This is a follow-up Servo-side change for https://bugzilla.mozilla.org/show_bug.cgi?id=1352306 which caused some test failures on landing.
This commit is contained in:
parent
8c58736989
commit
accd2752ce
2 changed files with 18 additions and 2 deletions
|
@ -546,13 +546,29 @@ impl Stylist {
|
||||||
pub fn might_have_attribute_dependency(&self,
|
pub fn might_have_attribute_dependency(&self,
|
||||||
local_name: &LocalName)
|
local_name: &LocalName)
|
||||||
-> bool {
|
-> bool {
|
||||||
if *local_name == local_name!("style") {
|
if self.is_cleared || self.is_device_dirty {
|
||||||
|
// We can't tell what attributes are in our style rules until
|
||||||
|
// we rebuild.
|
||||||
|
true
|
||||||
|
} else if *local_name == local_name!("style") {
|
||||||
self.style_attribute_dependency
|
self.style_attribute_dependency
|
||||||
} else {
|
} else {
|
||||||
self.attribute_dependencies.might_contain_hash(local_name.get_hash())
|
self.attribute_dependencies.might_contain_hash(local_name.get_hash())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns whether the given ElementState bit might be relied upon by a
|
||||||
|
/// selector of some rule in the stylist.
|
||||||
|
pub fn might_have_state_dependency(&self, state: ElementState) -> bool {
|
||||||
|
if self.is_cleared || self.is_device_dirty {
|
||||||
|
// If self.is_cleared is true, we can't tell what states our style
|
||||||
|
// rules rely on until we rebuild.
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
self.state_dependencies.intersects(state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns whether the given ElementState bit is relied upon by a selector
|
/// Returns whether the given ElementState bit is relied upon by a selector
|
||||||
/// of some rule in the stylist.
|
/// of some rule in the stylist.
|
||||||
pub fn has_state_dependency(&self, state: ElementState) -> bool {
|
pub fn has_state_dependency(&self, state: ElementState) -> bool {
|
||||||
|
|
|
@ -3066,5 +3066,5 @@ pub extern "C" fn Servo_StyleSet_MightHaveAttributeDependency(raw_data: RawServo
|
||||||
pub extern "C" fn Servo_StyleSet_HasStateDependency(raw_data: RawServoStyleSetBorrowed,
|
pub extern "C" fn Servo_StyleSet_HasStateDependency(raw_data: RawServoStyleSetBorrowed,
|
||||||
state: u64) -> bool {
|
state: u64) -> bool {
|
||||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
data.stylist.has_state_dependency(ElementState::from_bits_truncate(state))
|
data.stylist.might_have_state_dependency(ElementState::from_bits_truncate(state))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue