Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Unified Diff: third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp

Issue 2283933003: Don't cache matched properties for elements without a flat-tree parent. (Closed)
Patch Set: Pass StyleResolverState Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp b/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
index 3c86ee5319e15af2cd90d07ca020db16d4aa610b..32bdfc119b6052998733a459cd2f94accb8f4a03 100644
--- a/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
@@ -113,8 +113,11 @@ void MatchedPropertiesCache::clearViewportDependent()
m_cache.removeAll(toRemove);
}
-bool MatchedPropertiesCache::isCacheable(const ComputedStyle& style, const ComputedStyle& parentStyle)
+bool MatchedPropertiesCache::isCacheable(const StyleResolverState& state)
{
+ const ComputedStyle& style = *state.style();
+ const ComputedStyle& parentStyle = *state.parentStyle();
+
if (style.unique() || (style.styleType() != PseudoIdNone && parentStyle.unique()))
return false;
if (style.zoom() != ComputedStyle::initialZoom())
@@ -122,7 +125,9 @@ bool MatchedPropertiesCache::isCacheable(const ComputedStyle& style, const Compu
if (style.getWritingMode() != ComputedStyle::initialWritingMode() || style.direction() != ComputedStyle::initialDirection())
return false;
// The cache assumes static knowledge about which properties are inherited.
- if (parentStyle.hasExplicitlyInheritedProperties())
+ // Without a flat tree parent, StyleBuilder::applyProperty will not
+ // setHasExplicitlyInheritedProperties on the parent style.
+ if (!state.parentNode() || parentStyle.hasExplicitlyInheritedProperties())
return false;
if (style.hasVariableReferenceFromNonInheritedProperty())
return false;

Powered by Google App Engine
This is Rietveld 408576698