| 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 bfb82c11512373e37858899761c350ae954dea29..4a2cc79092c3b7a2746b3c92a0547645acae7ee0 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
|
| @@ -117,25 +117,35 @@ void MatchedPropertiesCache::ClearViewportDependent() {
|
| cache_.RemoveAll(to_remove);
|
| }
|
|
|
| -bool MatchedPropertiesCache::IsCacheable(const StyleResolverState& state) {
|
| - const ComputedStyle& style = *state.Style();
|
| - const ComputedStyle& parent_style = *state.ParentStyle();
|
| -
|
| - if (style.Unique() ||
|
| - (style.StyleType() != kPseudoIdNone && parent_style.Unique()))
|
| +bool MatchedPropertiesCache::IsStyleCacheable(const ComputedStyle& style) {
|
| + // unique() styles are not cacheable.
|
| + if (style.Unique())
|
| return false;
|
| if (style.Zoom() != ComputedStyle::InitialZoom())
|
| return false;
|
| if (style.GetWritingMode() != ComputedStyle::InitialWritingMode() ||
|
| style.Direction() != ComputedStyle::InitialDirection())
|
| return false;
|
| + // styles with non inherited properties that reference variables are not
|
| + // cacheable.
|
| + if (style.HasVariableReferenceFromNonInheritedProperty())
|
| + return false;
|
| + return true;
|
| +}
|
| +
|
| +bool MatchedPropertiesCache::IsCacheable(const StyleResolverState& state) {
|
| + const ComputedStyle& style = *state.Style();
|
| + const ComputedStyle& parent_style = *state.ParentStyle();
|
| +
|
| + if (!IsStyleCacheable(style))
|
| + return false;
|
| + if (style.StyleType() != kPseudoIdNone && parent_style.Unique())
|
| + return false;
|
| // The cache assumes static knowledge about which properties are inherited.
|
| // Without a flat tree parent, StyleBuilder::ApplyProperty will not
|
| // SetHasExplicitlyInheritedProperties on the parent style.
|
| if (!state.ParentNode() || parent_style.HasExplicitlyInheritedProperties())
|
| return false;
|
| - if (style.HasVariableReferenceFromNonInheritedProperty())
|
| - return false;
|
| return true;
|
| }
|
|
|
|
|