Title: [144626] trunk
Revision
144626
Author
ale...@webkit.org
Date
2013-03-04 07:09:04 -0800 (Mon, 04 Mar 2013)

Log Message

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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144625 => 144626)


--- trunk/LayoutTests/ChangeLog	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/LayoutTests/ChangeLog	2013-03-04 15:09:04 UTC (rev 144626)
@@ -1,3 +1,15 @@
+2013-03-04  Alexis Menard  <ale...@webkit.org>
+
+        transition properties can't be found in CSSStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=110011
+
+        Reviewed by Antti Koivisto.
+
+        Updated layout test to cover the bug.
+
+        * transitions/transitions-parsing-expected.txt:
+        * transitions/transitions-parsing.html:
+
 2013-03-04  Antoine Quint  <grao...@apple.com>
 
         Web Inspector: remove existing LayerTreeAgent protocol APIs

Modified: trunk/LayoutTests/transitions/transitions-parsing-expected.txt (144625 => 144626)


--- trunk/LayoutTests/transitions/transitions-parsing-expected.txt	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/LayoutTests/transitions/transitions-parsing-expected.txt	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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'
@@ -98,6 +100,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'
@@ -146,6 +150,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'
@@ -290,6 +296,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'
@@ -338,6 +346,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: trunk/LayoutTests/transitions/transitions-parsing.html (144625 => 144626)


--- trunk/LayoutTests/transitions/transitions-parsing.html	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/LayoutTests/transitions/transitions-parsing.html	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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'");
@@ -172,6 +174,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'");
@@ -250,6 +254,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'");
@@ -471,6 +477,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'");
@@ -549,6 +557,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: trunk/Source/WebCore/ChangeLog (144625 => 144626)


--- trunk/Source/WebCore/ChangeLog	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/ChangeLog	2013-03-04 15:09:04 UTC (rev 144626)
@@ -1,3 +1,79 @@
+2013-03-04  Alexis Menard  <ale...@webkit.org>
+
+        transition properties can't be found in CSSStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=110011
+
+        Reviewed by Antti Koivisto.
+
+        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.
+
 2013-03-04  Ilya Tikhonovsky  <loi...@chromium.org>
 
         Web Inspector: CPU Flame Chart: reveal profiler DataGrid node when user clicks on a FlameChart item.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (144625 => 144626)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/CSSParser.cpp (144625 => 144626)


--- trunk/Source/WebCore/css/CSSParser.cpp	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2013-03-04 15:09:04 UTC (rev 144626)
@@ -1536,6 +1536,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));
@@ -2565,6 +2576,10 @@
     case CSSPropertyWebkitAnimationPlayState:
     case CSSPropertyWebkitAnimationIterationCount:
     case CSSPropertyWebkitAnimationTimingFunction:
+    case CSSPropertyTransitionDelay:
+    case CSSPropertyTransitionDuration:
+    case CSSPropertyTransitionTimingFunction:
+    case CSSPropertyTransitionProperty:
     case CSSPropertyWebkitTransitionDelay:
     case CSSPropertyWebkitTransitionDuration:
     case CSSPropertyWebkitTransitionTimingFunction:
@@ -2572,7 +2587,7 @@
         RefPtr<CSSValue> val;
         AnimationParseContext context;
         if (parseAnimationProperty(propId, val, context)) {
-            addProperty(propId, val.release(), important);
+            addPropertyWithPrefixingVariant(propId, val.release(), important);
             return true;
         }
         return false;
@@ -2811,8 +2826,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:
@@ -3329,12 +3345,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 };
     AnimationParseContext context;
@@ -3360,7 +3377,7 @@
         for (i = 0; !found && i < numProperties; ++i) {
             if (!parsedProperty[i]) {
                 RefPtr<CSSValue> val;
-                if (parseAnimationProperty(webkitTransitionShorthand().properties()[i], val, context)) {
+                if (parseAnimationProperty(shorthand.properties()[i], val, context)) {
                     parsedProperty[i] = found = true;
                     addAnimationValue(values[i], val.release());
                 }
@@ -3385,7 +3402,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;
 }
@@ -4564,6 +4581,7 @@
         else {
             switch (propId) {
                 case CSSPropertyWebkitAnimationDelay:
+                case CSSPropertyTransitionDelay:
                 case CSSPropertyWebkitTransitionDelay:
                     currValue = parseAnimationDelay();
                     if (currValue)
@@ -4575,6 +4593,7 @@
                         m_valueList->next();
                     break;
                 case CSSPropertyWebkitAnimationDuration:
+                case CSSPropertyTransitionDuration:
                 case CSSPropertyWebkitTransitionDuration:
                     currValue = parseAnimationDuration();
                     if (currValue)
@@ -4600,6 +4619,7 @@
                     if (currValue)
                         m_valueList->next();
                     break;
+                case CSSPropertyTransitionProperty:
                 case CSSPropertyWebkitTransitionProperty:
                     currValue = parseAnimationProperty(context);
                     if (value && !context.animationPropertyKeywordAllowed())
@@ -4608,6 +4628,7 @@
                         m_valueList->next();
                     break;
                 case CSSPropertyWebkitAnimationTimingFunction:
+                case CSSPropertyTransitionTimingFunction:
                 case CSSPropertyWebkitTransitionTimingFunction:
                     currValue = parseAnimationTimingFunction();
                     if (currValue)

Modified: trunk/Source/WebCore/css/CSSParser.h (144625 => 144626)


--- trunk/Source/WebCore/css/CSSParser.h	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/CSSParser.h	2013-03-04 15:09:04 UTC (rev 144626)
@@ -94,6 +94,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(); }
@@ -151,7 +152,7 @@
     bool parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
     bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result);
     bool parseAnimationProperty(CSSPropertyID, RefPtr<CSSValue>&, AnimationParseContext&);
-    bool parseTransitionShorthand(bool important);
+    bool parseTransitionShorthand(CSSPropertyID, bool important);
     bool parseAnimationShorthand(bool important);
 
     bool cssGridLayoutEnabled() const;

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (144625 => 144626)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/CSSProperty.h (144625 => 144626)


--- trunk/Source/WebCore/css/CSSProperty.h	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/CSSProperty.h	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/CSSPropertyNames.in (144625 => 144626)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/StylePropertySet.cpp (144625 => 144626)


--- trunk/Source/WebCore/css/StylePropertySet.cpp	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp	2013-03-04 15:09:04 UTC (rev 144626)
@@ -176,6 +176,8 @@
         return getCommonValue(overflowShorthand());
     case CSSPropertyPadding:
         return get4Values(paddingShorthand());
+    case CSSPropertyTransition:
+        return getLayeredShorthandValue(transitionShorthand());
     case CSSPropertyListStyle:
         return getShorthandValue(listStyleShorthand());
     case CSSPropertyWebkitMarquee:
@@ -584,7 +586,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)
@@ -610,10 +620,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);
@@ -685,12 +705,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());
@@ -839,6 +877,12 @@
         case CSSPropertyPaddingLeft:
             shorthandPropertyID = CSSPropertyPadding;
             break;
+        case CSSPropertyTransitionProperty:
+        case CSSPropertyTransitionDuration:
+        case CSSPropertyTransitionTimingFunction:
+        case CSSPropertyTransitionDelay:
+            shorthandPropertyID = CSSPropertyTransition;
+            break;
         case CSSPropertyWebkitAnimationName:
         case CSSPropertyWebkitAnimationDuration:
         case CSSPropertyWebkitAnimationTimingFunction:
@@ -997,7 +1041,7 @@
         if (old)
             setProperty(toMerge.toCSSProperty(), old);
         else
-            mutablePropertyVector().append(toMerge.toCSSProperty());
+            appendPrefixingVariantProperty(toMerge.toCSSProperty());
     }
 }
 

Modified: trunk/Source/WebCore/css/StylePropertySet.h (144625 => 144626)


--- trunk/Source/WebCore/css/StylePropertySet.h	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/StylePropertySet.h	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/StylePropertyShorthand.cpp (144625 => 144626)


--- trunk/Source/WebCore/css/StylePropertyShorthand.cpp	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.cpp	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/StylePropertyShorthand.h (144625 => 144626)


--- trunk/Source/WebCore/css/StylePropertyShorthand.h	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.h	2013-03-04 15:09:04 UTC (rev 144626)
@@ -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: trunk/Source/WebCore/css/StyleResolver.cpp (144625 => 144626)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-03-04 15:07:17 UTC (rev 144625)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-03-04 15:09:04 UTC (rev 144626)
@@ -3580,6 +3580,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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to