Skip to content
Browse files

style: Use update() to update declarations from Servo_DeclarationBloc…


This method is used when updating the SMIL override style and from Web
Animations' Animation.commitStyles method. By using update we accurately return
false when no change is made to a declaration block.

For SMIL this simply acts as an optimization, meaning we can avoid updating the
SMIL override style ub some cases.

For Animation.commitStyles, however, this allows us to avoid generating
a mutation record. Normally making a redundant change to an attribute *does*
generate a mutation record but the style attribute is different. All browsers
avoid generating a mutation record for a redundant change to inline style.
This is specified in the behavior for setProperty[1] which does not update the
style attribute if updated is false.


Differential Revision:
  • Loading branch information...
birtles authored and emilio committed May 20, 2019
1 parent eba393c commit 7cf2e38bb7957a14093d21b1e2911acf8797c9da
Showing with 8 additions and 0 deletions.
  1. +8 −0 components/style/properties/
@@ -2337,6 +2337,14 @@ impl SourcePropertyDeclaration {

/// Create one with a single PropertyDeclaration.
pub fn with_one(decl: PropertyDeclaration) -> Self {
let mut result = Self::new();

/// Similar to Vec::drain: leaves this empty when the return value is dropped.
pub fn drain(&mut self) -> SourcePropertyDeclarationDrain {
SourcePropertyDeclarationDrain {

0 comments on commit 7cf2e38

Please sign in to comment.
You can’t perform that action at this time.