WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2007 02:25:29 +0000 (02:25 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2007 02:25:29 +0000 (02:25 +0000)
        Reviewed by Dave Hyatt.

        - fix <rdar://problem/5642426> explicit cubic-bezier curves all treated as "default" for transition-timing-function

        Test: fast/css/transition-timing-function.html

        * css/CSSStyleSelector.cpp: Changed the HANDLE_MULTILAYER_VALUE macro to
        not reject non-primitive non-list values, and instead made sure that the
        mapping functions rejected them if necessary. This allows non-primitive
        timing functions to be mapped.
        (WebCore::CSSStyleSelector::mapBackgroundAttachment):
        (WebCore::CSSStyleSelector::mapBackgroundClip):
        (WebCore::CSSStyleSelector::mapBackgroundComposite):
        (WebCore::CSSStyleSelector::mapBackgroundOrigin):
        (WebCore::CSSStyleSelector::mapBackgroundImage):
        (WebCore::CSSStyleSelector::mapBackgroundRepeat):
        (WebCore::CSSStyleSelector::mapBackgroundXPosition):
        (WebCore::CSSStyleSelector::mapBackgroundYPosition):
        (WebCore::CSSStyleSelector::mapTransitionDuration):
        (WebCore::CSSStyleSelector::mapTransitionRepeatCount):
        (WebCore::CSSStyleSelector::mapTransitionTimingFunction):
        (WebCore::CSSStyleSelector::mapTransitionProperty):
        * css/CSSTimingFunctionValue.cpp:
        (WebCore::CSSTimingFunctionValue::cssText): Implemented for use in the
        regression test.
        * css/CSSTimingFunctionValue.h:
        (WebCore::CSSTimingFunctionValue::isTransitionTimingFunctionValue):
        Added. Returns true.
        * css/CSSValue.h:
        (WebCore::CSSValue::isTransitionTimingFunctionValue): Added. Returns
        false.

LayoutTests:

        Reviewed by Dave Hyatt.

        - test for <rdar://problem/5642426> explicit cubic-bezier curves all treated as "default" for transition-timing-function

        * fast/css/transition-timing-function-expected.txt: Added.
        * fast/css/transition-timing-function.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/transition-timing-function-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/transition-timing-function.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSTimingFunctionValue.cpp
WebCore/css/CSSTimingFunctionValue.h
WebCore/css/CSSValue.h
WebKit/win/ChangeLog

index 0b36757c0b3954c382ce8936acb552b31de77d83..2f89c6e80bc2af8c1b778dcd9f2d55c79b6b6f28 100644 (file)
@@ -1,3 +1,12 @@
+2007-12-13  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - test for <rdar://problem/5642426> explicit cubic-bezier curves all treated as "default" for transition-timing-function
+
+        * fast/css/transition-timing-function-expected.txt: Added.
+        * fast/css/transition-timing-function.html: Added.
+
 2007-12-13  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Adam.
diff --git a/LayoutTests/fast/css/transition-timing-function-expected.txt b/LayoutTests/fast/css/transition-timing-function-expected.txt
new file mode 100644 (file)
index 0000000..9f9b997
--- /dev/null
@@ -0,0 +1,8 @@
+Testing parsing and serialization of -webkit-transition-timing-function values.
+PASS: 'linear' parsed and serialized successfully.
+PASS: 'ease-in' parsed and serialized successfully.
+PASS: 'ease-out' parsed and serialized successfully.
+PASS: 'ease-in-out' parsed and serialized successfully.
+PASS: 'cubic-bezier(0, 0, 0, 1)' parsed and serialized successfully.
+PASS: 'cubic-bezier(0.1, 0.52, 0.11101, 0.9)' parsed and serialized successfully.
+
diff --git a/LayoutTests/fast/css/transition-timing-function.html b/LayoutTests/fast/css/transition-timing-function.html
new file mode 100644 (file)
index 0000000..d4ec358
--- /dev/null
@@ -0,0 +1,31 @@
+Testing parsing and serialization of <tt>-webkit-transition-timing-function</tt> values.
+<pre id="console">
+</pre>
+<div id="target"></div>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    function log(message)
+    {
+        var console = document.getElementById("console");
+        console.appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function roundTripTransitionTimingFunctionValue(value)
+    {
+        var element = document.getElementById("target");
+        element.style.webkitTransitionTimingFunction = value;
+        if (element.style.webkitTransitionTimingFunction === value)
+            log("PASS: '" + value + "' parsed and serialized successfully.");
+        else
+            log("FAIL: '" + value + "' serialized back as '" + element.style.webkitTransitionTimingFunction + "'.");
+    }
+
+    roundTripTransitionTimingFunctionValue("linear");
+    roundTripTransitionTimingFunctionValue("ease-in");
+    roundTripTransitionTimingFunctionValue("ease-out");
+    roundTripTransitionTimingFunctionValue("ease-in-out");
+    roundTripTransitionTimingFunctionValue("cubic-bezier(0, 0, 0, 1)");
+    roundTripTransitionTimingFunctionValue("cubic-bezier(0.1, 0.52, 0.11101, 0.9)");
+</script>
index b66ccd6b724bddfad6c7a638f7dd462e374015fd..fff5b1ce8eb79ca18ddc2a776b1528898a655f03 100644 (file)
@@ -1,3 +1,37 @@
+2007-12-13  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - fix <rdar://problem/5642426> explicit cubic-bezier curves all treated as "default" for transition-timing-function
+
+        Test: fast/css/transition-timing-function.html
+
+        * css/CSSStyleSelector.cpp: Changed the HANDLE_MULTILAYER_VALUE macro to
+        not reject non-primitive non-list values, and instead made sure that the
+        mapping functions rejected them if necessary. This allows non-primitive
+        timing functions to be mapped.
+        (WebCore::CSSStyleSelector::mapBackgroundAttachment):
+        (WebCore::CSSStyleSelector::mapBackgroundClip):
+        (WebCore::CSSStyleSelector::mapBackgroundComposite):
+        (WebCore::CSSStyleSelector::mapBackgroundOrigin):
+        (WebCore::CSSStyleSelector::mapBackgroundImage):
+        (WebCore::CSSStyleSelector::mapBackgroundRepeat):
+        (WebCore::CSSStyleSelector::mapBackgroundXPosition):
+        (WebCore::CSSStyleSelector::mapBackgroundYPosition):
+        (WebCore::CSSStyleSelector::mapTransitionDuration):
+        (WebCore::CSSStyleSelector::mapTransitionRepeatCount):
+        (WebCore::CSSStyleSelector::mapTransitionTimingFunction):
+        (WebCore::CSSStyleSelector::mapTransitionProperty):
+        * css/CSSTimingFunctionValue.cpp:
+        (WebCore::CSSTimingFunctionValue::cssText): Implemented for use in the
+        regression test.
+        * css/CSSTimingFunctionValue.h:
+        (WebCore::CSSTimingFunctionValue::isTransitionTimingFunctionValue):
+        Added. Returns true.
+        * css/CSSValue.h:
+        (WebCore::CSSValue::isTransitionTimingFunctionValue): Added. Returns
+        false.
+
 2007-12-13  Steve Falkenburg  <sfalken@apple.com>
 
         Move source file generation into its own vcproj to fix build dependencies.
index 3e77151f28fb77cffbdd855272a2585ac14d9650..3533b41f365d7e164b6ede5969aec5c431321b7b 100644 (file)
@@ -131,15 +131,9 @@ if (isInitial) { \
 
 #define HANDLE_MULTILAYER_VALUE(layerType, LayerType, prop, Prop, value) { \
 HANDLE_MULTILAYER_INHERIT_AND_INITIAL(layerType, LayerType, prop, Prop) \
-if (!value->isPrimitiveValue() && !value->isValueList()) \
-    return; \
 LayerType* currChild = style->access##LayerType##s(); \
 LayerType* prevChild = 0; \
-if (value->isPrimitiveValue()) { \
-    map##Prop(currChild, value); \
-    currChild = currChild->next(); \
-} \
-else { \
+if (value->isValueList()) { \
     /* Walk each value and put it into a layer, creating new layers as needed. */ \
     CSSValueList* valueList = static_cast<CSSValueList*>(value); \
     for (unsigned int i = 0; i < valueList->length(); i++) { \
@@ -152,6 +146,9 @@ else { \
         prevChild = currChild; \
         currChild = currChild->next(); \
     } \
+} else { \
+    map##Prop(currChild, value); \
+    currChild = currChild->next(); \
 } \
 while (currChild) { \
     /* Reset all remaining layers to not have the property set. */ \
@@ -4219,6 +4216,7 @@ void CSSStyleSelector::mapBackgroundAttachment(BackgroundLayer* layer, CSSValue*
 
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     switch (primitiveValue->getIdent()) {
         case CSS_VAL_FIXED:
@@ -4241,6 +4239,7 @@ void CSSStyleSelector::mapBackgroundClip(BackgroundLayer* layer, CSSValue* value
 
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     layer->setBackgroundClip(*primitiveValue);
 }
@@ -4254,6 +4253,7 @@ void CSSStyleSelector::mapBackgroundComposite(BackgroundLayer* layer, CSSValue*
     
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     layer->setBackgroundComposite(*primitiveValue);
 }
@@ -4267,6 +4267,7 @@ void CSSStyleSelector::mapBackgroundOrigin(BackgroundLayer* layer, CSSValue* val
 
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     layer->setBackgroundOrigin(*primitiveValue);
 }
@@ -4278,7 +4279,9 @@ void CSSStyleSelector::mapBackgroundImage(BackgroundLayer* layer, CSSValue* valu
         return;
     }
     
-    if (!value->isPrimitiveValue()) return;
+    if (!value->isPrimitiveValue())
+        return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     layer->setBackgroundImage(static_cast<CSSImageValue*>(primitiveValue)->image(element->document()->docLoader()));
 }
@@ -4292,6 +4295,7 @@ void CSSStyleSelector::mapBackgroundRepeat(BackgroundLayer* layer, CSSValue* val
     
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     layer->setBackgroundRepeat(*primitiveValue);
 }
@@ -4355,6 +4359,7 @@ void CSSStyleSelector::mapBackgroundXPosition(BackgroundLayer* layer, CSSValue*
     
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     Length l;
     int type = primitiveValue->primitiveType();
@@ -4376,6 +4381,7 @@ void CSSStyleSelector::mapBackgroundYPosition(BackgroundLayer* layer, CSSValue*
     
     if (!value->isPrimitiveValue())
         return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     Length l;
     int type = primitiveValue->primitiveType();
@@ -4395,6 +4401,9 @@ void CSSStyleSelector::mapTransitionDuration(Transition* transition, CSSValue* v
         return;
     }
 
+    if (!value->isPrimitiveValue())
+        return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_S)
         transition->setTransitionDuration(int(1000*primitiveValue->getFloatValue()));
@@ -4409,6 +4418,9 @@ void CSSStyleSelector::mapTransitionRepeatCount(Transition* transition, CSSValue
         return;
     }
 
+    if (!value->isPrimitiveValue())
+        return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     if (primitiveValue->getIdent() == CSS_VAL_INFINITE)
         transition->setTransitionRepeatCount(-1);
@@ -4444,9 +4456,11 @@ void CSSStyleSelector::mapTransitionTimingFunction(Transition* transition, CSSVa
         }
         return;
     }
-    
-    CSSTimingFunctionValue* timingFunction = static_cast<CSSTimingFunctionValue*>(value);
-    transition->setTransitionTimingFunction(TimingFunction(CubicBezierTimingFunction, timingFunction->x1(), timingFunction->y1(), timingFunction->x2(), timingFunction->y2()));
+
+    if (value->isTransitionTimingFunctionValue()) {
+        CSSTimingFunctionValue* timingFunction = static_cast<CSSTimingFunctionValue*>(value);
+        transition->setTransitionTimingFunction(TimingFunction(CubicBezierTimingFunction, timingFunction->x1(), timingFunction->y1(), timingFunction->x2(), timingFunction->y2()));
+    }
 }
 
 void CSSStyleSelector::mapTransitionProperty(Transition* transition, CSSValue* value)
@@ -4456,6 +4470,9 @@ void CSSStyleSelector::mapTransitionProperty(Transition* transition, CSSValue* v
         return;
     }
 
+    if (!value->isPrimitiveValue())
+        return;
+
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     transition->setTransitionProperty(primitiveValue->getIdent());
 }
index a5cf72906860ccfa2384864d69530c6b6931afff..e576d3696bc99b3c12634d585c255aac16296357 100644 (file)
@@ -32,8 +32,16 @@ namespace WebCore {
 
 String CSSTimingFunctionValue::cssText() const
 {
-    // FIXME: Implement.
-    return "";
+    String text("cubic-bezier(");
+    text += String::number(m_x1);
+    text += ", ";
+    text += String::number(m_y1);
+    text += ", ";
+    text += String::number(m_x2);
+    text += ", ";
+    text += String::number(m_y2);
+    text += ")";
+    return text;
 }
 
 } // namespace WebCore
index 69769d4d4eeaf85024680c01e33bb7b2b9bbe9bf..5d808beffc9466a5e7af205915e819d20799e63f 100644 (file)
@@ -42,6 +42,8 @@ public:
     }
 
     virtual String cssText() const;
+
+    virtual bool isTransitionTimingFunctionValue() { return true; }
     
     double x1() const { return m_x1; }
     double y1() const { return m_y1; }
index c368a8923f2607f174c398b6f9f9c7117dba2d18..b24f6056330057b6a424477e30585ca70af193b4 100644 (file)
@@ -47,6 +47,7 @@ public:
     virtual bool isValue() { return true; }
     virtual bool isFontValue() { return false; }
     virtual bool isImplicitInitialValue() const { return false; }
+    virtual bool isTransitionTimingFunctionValue() { return false; }
 };
 
 } // namespace WebCore
index 2318a99fbb4aaf237a34ef8eb3dd6a73e574aaad..913fd970f949bdf4b32812766406eb26620650ea 100644 (file)
@@ -38,7 +38,7 @@
         * WebView.cpp:
         (WebView::keyDown):
         (WebView::keyPress):
-        Moved space handliing to keyPress() to fix this bug and to match IE. Scrolling via arrow keys is correctly handled
+        Moved space handling to keyPress() to fix this bug and to match IE. Scrolling via arrow keys is correctly handled
         in keyDown().
 
 2007-12-12  Brady Eidson  <beidson@apple.com>