mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Disable applicable declarations cache for elements with a style attribute.
The cache is never effective in this case since a style attribute adds to the set of applicable declarations. This also avoid avoids the cache giving out-dated (incorrect) results when `PropertyDeclarationBlock` becomes mutable in a later commit. This is sufficient for now since CSSOM is only implemented for `Element.style`. When StyleRule mutation is added, some additional mechanism (such as evicting the cache) will be needed.
This commit is contained in:
parent
aeb3efda1f
commit
d4f704cad2
1 changed files with 7 additions and 1 deletions
|
@ -502,7 +502,13 @@ trait PrivateMatchMethods: TNode {
|
||||||
-> Arc<ComputedValues>
|
-> Arc<ComputedValues>
|
||||||
where Ctx: StyleContext<'a>
|
where Ctx: StyleContext<'a>
|
||||||
{
|
{
|
||||||
let mut cacheable = true;
|
// Don’t cache applicable declarations for elements with a style attribute.
|
||||||
|
// Since the style attribute contributes to that set, no other element would have the same set
|
||||||
|
// and the cache would not be effective anyway.
|
||||||
|
// This also works around the test failures at
|
||||||
|
// https://github.com/servo/servo/pull/13459#issuecomment-250717584
|
||||||
|
let has_style_attribute = self.as_element().map_or(false, |e| e.style_attribute().is_some());
|
||||||
|
let mut cacheable = !has_style_attribute;
|
||||||
let shared_context = context.shared_context();
|
let shared_context = context.shared_context();
|
||||||
if animate_properties {
|
if animate_properties {
|
||||||
cacheable = !self.update_animations_for_cascade(shared_context,
|
cacheable = !self.update_animations_for_cascade(shared_context,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue