Index: Source/core/css/CSSParser.cpp |
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp |
index 3a923df744919175dc56c4b48b2f5236843d9016..1511cfde1f79376b76dfeb263faff625d294f126 100644 |
--- a/Source/core/css/CSSParser.cpp |
+++ b/Source/core/css/CSSParser.cpp |
@@ -1394,12 +1394,32 @@ void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr |
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId); |
if (prefixingVariant == propId) |
return; |
- addProperty(prefixingVariant, val.release(), important, implicit); |
+ |
+ if (m_currentShorthand) { |
+ // We can't use ShorthandScope here as we can already be inside one (e.g we are parsing CSSTransition). |
+ m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand); |
+ addProperty(prefixingVariant, val.release(), important, implicit); |
+ m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand); |
+ } else { |
+ addProperty(prefixingVariant, val.release(), important, implicit); |
+ } |
} |
void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit) |
{ |
- m_parsedProperties.append(CSSProperty(propId, value, important, m_currentShorthand, m_implicitShorthand || implicit)); |
+ CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value.get()) : 0; |
+ // This property doesn't belong to a shorthand or is a CSS variable (which will be resolved later). |
+ if (!m_currentShorthand || (primitiveValue && primitiveValue->isVariableName())) { |
+ m_parsedProperties.append(CSSProperty(propId, value, important, false, CSSPropertyInvalid, m_implicitShorthand || implicit)); |
+ return; |
+ } |
+ |
+ const Vector<StylePropertyShorthand> shorthands = matchingShorthandsForLonghand(propId); |
+ // The longhand does not belong to multiple shorthands. |
+ if (shorthands.size() == 1) |
+ m_parsedProperties.append(CSSProperty(propId, value, important, true, CSSPropertyInvalid, m_implicitShorthand || implicit)); |
+ else |
+ m_parsedProperties.append(CSSProperty(propId, value, important, true, indexOfShorthandForLonghand(m_currentShorthand, shorthands), m_implicitShorthand || implicit)); |
} |
void CSSParser::rollbackLastProperties(int num) |