mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
script: Ensure notify_invalidations()
is always called when modifying stylesheets (#38530)
This change supplements the missing stylesheet invalidation notifications to fix some bugs that the modification of stylesheet does not take effect. Additionally, this PR add a RAII thing to mark the modification scope of stylesheet rules, which will facilitate to add extra logic before the modification happens. Fixes: there is relevant issue #38211 , but it can't be fixed by this PR. Testing: This fixes some subtests in `/css/cssom/CSSStyleSheet-constructable.html`. Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
parent
aca4bde93d
commit
8b574539d1
5 changed files with 8 additions and 11 deletions
|
@ -148,6 +148,7 @@ impl CSSRuleList {
|
|||
self.dom_rules
|
||||
.borrow_mut()
|
||||
.insert(index, MutNullableDom::new(Some(&*dom_rule)));
|
||||
parent_stylesheet.notify_invalidations();
|
||||
Ok(idx)
|
||||
}
|
||||
|
||||
|
@ -167,6 +168,7 @@ impl CSSRuleList {
|
|||
r.detach()
|
||||
}
|
||||
dom_rules.remove(index);
|
||||
self.parent_stylesheet.notify_invalidations();
|
||||
Ok(())
|
||||
},
|
||||
RulesSource::Keyframes(ref kf) => {
|
||||
|
@ -177,6 +179,7 @@ impl CSSRuleList {
|
|||
}
|
||||
dom_rules.remove(index);
|
||||
kf.write_with(&mut guard).keyframes.remove(index);
|
||||
self.parent_stylesheet.notify_invalidations();
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue