mirror of
https://github.com/servo/servo.git
synced 2025-06-22 16:18:59 +01:00
Set the dirty flag of DeclarationBlock when the DeclarationBlock is modified and clear the flag when it's resyled.
This commit is contained in:
parent
011a7adf56
commit
636c47da29
3 changed files with 16 additions and 0 deletions
|
@ -329,6 +329,11 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
|||
/// Get this element's style attribute.
|
||||
fn style_attribute(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>>;
|
||||
|
||||
/// Unset the style attribute's dirty bit.
|
||||
/// Servo doesn't need to manage ditry bit for style attribute.
|
||||
fn unset_dirty_style_attribute(&self) {
|
||||
}
|
||||
|
||||
/// Get this element's SMIL override declarations.
|
||||
fn get_smil_override(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
None
|
||||
|
|
|
@ -43,6 +43,7 @@ use gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock;
|
|||
use gecko_bindings::bindings::Gecko_GetStyleContext;
|
||||
use gecko_bindings::bindings::Gecko_IsSignificantChild;
|
||||
use gecko_bindings::bindings::Gecko_MatchStringArgPseudo;
|
||||
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
|
||||
use gecko_bindings::bindings::Gecko_UpdateAnimations;
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode};
|
||||
|
@ -628,6 +629,14 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
declarations.map_or(None, |s| s.as_arc_opt())
|
||||
}
|
||||
|
||||
fn unset_dirty_style_attribute(&self) {
|
||||
if !self.may_have_style_attribute() {
|
||||
return;
|
||||
}
|
||||
|
||||
unsafe { Gecko_UnsetDirtyStyleAttr(self.0) };
|
||||
}
|
||||
|
||||
fn get_smil_override(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
let declarations = unsafe { Gecko_GetSMILOverrideDeclarationBlock(self.0) };
|
||||
declarations.map(|s| s.as_arc_opt()).unwrap_or(None)
|
||||
|
|
|
@ -1019,6 +1019,7 @@ pub trait MatchMethods : TElement {
|
|||
&mut matching_context,
|
||||
&mut set_selector_flags);
|
||||
}
|
||||
self.unset_dirty_style_attribute();
|
||||
|
||||
let primary_rule_node = stylist.rule_tree().compute_rule_node(
|
||||
&mut applicable_declarations,
|
||||
|
@ -1301,6 +1302,7 @@ pub trait MatchMethods : TElement {
|
|||
result |= replace_rule_node(CascadeLevel::StyleAttributeImportant,
|
||||
style_attribute,
|
||||
primary_rules);
|
||||
self.unset_dirty_style_attribute();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue