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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 20560008: Don't assume so easily that RenderStyle data can be shared. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698