Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 7bee76713e402b7bf22a24c7ab90ed0e3bbcb052..43ddfa36b165137c78d7949ca23d219337dbbcd9 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -531,9 +531,6 @@ void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto |
// Now check SMIL animation override style. |
if (includeSMILProperties && state.element()->isSVGElement()) |
collector.addElementStyleProperties(toSVGElement(state.element())->animatedSMILStyleProperties(), false /* isCacheable */); |
- |
- if (state.element()->hasActiveAnimations()) |
- collector.matchedResult().isCacheable = false; |
} |
} |
@@ -1176,6 +1173,7 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; |
bool applyInheritedOnly = false; |
+ bool applyAnimatedOnly = false; |
const CachedMatchedProperties* cachedMatchedProperties = 0; |
if (cacheHash && (cachedMatchedProperties = m_matchedPropertiesCache.find(cacheHash, state, matchResult)) |
@@ -1195,109 +1193,104 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
// Unfortunately the link status is treated like an inherited property. We need to explicitly restore it. |
state.style()->setInsideLink(linkStatus); |
- return; |
+ |
+ if (RuntimeEnabledFeatures::webAnimationsEnabled()) { |
Steve Block
2013/11/14 02:17:18
This should probably be WebAnimationsCSSEnabled()
dstockwell
2013/11/14 02:59:49
It's a bit mixed up, we could just kill the 'WebAn
Timothy Loh
2013/11/14 03:06:31
Erm; changed the callers in this file anyway.
|
+ applyAnimatedOnly = element->hasActiveAnimations() |
dstockwell
2013/11/13 23:37:19
Would it be cleaner to pull out the application of
Steve Block
2013/11/14 02:17:18
Agreed
Timothy Loh
2013/11/14 03:06:31
Done. I wasn't sure if this would make it cleaner,
|
+ || (state.style()->transitions() && !state.style()->transitions()->isEmpty()) |
+ || (state.style()->animations() && !state.style()->animations()->isEmpty()); |
+ } |
+ if (!applyAnimatedOnly) |
+ return; |
} |
applyInheritedOnly = true; |
} |
- // First apply all variable definitions, as they may be used during application of later properties. |
- applyMatchedProperties<VariableDefinitions>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
- applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
- applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
- applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- |
- // Apply animation properties in order to apply animation results and trigger transitions below. |
- applyMatchedProperties<AnimationProperties>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
- applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
- applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
- applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- |
- // Match transition-property / animation-name length by trimming and |
- // lengthening other transition / animation property lists |
- // FIXME: This is wrong because we shouldn't affect the computed values |
- state.style()->adjustAnimations(); |
- state.style()->adjustTransitions(); |
- |
- // Now we have all of the matched rules in the appropriate order. Walk the rules and apply |
- // high-priority properties first, i.e., those properties that other properties depend on. |
- // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important |
- // and (4) normal important. |
- state.setLineHeightValue(0); |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- |
- if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effectiveZoom() != state.style()->effectiveZoom()) { |
- state.fontBuilder().setFontDirty(true); |
- applyInheritedOnly = false; |
- } |
+ if (!applyAnimatedOnly) { |
+ // First apply all variable definitions, as they may be used during application of later properties. |
+ applyMatchedProperties<VariableDefinitions>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
+ applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
+ applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
+ applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
+ |
+ // Apply animation properties in order to apply animation results and trigger transitions below. |
+ applyMatchedProperties<AnimationProperties>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
+ applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
+ applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
+ applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
+ |
+ // Match transition-property / animation-name length by trimming and |
+ // lengthening other transition / animation property lists |
+ // FIXME: This is wrong because we shouldn't affect the computed values |
+ state.style()->adjustAnimations(); |
+ state.style()->adjustTransitions(); |
+ |
+ // Now we have all of the matched rules in the appropriate order. Walk the rules and apply |
+ // high-priority properties first, i.e., those properties that other properties depend on. |
+ // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important |
+ // and (4) normal important. |
+ state.setLineHeightValue(0); |
+ applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
+ applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
+ applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
+ applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
+ |
+ if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effectiveZoom() != state.style()->effectiveZoom()) { |
+ state.fontBuilder().setFontDirty(true); |
+ applyInheritedOnly = false; |
+ } |
- // If our font got dirtied, go ahead and update it now. |
- updateFont(state); |
+ // If our font got dirtied, go ahead and update it now. |
+ updateFont(state); |
- // Line-height is set when we are sure we decided on the font-size. |
- if (state.lineHeightValue()) |
- StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeightValue()); |
+ // Line-height is set when we are sure we decided on the font-size. |
+ if (state.lineHeightValue()) |
+ StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeightValue()); |
+ |
+ // Many properties depend on the font. If it changes we just apply all properties. |
+ if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDescription() != state.style()->fontDescription()) |
+ applyInheritedOnly = false; |
- // Many properties depend on the font. If it changes we just apply all properties. |
- if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDescription() != state.style()->fontDescription()) |
- applyInheritedOnly = false; |
+ // Now do the normal priority UA properties. |
+ applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- // Now do the normal priority UA properties. |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
+ // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle. |
+ state.cacheUserAgentBorderAndBackground(); |
- // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle. |
- state.cacheUserAgentBorderAndBackground(); |
+ // Now do the author and user normal priority properties and all the !important properties. |
+ applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
+ applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
+ applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
+ applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- // Now do the author and user normal priority properties and all the !important properties. |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
+ // Start loading resources referenced by this style. |
+ m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources()); |
+ |
+#ifdef STYLE_STATS |
+ if (!cachedMatchedProperties) |
+ STYLE_STATS_ADD_MATCHED_PROPERTIES_TO_CACHE(); |
+#endif |
+ |
+ if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCacheable(element, state.style(), state.parentStyle())) { |
+ STYLE_STATS_ADD_MATCHED_PROPERTIES_ENTERED_INTO_CACHE(); |
+ m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHash, matchResult); |
+ } |
+ } |
// animatingElement may be null, for example if we're calculating the |
// style for a potential pseudo element that has yet to be created. |
if (RuntimeEnabledFeatures::webAnimationsEnabled() && animatingElement) { |
state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *state.style(), this)); |
if (state.animationUpdate()) { |
- ASSERT(!applyInheritedOnly); |
const AnimationEffect::CompositableValueMap& compositableValuesForAnimations = state.animationUpdate()->compositableValuesForAnimations(); |
const AnimationEffect::CompositableValueMap& compositableValuesForTransitions = state.animationUpdate()->compositableValuesForTransitions(); |
- // Apply animated properties, then reapply any rules marked important. |
- if (applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesForAnimations)) { |
- bool important = true; |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, important, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, important, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
- applyMatchedProperties<HighPriorityProperties>(state, matchResult, important, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- } |
+ applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesForAnimations); |
applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesForTransitions); |
- if (applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForAnimations)) { |
- bool important = true; |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, important, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, important, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); |
- applyMatchedProperties<LowPriorityProperties>(state, matchResult, important, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
- } |
+ applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForAnimations); |
applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForTransitions); |
} |
} |
- // Start loading resources referenced by this style. |
- m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources()); |
- |
ASSERT(!state.fontBuilder().fontDirty()); |
- |
-#ifdef STYLE_STATS |
- if (!cachedMatchedProperties) |
- STYLE_STATS_ADD_MATCHED_PROPERTIES_TO_CACHE(); |
-#endif |
- |
- if (cachedMatchedProperties || !cacheHash) |
- return; |
- 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); |
} |
CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& propertySet) |