Chromium Code Reviews| Index: Source/core/css/resolver/StyleResolver.cpp |
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
| index d5bbca9acf27a3e6a4add9c5a290cc4992930ede..30d450de65d64e0fb1d1e3ea882e79266044490c 100644 |
| --- a/Source/core/css/resolver/StyleResolver.cpp |
| +++ b/Source/core/css/resolver/StyleResolver.cpp |
| @@ -605,7 +605,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS |
| else |
| matchAllRules(state, collector, m_matchAuthorAndUserStyles, matchingBehavior != MatchAllRulesExcludingSMIL); |
| - applyMatchedProperties(state, collector.matchedResult(), element); |
| + applyMatchedProperties(state, collector.matchedResult()); |
| } |
| { |
| StyleAdjuster adjuster(state.cachedUAStyle(), m_document->inQuirksMode()); |
| @@ -800,7 +800,7 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P |
| state.style()->setStyleType(pseudoStyleRequest.pseudoId); |
| - applyMatchedProperties(state, collector.matchedResult(), e); |
| + applyMatchedProperties(state, collector.matchedResult()); |
| } |
| { |
| StyleAdjuster adjuster(state.cachedUAStyle(), m_document->inQuirksMode()); |
| @@ -1188,8 +1188,9 @@ void StyleResolver::invalidateMatchedPropertiesCache() |
| m_matchedPropertiesCache.clear(); |
| } |
| -void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult, const Element* element) |
| +void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult) |
| { |
| + const Element* element = state.element(); |
| ASSERT(element); |
| STYLE_STATS_ADD_MATCHED_PROPERTIES_SEARCH(); |
| @@ -1197,7 +1198,8 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
| bool applyInheritedOnly = false; |
| const CachedMatchedProperties* cachedMatchedProperties = 0; |
| - if (cacheHash && (cachedMatchedProperties = m_matchedPropertiesCache.find(cacheHash, state, matchResult))) { |
| + if (cacheHash && (cachedMatchedProperties = m_matchedPropertiesCache.find(cacheHash, state, matchResult)) |
| + && MatchedPropertiesCache::isCacheable(element, state.style(), state.parentStyle())) { |
|
ojan
2013/07/28 17:42:31
Not a big deal, but it'd be nice if we saved the i
|
| STYLE_STATS_ADD_MATCHED_PROPERTIES_HIT(); |
| // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact |
| // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the |
| @@ -1286,7 +1288,7 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
| if (cachedMatchedProperties || !cacheHash) |
| return; |
| - if (!MatchedPropertiesCache::isCacheable(state.element(), state.style(), state.parentStyle())) |
| + if (!MatchedPropertiesCache::isCacheable(element, state.style(), state.parentStyle())) |
| return; |
| STYLE_STATS_ADD_MATCHED_PROPERTIES_ENTERED_INTO_CACHE(); |
| m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHash, matchResult); |