transition-property was defaulting to all when it should default to none.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 03:55:37 +0000 (03:55 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 03:55:37 +0000 (03:55 +0000)
        It was taking a string type.  I figured out how to make it take an ident instead, so you can write:

        transition-property: opacity

        instead of

        transition-property: "opacity"

        Transition layers also weren't properly repeating patterns the way they were supposed to.  I fixed that.

        Finally, I fixed a bug in the code to fix up transition layers where something was misplaced that should have been inside a null check.

        Reviewed by aroben

        * css/CSSHelper.h:
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseTransitionProperty):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::adjustRenderStyle):
        * page/AnimationController.cpp:
        (WebCore::ImplicitAnimation::animate):
        * rendering/RenderStyle.cpp:
        (WebCore::RenderStyle::adjustTransitions):
        * rendering/RenderStyle.h:
        (WebCore::RenderStyle::initialTransitionProperty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/css/CSSHelper.h
WebCore/css/CSSParser.cpp
WebCore/css/CSSStyleSelector.cpp
WebCore/page/AnimationController.cpp
WebCore/rendering/RenderStyle.cpp
WebCore/rendering/RenderStyle.h

index d11318a9e14861079beae8c30a6c41fe53da4b2b..9f57c8712bb76dc14bb3fa476562021d346048f2 100644 (file)
@@ -1,3 +1,33 @@
+2007-10-30  David Hyatt  <hyatt@apple.com>
+
+        transition-property was defaulting to all when it should default to none.  
+
+        It was taking a string type.  I figured out how to make it take an ident instead, so you can write:
+
+        transition-property: opacity
+
+        instead of
+
+        transition-property: "opacity"
+
+        Transition layers also weren't properly repeating patterns the way they were supposed to.  I fixed that.
+
+        Finally, I fixed a bug in the code to fix up transition layers where something was misplaced that should have been inside a null check.
+
+        Reviewed by aroben
+
+        * css/CSSHelper.h:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseTransitionProperty):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::adjustRenderStyle):
+        * page/AnimationController.cpp:
+        (WebCore::ImplicitAnimation::animate):
+        * rendering/RenderStyle.cpp:
+        (WebCore::RenderStyle::adjustTransitions):
+        * rendering/RenderStyle.h:
+        (WebCore::RenderStyle::initialTransitionProperty):
+
 2007-10-30  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Geoff.
index 7f32d88f37e2494b667c7a37536981c6095e1ccb..2a882e49aca57d6f0490fdce5156ba43e808073b 100644 (file)
@@ -37,6 +37,10 @@ namespace WebCore {
     // "absolute" CSS length units like inch and pt is always fixed and never changes.
     const float cssPixelsPerInch = 96.0f;
 
+    // Used by animation.
+    const int cAnimateNone = 0;
+    const int cAnimateAll = -2;
+
 } // namespace WebCore
 
 #endif // CSSHelper_h
index a563f34b56b748459649d4a608bd97f9ec7dbd3a..76f982ea6be87a9935ad41e606f04e21c594c129 100644 (file)
@@ -2234,13 +2234,16 @@ CSSValue* CSSParser::parseTransitionTimingFunction()
 CSSValue* CSSParser::parseTransitionProperty()
 {
     Value* value = valueList->current();
-    if (value->unit == CSSPrimitiveValue::CSS_STRING) {
-        // Use getPropertyID to map from a string value to a property id.
-        // FIXME: Reduce the amount of copying here.
+    if (value->unit == CSSPrimitiveValue::CSS_IDENT) {
         DeprecatedString str = deprecatedString(value->string);
         str.lower();
+        if (str == "all")
+            return new CSSPrimitiveValue(cAnimateAll);
+        if (str == "none")
+            return new CSSPrimitiveValue(cAnimateNone);
         int result = getPropertyID(str.ascii(), str.length());
-        return new CSSPrimitiveValue(result);
+        if (result)
+            return new CSSPrimitiveValue(result);
     }
     return 0;
 }
index 17a8eb2bb54faeefa936a6c6b8208dc03fab1a3e..1527f9e934fdc49929b2b66ce5e3765896ff6743 100644 (file)
@@ -1131,6 +1131,9 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
     // Cull out any useless layers and also repeat patterns into additional layers.
     style->adjustBackgroundLayers();
 
+    // Do the same for transitions.
+    style->adjustTransitions();
+
     // Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will
     // alter fonts and heights/widths.
     if (e && e->isControl() && style->fontSize() >= 11) {
index 92cf4a0b9ff7a5da42404c62313091f6d71e3d8f..cb3af9c74e1923484e49ddc0fb4acb28792c49f4 100644 (file)
@@ -297,7 +297,7 @@ static inline TransformOperations blendFunc(const TransformOperations& from, con
     if (m_property == prop && m_toStyle->getter() != targetStyle->getter()) \
         reset(renderer, currentStyle, targetStyle); \
     \
-    if ((m_property == RenderStyle::initialTransitionProperty() && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
+    if ((m_property == cAnimateAll && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
         if (m_fromStyle->getter() != m_toStyle->getter()) {\
             m_finished = false; \
             if (!animatedStyle) \
@@ -312,7 +312,7 @@ static inline TransformOperations blendFunc(const TransformOperations& from, con
     if (m_property == prop && (!m_toStyle->getter() || !targetStyle->getter() || *m_toStyle->getter() != *targetStyle->getter())) \
         reset(renderer, currentStyle, targetStyle); \
     \
-    if ((m_property == RenderStyle::initialTransitionProperty() && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
+    if ((m_property == cAnimateAll && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
         if (m_fromStyle->getter() && m_toStyle->getter() && *m_fromStyle->getter() != *m_toStyle->getter()) {\
             m_finished = false; \
             if (!animatedStyle) \
@@ -325,10 +325,10 @@ static inline TransformOperations blendFunc(const TransformOperations& from, con
 
 void ImplicitAnimation::animate(CompositeImplicitAnimation* animation, RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle, RenderStyle*& animatedStyle)
 {
-    // FIXME: If we have no trigger property, then the only way to tell if our goal state changed is to check
+    // FIXME: If we have no transition-property, then the only way to tell if our goal state changed is to check
     // every single animatable property.  For now we'll just diff the styles to ask that question,
     // but we should really exclude non-animatable properties.
-    if (!m_toStyle || (m_property == RenderStyle::initialTransitionProperty() && targetStyle->diff(m_toStyle)))
+    if (!m_toStyle || (m_property == cAnimateAll && targetStyle->diff(m_toStyle)))
         reset(renderer, currentStyle, targetStyle);
 
     // FIXME: Blow up shorthands so that they can be honored.
index 922848760386786368f8f3167a41ce22707e080f..cc18e5abd367086b7324b3461a8d6bc7383997b0 100644 (file)
@@ -1720,10 +1720,10 @@ void RenderStyle::adjustTransitions()
             p->m_next = 0;
             break;
         }
+    
+        // Repeat patterns into layers that don't have some properties set.
+        accessTransitions()->fillUnsetProperties();
     }
-
-    // Repeat patterns into layers that don't have some properties set.
-    accessTransitions()->fillUnsetProperties();
 }
 
 Transition* RenderStyle::accessTransitions()
index 57ef1bf3e57f05599abe26bc8f0d9d2061a7e85b..59ee0a0a9d8c7b75ecbdd58c1906dccfc0f439b4 100644 (file)
@@ -37,6 +37,7 @@
  */
 
 #include "AffineTransform.h"
+#include "CSSHelper.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSValueList.h"
 #include "Color.h"
@@ -1067,8 +1068,6 @@ private:
     double m_y2;
 };
 
-static const int cAnimateAll = -2;
-
 struct Transition {
 public:
     Transition();
@@ -2198,7 +2197,7 @@ public:
     static int initialTransitionDuration() { return 250; }
     static int initialTransitionRepeatCount() { return 1; }
     static TimingFunction initialTransitionTimingFunction() { return TimingFunction(); }
-    static int initialTransitionProperty() { return cAnimateAll; }
+    static int initialTransitionProperty() { return cAnimateNone; }
     static int initialLineClamp() { return -1; }
     static bool initialTextSizeAdjust() { return true; }
     static ETextSecurity initialTextSecurity() { return TSNONE; }