Title: [145344] branches/chromium/1410
Revision
145344
Author
[email protected]
Date
2013-03-11 01:30:59 -0700 (Mon, 11 Mar 2013)

Log Message

Merge 144626
> transition properties can't be found in CSSStyleDeclaration
> https://bugs.webkit.org/show_bug.cgi?id=110011
> 
> Reviewed by Antti Koivisto.
> 
> Source/WebCore:
> 
> The previous approach for handling the unprefixing was to alias the
> unprefixed properties with the prefixed ones in CSSPropertyNames.in.
> Unfortunately it will alias the properties in the parsing code which will just
> identically parse the two versions. This means that when we populate StylePropertySet
> we do not have information whether we just parsed the prefixed, the
> unprefixed properties or we parsed both. The patch takes another
> approach by creating two distinct sets of properties (unprefixed and
> prefixed). Each properties have their own id and we now handle them in
> the parsing code as disctints properties and add both versions to the
> declared style. In order to avoid properties getting out of sync,
> this patch adds few facilities to StylePropertySet to update the
> prefixed and the unprefixed entries. Finally the style resolution
> happens only for the prefixed version (to limit the size of this patch)
> and the unprefixed versions are not resolved. This is to avoid creating
> the animation objects twice for the resolved style.
> 
> Test : transitions/transitions-parsing.html
> 
> * css/CSSComputedStyleDeclaration.cpp:
> (WebCore):
> (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
> * css/CSSParser.cpp:
> (WebCore::CSSParser::addPropertyWithPrefixingVariant): Always add the
> prefixed and the unprefixed property even if only one is specified.
> (WebCore):
> (WebCore::CSSParser::parseValue):
> (WebCore::CSSParser::parseTransitionShorthand): Add both prefixed and
> unprefixed longhands to the declarated style.
> (WebCore::CSSParser::parseAnimationProperty):
> * css/CSSParser.h:
> (CSSParser):
> * css/CSSProperty.cpp:
> (WebCore::CSSProperty::isInheritedProperty):
> * css/CSSProperty.h:
> (WebCore:: prefixingVariantForPropertyId): This function takes a given
> property id and returns its prefixed or unprefixed id if it exists. If
> not it returns the same id.
> (WebCore):
> * css/CSSPropertyNames.in:
> * css/StylePropertySet.cpp:
> (WebCore::StylePropertySet::getPropertyValue):
> (WebCore::StylePropertySet::removeShorthandProperty):
> (WebCore::StylePropertySet::removeProperty):
> (WebCore::StylePropertySet::removeProperty): Remove
> also the prefixed or unprefixed shorthand if it exists.
> (WebCore):
> (WebCore::StylePropertySet::setProperty):
> (WebCore::StylePropertySet:: appendPrefixingVariantProperty):
> (WebCore::StylePropertySet::setPrefixingVariantProperty): If it
> exists a unprefixed or prefixed counterpart of the property we're
> trying to set, then we update the other one.
> (WebCore::StylePropertySet::asText):
> (WebCore::StylePropertySet::mergeAndOverrideOnConflict):
> * css/StylePropertySet.h:
> (StylePropertySet):
> * css/StylePropertyShorthand.cpp:
> (WebCore::transitionShorthand):
> (WebCore):
> (WebCore::shorthandForProperty): Define the transitions unprefixed
> longhands.
> * css/StylePropertyShorthand.h:
> (WebCore):
> * css/StyleResolver.cpp:
> (WebCore::StyleResolver::applyProperty): StyleBuilder will handle the
> resolution and the creation of the animations for the style. As the
> declarated style now contains declarations for the prefixed and
> unprefixed property we do not want to resolve two times and create duplicate animations.
> Therefore when we try to resolve the unprefixed version we just bail out.
> 
> LayoutTests:
> 
> Updated layout test to cover the bug.
> 
> * transitions/transitions-parsing-expected.txt:
> * transitions/transitions-parsing.html:
> 

[email protected]
Review URL: https://codereview.chromium.org/12470005

Modified Paths

Diff

Modified: branches/chromium/1410/LayoutTests/transitions/transitions-parsing-expected.txt (145343 => 145344)


--- branches/chromium/1410/LayoutTests/transitions/transitions-parsing-expected.txt	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/LayoutTests/transitions/transitions-parsing-expected.txt	2013-03-11 08:30:59 UTC (rev 145344)
@@ -6,6 +6,8 @@
 Valid transition-property values.
 PASS computedStyle.transitionProperty is 'all'
 PASS computedStyle.webkitTransitionProperty is 'all'
+PASS Object.keys(style).indexOf('transitionProperty') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionProperty') is not -1
 PASS style.transitionProperty is 'none'
 PASS computedStyle.transitionProperty is 'none'
 PASS style.webkitTransitionProperty is 'none'
@@ -82,6 +84,8 @@
 Valid transition-duration values.
 PASS computedStyle.transitionDuration is '0s'
 PASS computedStyle.webkitTransitionDuration is '0s'
+PASS Object.keys(style).indexOf('transitionDuration') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionDuration') is not -1
 PASS style.transitionDuration is '0s'
 PASS computedStyle.transitionDuration is '0s'
 PASS style.webkitTransitionDuration is '0s'
@@ -130,6 +134,8 @@
 Valid transition-timing-function values.
 PASS computedStyle.transitionTimingFunction is 'ease'
 PASS computedStyle.webkitTransitionTimingFunction is 'ease'
+PASS Object.keys(style).indexOf('transitionTimingFunction') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionTimingFunction') is not -1
 PASS style.transitionTimingFunction is 'linear'
 PASS computedStyle.transitionTimingFunction is 'linear'
 PASS style.webkitTransitionTimingFunction is 'linear'
@@ -274,6 +280,8 @@
 Valid transition-delay values.
 PASS computedStyle.transitionDelay is '0s'
 PASS computedStyle.webkitTransitionDelay is '0s'
+PASS Object.keys(style).indexOf('transitionDelay') is not -1
+PASS Object.keys(style).indexOf('webkitTransitionDelay') is not -1
 PASS style.transitionDelay is '0s'
 PASS computedStyle.transitionDelay is '0s'
 PASS style.webkitTransitionDelay is '0s'
@@ -322,6 +330,8 @@
 Valid transition shorthand values.
 PASS computedStyle.transition is 'all 0s ease 0s'
 PASS computedStyle.webkitTransition is 'all 0s ease 0s'
+PASS Object.keys(style).indexOf('transition') is not -1
+PASS Object.keys(style).indexOf('webkitTransition') is not -1
 PASS style.transition is 'none'
 PASS computedStyle.transition is 'none 0s ease 0s'
 PASS style.webkitTransition is 'none'

Modified: branches/chromium/1410/LayoutTests/transitions/transitions-parsing.html (145343 => 145344)


--- branches/chromium/1410/LayoutTests/transitions/transitions-parsing.html	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/LayoutTests/transitions/transitions-parsing.html	2013-03-11 08:30:59 UTC (rev 145344)
@@ -30,6 +30,8 @@
 shouldBe("computedStyle.webkitTransitionProperty", "'all'");
 
 style.transitionProperty = "none";
+shouldNotBe("Object.keys(style).indexOf('transitionProperty')", "-1");
+shouldNotBe("Object.keys(style).indexOf('webkitTransitionProperty')", "-1");
 shouldBe("style.transitionProperty", "'none'");
 shouldBe("computedStyle.transitionProperty", "'none'");
 shouldBe("style.webkitTransitionProperty", "'none'");
@@ -148,6 +150,8 @@
 shouldBe("computedStyle.webkitTransitionDuration", "'0s'");
 
 style.transitionDuration = "0s";
+shouldNotBe("Object.keys(style).indexOf('transitionDuration')", "-1");
+shouldNotBe("Object.keys(style).indexOf('webkitTransitionDuration')", "-1");
 shouldBe("style.transitionDuration", "'0s'");
 shouldBe("computedStyle.transitionDuration", "'0s'");
 shouldBe("style.webkitTransitionDuration", "'0s'");
@@ -226,6 +230,8 @@
 shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
 
 style.transitionTimingFunction = "linear";
+shouldNotBe("Object.keys(style).indexOf('transitionTimingFunction')", "-1");
+shouldNotBe("Object.keys(style).indexOf('webkitTransitionTimingFunction')", "-1");
 shouldBe("style.transitionTimingFunction", "'linear'");
 shouldBe("computedStyle.transitionTimingFunction", "'linear'");
 shouldBe("style.webkitTransitionTimingFunction", "'linear'");
@@ -447,6 +453,8 @@
 shouldBe("computedStyle.webkitTransitionDelay", "'0s'");
 
 style.transitionDelay = "0s";
+shouldNotBe("Object.keys(style).indexOf('transitionDelay')", "-1");
+shouldNotBe("Object.keys(style).indexOf('webkitTransitionDelay')", "-1");
 shouldBe("style.transitionDelay", "'0s'");
 shouldBe("computedStyle.transitionDelay", "'0s'");
 shouldBe("style.webkitTransitionDelay", "'0s'");
@@ -525,6 +533,8 @@
 shouldBe("computedStyle.webkitTransition", "'all 0s ease 0s'");
 
 style.transition = "none";
+shouldNotBe("Object.keys(style).indexOf('transition')", "-1");
+shouldNotBe("Object.keys(style).indexOf('webkitTransition')", "-1");
 shouldBe("style.transition", "'none'");
 shouldBe("computedStyle.transition", "'none 0s ease 0s'");
 shouldBe("style.webkitTransition", "'none'");

Modified: branches/chromium/1410/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-03-11 08:30:59 UTC (rev 145344)
@@ -198,6 +198,10 @@
     CSSPropertyTextOverflow,
     CSSPropertyTextTransform,
     CSSPropertyTop,
+    CSSPropertyTransitionDelay,
+    CSSPropertyTransitionDuration,
+    CSSPropertyTransitionProperty,
+    CSSPropertyTransitionTimingFunction,
     CSSPropertyUnicodeBidi,
     CSSPropertyVerticalAlign,
     CSSPropertyVisibility,
@@ -2517,14 +2521,19 @@
         }
         case CSSPropertyWebkitTransformStyle:
             return cssValuePool().createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
+        case CSSPropertyTransitionDelay:
         case CSSPropertyWebkitTransitionDelay:
             return getDelayValue(style->transitions());
+        case CSSPropertyTransitionDuration:
         case CSSPropertyWebkitTransitionDuration:
             return getDurationValue(style->transitions());
+        case CSSPropertyTransitionProperty:
         case CSSPropertyWebkitTransitionProperty:
             return getTransitionPropertyValue(style->transitions());
+        case CSSPropertyTransitionTimingFunction:
         case CSSPropertyWebkitTransitionTimingFunction:
             return getTimingFunctionValue(style->transitions());
+        case CSSPropertyTransition:
         case CSSPropertyWebkitTransition: {
             const AnimationList* animList = style->transitions();
             if (animList) {

Modified: branches/chromium/1410/Source/WebCore/css/CSSParser.cpp (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/CSSParser.cpp	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/CSSParser.cpp	2013-03-11 08:30:59 UTC (rev 145344)
@@ -1475,6 +1475,17 @@
     return StylePropertySet::createImmutable(results.data(), results.size(), m_context.mode);
 }
 
+void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
+{
+    RefPtr<CSSValue> val = value.get();
+    addProperty(propId, value, important, implicit);
+
+    CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId);
+    if (prefixingVariant == propId)
+        return;
+    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));
@@ -2499,13 +2510,17 @@
     case CSSPropertyWebkitAnimationPlayState:
     case CSSPropertyWebkitAnimationIterationCount:
     case CSSPropertyWebkitAnimationTimingFunction:
+    case CSSPropertyTransitionDelay:
+    case CSSPropertyTransitionDuration:
+    case CSSPropertyTransitionTimingFunction:
+    case CSSPropertyTransitionProperty:
     case CSSPropertyWebkitTransitionDelay:
     case CSSPropertyWebkitTransitionDuration:
     case CSSPropertyWebkitTransitionTimingFunction:
     case CSSPropertyWebkitTransitionProperty: {
         RefPtr<CSSValue> val;
         if (parseAnimationProperty(propId, val)) {
-            addProperty(propId, val.release(), important);
+            addPropertyWithPrefixingVariant(propId, val.release(), important);
             return true;
         }
         return false;
@@ -2744,8 +2759,9 @@
         return parseShorthand(propId, webkitTextStrokeShorthand(), important);
     case CSSPropertyWebkitAnimation:
         return parseAnimationShorthand(important);
+    case CSSPropertyTransition:
     case CSSPropertyWebkitTransition:
-        return parseTransitionShorthand(important);
+        return parseTransitionShorthand(propId, important);
     case CSSPropertyInvalid:
         return false;
     case CSSPropertyPage:
@@ -3256,12 +3272,13 @@
     return true;
 }
 
-bool CSSParser::parseTransitionShorthand(bool important)
+bool CSSParser::parseTransitionShorthand(CSSPropertyID propId, bool important)
 {
     const unsigned numProperties = 4;
-    ASSERT(numProperties == webkitTransitionShorthand().length());
+    const StylePropertyShorthand& shorthand = shorthandForProperty(propId);
+    ASSERT(numProperties == shorthand.length());
 
-    ShorthandScope scope(this, CSSPropertyWebkitTransition);
+    ShorthandScope scope(this, propId);
 
     bool parsedProperty[numProperties] = { false };
     RefPtr<CSSValue> values[numProperties];
@@ -3285,7 +3302,7 @@
         for (i = 0; !found && i < numProperties; ++i) {
             if (!parsedProperty[i]) {
                 RefPtr<CSSValue> val;
-                if (parseAnimationProperty(webkitTransitionShorthand().properties()[i], val)) {
+                if (parseAnimationProperty(shorthand.properties()[i], val)) {
                     parsedProperty[i] = found = true;
                     addAnimationValue(values[i], val.release());
                 }
@@ -3306,7 +3323,7 @@
 
     // Now add all of the properties we found.
     for (i = 0; i < numProperties; i++)
-        addProperty(webkitTransitionShorthand().properties()[i], values[i].release(), important);
+        addPropertyWithPrefixingVariant(shorthand.properties()[i], values[i].release(), important);
 
     return true;
 }
@@ -4481,6 +4498,7 @@
         else {
             switch (propId) {
                 case CSSPropertyWebkitAnimationDelay:
+                case CSSPropertyTransitionDelay:
                 case CSSPropertyWebkitTransitionDelay:
                     currValue = parseAnimationDelay();
                     if (currValue)
@@ -4492,6 +4510,7 @@
                         m_valueList->next();
                     break;
                 case CSSPropertyWebkitAnimationDuration:
+                case CSSPropertyTransitionDuration:
                 case CSSPropertyWebkitTransitionDuration:
                     currValue = parseAnimationDuration();
                     if (currValue)
@@ -4517,6 +4536,7 @@
                     if (currValue)
                         m_valueList->next();
                     break;
+                case CSSPropertyTransitionProperty:
                 case CSSPropertyWebkitTransitionProperty:
                     if (allowAnimationProperty)
                         currValue = parseAnimationProperty(allowAnimationProperty);
@@ -4526,6 +4546,7 @@
                         m_valueList->next();
                     break;
                 case CSSPropertyWebkitAnimationTimingFunction:
+                case CSSPropertyTransitionTimingFunction:
                 case CSSPropertyWebkitTransitionTimingFunction:
                     currValue = parseAnimationTimingFunction();
                     if (currValue)

Modified: branches/chromium/1410/Source/WebCore/css/CSSParser.h (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/CSSParser.h	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/CSSParser.h	2013-03-11 08:30:59 UTC (rev 145344)
@@ -89,6 +89,7 @@
     static PassRefPtr<StylePropertySet> parseInlineStyleDeclaration(const String&, Element*);
     PassOwnPtr<MediaQuery> parseMediaQuery(const String&);
 
+    void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
     void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
     void rollbackLastProperties(int num);
     bool hasProperties() const { return !m_parsedProperties.isEmpty(); }
@@ -146,7 +147,7 @@
     bool parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
     bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result);
     bool parseAnimationProperty(CSSPropertyID, RefPtr<CSSValue>&);
-    bool parseTransitionShorthand(bool important);
+    bool parseTransitionShorthand(CSSPropertyID, bool important);
     bool parseAnimationShorthand(bool important);
 
     bool cssGridLayoutEnabled() const;

Modified: branches/chromium/1410/Source/WebCore/css/CSSProperty.cpp (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/CSSProperty.cpp	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/CSSProperty.cpp	2013-03-11 08:30:59 UTC (rev 145344)
@@ -489,6 +489,11 @@
     case CSSPropertyTextUnderlineStyle:
     case CSSPropertyTextUnderlineWidth:
     case CSSPropertyTop:
+    case CSSPropertyTransition:
+    case CSSPropertyTransitionDelay:
+    case CSSPropertyTransitionDuration:
+    case CSSPropertyTransitionProperty:
+    case CSSPropertyTransitionTimingFunction:
     case CSSPropertyUnicodeBidi:
     case CSSPropertyUnicodeRange:
     case CSSPropertyVerticalAlign:

Modified: branches/chromium/1410/Source/WebCore/css/CSSProperty.h (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/CSSProperty.h	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/CSSProperty.h	2013-03-11 08:30:59 UTC (rev 145344)
@@ -92,6 +92,48 @@
     RefPtr<CSSValue> m_value;
 };
 
+inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId)
+{
+    CSSPropertyID propertyId = CSSPropertyInvalid;
+    switch (propId) {
+    case CSSPropertyTransitionDelay:
+        propertyId = CSSPropertyWebkitTransitionDelay;
+        break;
+    case CSSPropertyTransitionDuration:
+        propertyId = CSSPropertyWebkitTransitionDuration;
+        break;
+    case CSSPropertyTransitionProperty:
+        propertyId = CSSPropertyWebkitTransitionProperty;
+        break;
+    case CSSPropertyTransitionTimingFunction:
+        propertyId = CSSPropertyWebkitTransitionTimingFunction;
+        break;
+    case CSSPropertyTransition:
+        propertyId = CSSPropertyWebkitTransition;
+        break;
+    case CSSPropertyWebkitTransitionDelay:
+        propertyId = CSSPropertyTransitionDelay;
+        break;
+    case CSSPropertyWebkitTransitionDuration:
+        propertyId = CSSPropertyTransitionDuration;
+        break;
+    case CSSPropertyWebkitTransitionProperty:
+        propertyId = CSSPropertyTransitionProperty;
+        break;
+    case CSSPropertyWebkitTransitionTimingFunction:
+        propertyId = CSSPropertyTransitionTimingFunction;
+        break;
+    case CSSPropertyWebkitTransition:
+        propertyId = CSSPropertyTransition;
+        break;
+    default:
+        propertyId = propId;
+        break;
+    }
+    ASSERT(propertyId != CSSPropertyInvalid);
+    return propertyId;
+}
+
 } // namespace WebCore
 
 namespace WTF {

Modified: branches/chromium/1410/Source/WebCore/css/CSSPropertyNames.in (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/CSSPropertyNames.in	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/CSSPropertyNames.in	2013-03-11 08:30:59 UTC (rev 145344)
@@ -182,11 +182,11 @@
 text-underline-style
 text-underline-width
 top
-transition = -webkit-transition
-transition-delay = -webkit-transition-delay
-transition-duration = -webkit-transition-duration
-transition-property = -webkit-transition-property
-transition-timing-function = -webkit-transition-timing-function
+transition
+transition-delay
+transition-duration
+transition-property
+transition-timing-function
 
 unicode-bidi
 unicode-range

Modified: branches/chromium/1410/Source/WebCore/css/StylePropertySet.cpp (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/StylePropertySet.cpp	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/StylePropertySet.cpp	2013-03-11 08:30:59 UTC (rev 145344)
@@ -172,6 +172,8 @@
         return getCommonValue(overflowShorthand());
     case CSSPropertyPadding:
         return get4Values(paddingShorthand());
+    case CSSPropertyTransition:
+        return getLayeredShorthandValue(transitionShorthand());
     case CSSPropertyListStyle:
         return getShorthandValue(listStyleShorthand());
     case CSSPropertyWebkitMaskPosition:
@@ -578,7 +580,15 @@
     StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
     if (!shorthand.length())
         return false;
-    return removePropertiesInSet(shorthand.properties(), shorthand.length());
+
+    bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length());
+
+    CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID);
+    if (prefixingVariant == propertyID)
+        return ret;
+
+    StylePropertyShorthand shorthandPrefixingVariant = shorthandForProperty(prefixingVariant);
+    return removePropertiesInSet(shorthandPrefixingVariant.properties(), shorthandPrefixingVariant.length());
 }
 
 bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText)
@@ -604,10 +614,20 @@
     // A more efficient removal strategy would involve marking entries as empty
     // and sweeping them when the vector grows too big.
     mutablePropertyVector().remove(foundPropertyIndex);
-    
+
+    removePrefixedOrUnprefixedProperty(propertyID);
+
     return true;
 }
 
+void StylePropertySet::removePrefixedOrUnprefixedProperty(CSSPropertyID propertyID)
+{
+    int foundPropertyIndex = findPropertyIndex(prefixingVariantForPropertyId(propertyID));
+    if (foundPropertyIndex == -1)
+        return;
+    mutablePropertyVector().remove(foundPropertyIndex);
+}
+
 bool StylePropertySet::propertyIsImportant(CSSPropertyID propertyID) const
 {
     int foundPropertyIndex = findPropertyIndex(propertyID);
@@ -679,12 +699,30 @@
         CSSProperty* toReplace = slot ? slot : findMutableCSSPropertyWithID(property.id());
         if (toReplace) {
             *toReplace = property;
+            setPrefixingVariantProperty(property);
             return;
         }
     }
+    appendPrefixingVariantProperty(property);
+}
+
+void StylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
+{
     mutablePropertyVector().append(property);
+    CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
+    if (prefixingVariant == property.id())
+        return;
+    mutablePropertyVector().append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit));
 }
 
+void StylePropertySet::setPrefixingVariantProperty(const CSSProperty& property)
+{
+    CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
+    CSSProperty* toReplace = findMutableCSSPropertyWithID(prefixingVariant);
+    if (toReplace)
+        *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit);
+}
+
 bool StylePropertySet::setProperty(CSSPropertyID propertyID, int identifier, bool important)
 {
     ASSERT(isMutable());
@@ -833,6 +871,12 @@
         case CSSPropertyPaddingLeft:
             shorthandPropertyID = CSSPropertyPadding;
             break;
+        case CSSPropertyTransitionProperty:
+        case CSSPropertyTransitionDuration:
+        case CSSPropertyTransitionTimingFunction:
+        case CSSPropertyTransitionDelay:
+            shorthandPropertyID = CSSPropertyTransition;
+            break;
         case CSSPropertyWebkitAnimationName:
         case CSSPropertyWebkitAnimationDuration:
         case CSSPropertyWebkitAnimationTimingFunction:
@@ -991,7 +1035,7 @@
         if (old)
             setProperty(toMerge.toCSSProperty(), old);
         else
-            mutablePropertyVector().append(toMerge.toCSSProperty());
+            appendPrefixingVariantProperty(toMerge.toCSSProperty());
     }
 }
 

Modified: branches/chromium/1410/Source/WebCore/css/StylePropertySet.h (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/StylePropertySet.h	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/StylePropertySet.h	2013-03-11 08:30:59 UTC (rev 145344)
@@ -114,9 +114,12 @@
 
     // These do not. FIXME: This is too messy, we can do better.
     bool setProperty(CSSPropertyID, int identifier, bool important = false);
+    void appendPrefixingVariantProperty(const CSSProperty&);
+    void setPrefixingVariantProperty(const CSSProperty&);
     void setProperty(const CSSProperty&, CSSProperty* slot = 0);
     
     bool removeProperty(CSSPropertyID, String* returnText = 0);
+    void removePrefixedOrUnprefixedProperty(CSSPropertyID);
 
     void parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet);
 

Modified: branches/chromium/1410/Source/WebCore/css/StylePropertyShorthand.cpp (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/StylePropertyShorthand.cpp	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/StylePropertyShorthand.cpp	2013-03-11 08:30:59 UTC (rev 145344)
@@ -246,6 +246,18 @@
     return paddingLonghands;
 }
 
+const StylePropertyShorthand& transitionShorthand()
+{
+    static const CSSPropertyID transitionProperties[] = {
+        CSSPropertyTransitionProperty,
+        CSSPropertyTransitionDuration,
+        CSSPropertyTransitionTimingFunction,
+        CSSPropertyTransitionDelay
+    };
+    DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, (transitionProperties, WTF_ARRAY_LENGTH(transitionProperties)));
+    return transitionLonghands;
+}
+
 const StylePropertyShorthand& webkitAnimationShorthand()
 {
     static const CSSPropertyID animationProperties[] = {
@@ -493,6 +505,8 @@
         return overflowShorthand();
     case CSSPropertyPadding:
         return paddingShorthand();
+    case CSSPropertyTransition:
+        return transitionShorthand();
     case CSSPropertyWebkitAnimation:
         return webkitAnimationShorthand();
     case CSSPropertyWebkitBorderAfter:

Modified: branches/chromium/1410/Source/WebCore/css/StylePropertyShorthand.h (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/StylePropertyShorthand.h	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/StylePropertyShorthand.h	2013-03-11 08:30:59 UTC (rev 145344)
@@ -80,6 +80,7 @@
 const StylePropertyShorthand& outlineShorthand();
 const StylePropertyShorthand& overflowShorthand();
 const StylePropertyShorthand& paddingShorthand();
+const StylePropertyShorthand& transitionShorthand();
 const StylePropertyShorthand& webkitAnimationShorthand();
 const StylePropertyShorthand& webkitAnimationShorthandForParsing();
 const StylePropertyShorthand& webkitBorderAfterShorthand();

Modified: branches/chromium/1410/Source/WebCore/css/StyleResolver.cpp (145343 => 145344)


--- branches/chromium/1410/Source/WebCore/css/StyleResolver.cpp	2013-03-11 07:49:31 UTC (rev 145343)
+++ branches/chromium/1410/Source/WebCore/css/StyleResolver.cpp	2013-03-11 08:30:59 UTC (rev 145344)
@@ -3590,6 +3590,12 @@
         state.style->setGridItemRow(row);
         return;
     }
+    // These properties are aliased and StyleBuilder already applied the property on the prefixed version.
+    case CSSPropertyTransitionDelay:
+    case CSSPropertyTransitionDuration:
+    case CSSPropertyTransitionProperty:
+    case CSSPropertyTransitionTimingFunction:
+        return;
     // These properties are implemented in the StyleBuilder lookup table.
     case CSSPropertyBackgroundAttachment:
     case CSSPropertyBackgroundClip:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to