Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 58326ebf564cc5d013435ef99a1a126d86824991..b1d254c2335349a963265cde69a768f64142b2d9 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -51,6 +51,7 @@ |
#include "core/css/CSSSelector.h" |
#include "core/css/CSSStyleRule.h" |
#include "core/css/CSSValueList.h" |
+#include "core/css/CSSValuePool.h" |
#include "core/css/ElementRuleCollector.h" |
#include "core/css/FontFace.h" |
#include "core/css/MediaQueryEvaluator.h" |
@@ -1229,17 +1230,18 @@ static inline bool isValidFirstLetterStyleProperty(CSSPropertyID id) |
} |
} |
+static const CSSPropertyID firstAnimationProperty = CSSPropertyDisplay; |
+static const CSSPropertyID lastAnimationProperty = CSSPropertyTransitionTimingFunction; |
+COMPILE_ASSERT(firstCSSProperty == firstAnimationProperty, CSS_first_animation_property_should_be_first_property); |
+static const CSSPropertyID firstHighPriorityProperty = CSSPropertyColor; |
+static const CSSPropertyID lastHighPriorityProperty = CSSPropertyLineHeight; |
+COMPILE_ASSERT(lastAnimationProperty + 1 == firstHighPriorityProperty, CSS_color_is_first_high_priority_property); |
+COMPILE_ASSERT(CSSPropertyLineHeight == firstHighPriorityProperty + 17, CSS_line_height_is_end_of_high_prioity_property_range); |
+COMPILE_ASSERT(CSSPropertyZoom == lastHighPriorityProperty - 1, CSS_zoom_is_before_line_height); |
+ |
template <StyleResolver::StyleApplicationPass pass> |
bool StyleResolver::isPropertyForPass(CSSPropertyID property) |
{ |
- const CSSPropertyID firstAnimationProperty = CSSPropertyDisplay; |
- const CSSPropertyID lastAnimationProperty = CSSPropertyTransitionTimingFunction; |
- COMPILE_ASSERT(firstCSSProperty == firstAnimationProperty, CSS_first_animation_property_should_be_first_property); |
- const CSSPropertyID firstHighPriorityProperty = CSSPropertyColor; |
- const CSSPropertyID lastHighPriorityProperty = CSSPropertyLineHeight; |
- COMPILE_ASSERT(lastAnimationProperty + 1 == firstHighPriorityProperty, CSS_color_is_first_high_priority_property); |
- COMPILE_ASSERT(CSSPropertyLineHeight == firstHighPriorityProperty + 17, CSS_line_height_is_end_of_high_prioity_property_range); |
- COMPILE_ASSERT(CSSPropertyZoom == lastHighPriorityProperty - 1, CSS_zoom_is_before_line_height); |
switch (pass) { |
case AnimationProperties: |
return property >= firstAnimationProperty && property <= lastAnimationProperty; |
@@ -1253,6 +1255,50 @@ bool StyleResolver::isPropertyForPass(CSSPropertyID property) |
} |
template <StyleResolver::StyleApplicationPass pass> |
+void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allValue) |
+{ |
+ bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedValue(); |
+ unsigned startCSSProperty; |
+ unsigned endCSSProperty; |
+ switch (pass) { |
+ case AnimationProperties: |
esprehn
2014/05/30 00:59:22
Can we put this in a method so you could do:
star
tasak
2014/06/04 09:37:41
I see. Done.
I also modified COMPILE_ASSERT. So t
|
+ startCSSProperty = firstAnimationProperty; |
+ endCSSProperty = lastAnimationProperty; |
+ break; |
+ case HighPriorityProperties: |
+ startCSSProperty = firstHighPriorityProperty; |
+ endCSSProperty = lastHighPriorityProperty; |
+ break; |
+ case LowPriorityProperties: |
+ startCSSProperty = lastHighPriorityProperty + 1; |
+ endCSSProperty = lastCSSProperty; |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ |
+ for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { |
esprehn
2014/05/30 00:59:22
Can we just do CSSPropertyID and ++ on it?
tasak
2014/06/04 09:37:41
Since CSSPropertyID is enum, we cannot ++.
|
+ CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); |
+ |
+ if (isExpandedShorthandForAll(propertyId)) |
+ continue; |
+ if (propertyId == CSSPropertyAll || propertyId == CSSPropertyUnicodeBidi || propertyId == CSSPropertyDirection) |
esprehn
2014/05/30 00:59:22
This list is somewhere else too I think in the sam
tasak
2014/06/04 09:37:41
Yeah. I have the same condition in several places.
|
+ continue; |
+ |
+ CSSValue* value; |
+ if (!isUnsetValue) { |
+ value = allValue; |
+ } else { |
+ if (CSSProperty::isInheritedProperty(propertyId)) |
+ value = cssValuePool().createInheritedValue().get(); |
+ else |
+ value = cssValuePool().createExplicitInitialValue().get(); |
+ } |
+ StyleBuilder::applyProperty(propertyId, state, value); |
+ } |
+} |
+ |
+template <StyleResolver::StyleApplicationPass pass> |
void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) |
{ |
state.setCurrentRule(rule); |
@@ -1262,6 +1308,13 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper |
StylePropertySet::PropertyReference current = properties->propertyAt(i); |
if (isImportant != current.isImportant()) |
continue; |
+ |
+ CSSPropertyID property = current.id(); |
+ if (property == CSSPropertyAll) { |
+ applyAllProperty<pass>(state, current.value()); |
+ continue; |
+ } |
+ |
if (inheritedOnly && !current.isInherited()) { |
// If the property value is explicitly inherited, we need to apply further non-inherited properties |
// as they might override the value inherited here. For this reason we don't allow declarations with |
@@ -1269,7 +1322,6 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper |
ASSERT(!current.value()->isInheritedValue()); |
continue; |
} |
- CSSPropertyID property = current.id(); |
if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStyleProperty(property)) |
continue; |