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

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

Issue 18686005: Style resolution: Apply animation properties earlier in a separate pass (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 68dff1e1f44ad07ebf26745e40520d679121011c..d6433132a5e927804e25a23b6d1cc85b12a99d29 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -1138,8 +1138,11 @@ PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(const RenderStyle* eleme
// We don't need to bother with !important. Since there is only ever one
// decl, there's nothing to override. So just add the first properties.
bool inheritedOnly = false;
- if (keyframe->properties())
+ if (keyframe->properties()) {
+ // FIXME: Can't keyframes contain variables?
+ applyMatchedProperties<AnimationProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
applyMatchedProperties<HighPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
+ }
// If our font got dirtied, go ahead and update it now.
updateFont();
@@ -1787,6 +1790,8 @@ Length StyleResolver::convertToFloatLength(CSSPrimitiveValue* primitiveValue, Re
template <StyleResolver::StyleApplicationPass pass>
void StyleResolver::applyAnimatedProperties(const Element* target)
{
+ ASSERT(pass != VariableDefinitions);
+ ASSERT(pass != AnimationProperties);
if (!target->hasActiveAnimations())
return;
@@ -1797,22 +1802,10 @@ void StyleResolver::applyAnimatedProperties(const Element* target)
const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
CSSPropertyID property = iter->key;
- switch (pass) {
- case VariableDefinitions:
- ASSERT_NOT_REACHED();
+ if (!isPropertyForPass<pass>(property))
continue;
- case HighPriorityProperties:
- if (property > CSSPropertyLineHeight)
- continue;
- break;
- case LowPriorityProperties:
- if (property <= CSSPropertyLineHeight)
- continue;
- break;
- }
- // FIXME: Composite onto the underlying value.
RefPtr<CSSValue> value = iter->value->compositeOnto(AnimatableValue::neutralValue())->toCSSValue();
- if (property == CSSPropertyLineHeight)
+ if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
m_state.setLineHeightValue(value.get());
else
applyProperty(property, value.get());
@@ -1926,29 +1919,12 @@ void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRul
continue;
if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStyleProperty(property))
continue;
- switch (pass) {
- case VariableDefinitions:
- COMPILE_ASSERT(CSSPropertyVariable < firstCSSProperty, CSS_variable_is_before_first_property);
- if (property == CSSPropertyVariable)
- applyProperty(current.id(), current.value());
- break;
- case HighPriorityProperties:
- COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
- COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 17, CSS_zoom_is_end_of_first_prop_range);
- COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
- if (property == CSSPropertyVariable)
- continue;
- // give special priority to font-xxx, color properties, etc
- if (property < CSSPropertyLineHeight)
- applyProperty(current.id(), current.value());
- // we apply line-height later
- else if (property == CSSPropertyLineHeight)
- m_state.setLineHeightValue(current.value());
- break;
- case LowPriorityProperties:
- if (property > CSSPropertyLineHeight)
- applyProperty(current.id(), current.value());
- }
+ if (!isPropertyForPass<pass>(property))
+ continue;
+ if (property == CSSPropertyLineHeight)
+ m_state.setLineHeightValue(current.value());
+ else
+ applyProperty(current.id(), current.value());
}
InspectorInstrumentation::didProcessRule(cookie);
}
@@ -2046,6 +2022,13 @@ void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const
applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
+ // Apply animation properties in order to apply animation results and trigger transitions below.
+ applyMatchedProperties<AnimationProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
+ applyMatchedProperties<AnimationProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
+ applyMatchedProperties<AnimationProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
+ applyMatchedProperties<AnimationProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
+ // FIXME: animations should be triggered here
+
// 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
« Source/core/css/resolver/StyleResolver.h ('K') | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698