2011-11-10 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2011 12:26:32 +0000 (12:26 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2011 12:26:32 +0000 (12:26 +0000)
        Deploy SVGLengthContext in more places
        https://bugs.webkit.org/show_bug.cgi?id=72012

        Reviewed by Simon Hausmann.

        Doesn't affect any tests.

        * svg/SVGAnimatedLength.cpp:
        (WebCore::SVGAnimatedLengthAnimator::calculateFromAndByValues):
        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
        (WebCore::SVGAnimatedLengthAnimator::calculateDistance):
        * svg/SVGAnimatedLengthList.cpp:
        (WebCore::SVGAnimatedLengthListAnimator::calculateFromAndByValues):
        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):

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

Source/WebCore/ChangeLog
Source/WebCore/svg/SVGAnimatedLength.cpp
Source/WebCore/svg/SVGAnimatedLengthList.cpp

index f12b8ca..c6512c2 100644 (file)
@@ -1,5 +1,22 @@
 2011-11-10  Nikolas Zimmermann  <nzimmermann@rim.com>
 
+        Deploy SVGLengthContext in more places
+        https://bugs.webkit.org/show_bug.cgi?id=72012
+
+        Reviewed by Simon Hausmann.
+
+        Doesn't affect any tests.
+
+        * svg/SVGAnimatedLength.cpp:
+        (WebCore::SVGAnimatedLengthAnimator::calculateFromAndByValues):
+        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
+        (WebCore::SVGAnimatedLengthAnimator::calculateDistance):
+        * svg/SVGAnimatedLengthList.cpp:
+        (WebCore::SVGAnimatedLengthListAnimator::calculateFromAndByValues):
+        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
+
+2011-11-10  Nikolas Zimmermann  <nzimmermann@rim.com>
+
         Not reviewed. Fix build.
 
         * WebCore.gypi: Need to add rendering/svg/SVGPathData.* in another place as well, cr-bots are not compiling it and thus fail linking.
index b64022f..192e117 100644 (file)
@@ -68,10 +68,11 @@ void SVGAnimatedLengthAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>
     from = constructFromString(fromString);
     to = constructFromString(byString);
     
+    SVGLengthContext lengthContext(m_contextElement);
     SVGLength& fromLength = from->length();
     SVGLength& toLength = to->length();
     ExceptionCode ec = 0;
-    toLength.setValue(toLength.value(m_contextElement) + fromLength.value(m_contextElement), m_contextElement, ec);
+    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext, ec);
     ASSERT(!ec);
 }
 
@@ -103,12 +104,13 @@ void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigne
         toSVGLength = sharedSVGLength(m_lengthMode, toLengthString); 
     }
     
-    float result = animatedSVGLength.value(m_contextElement);
+    SVGLengthContext lengthContext(m_contextElement);
+    float result = animatedSVGLength.value(lengthContext);
     SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVGLength.unitType();
-    SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, fromSVGLength.value(m_contextElement), toSVGLength.value(m_contextElement));
+    SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, fromSVGLength.value(lengthContext), toSVGLength.value(lengthContext));
 
     ExceptionCode ec = 0;
-    animatedSVGLength.setValue(m_contextElement, result, m_lengthMode, unitType, ec);
+    animatedSVGLength.setValue(lengthContext, result, m_lengthMode, unitType, ec);
     ASSERT(!ec);
 }
 
@@ -120,7 +122,8 @@ float SVGAnimatedLengthAnimator::calculateDistance(const String& fromString, con
     SVGLengthMode lengthMode = SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName());
     SVGLength from = SVGLength(lengthMode, fromString);
     SVGLength to = SVGLength(lengthMode, toString);
-    return fabsf(to.value(m_contextElement) - from.value(m_contextElement));
+    SVGLengthContext lengthContext(m_contextElement);
+    return fabsf(to.value(lengthContext) - from.value(lengthContext));
 }
 
 }
index 88c20ba..153e4f1 100644 (file)
@@ -66,9 +66,10 @@ void SVGAnimatedLengthListAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedT
     unsigned itemsCount = fromLengthList.size();
     if (itemsCount != toLengthList.size())
         return;
+    SVGLengthContext lengthContext(m_contextElement);
     ExceptionCode ec = 0;
     for (unsigned i = 0; i < itemsCount; ++i) {
-        toLengthList[i].setValue(toLengthList[i].value(m_contextElement) + fromLengthList[i].value(m_contextElement), m_contextElement, ec);
+        toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext, ec);
         ASSERT(!ec);
     }
 }
@@ -114,15 +115,16 @@ void SVGAnimatedLengthListAnimator::calculateAnimatedValue(float percentage, uns
     bool animatedListSizeEqual = itemsCount == animatedLengthList.size();
     if (!animatedListSizeEqual)
         animatedLengthList.clear();
+    SVGLengthContext lengthContext(m_contextElement);
     ExceptionCode ec = 0;
     for (unsigned i = 0; i < itemsCount; ++i) {
-        float result = animatedListSizeEqual ? animatedLengthList[i].value(m_contextElement) : 0;
+        float result = animatedListSizeEqual ? animatedLengthList[i].value(lengthContext) : 0;
         SVGLengthType unitType = percentage < 0.5 ? fromLengthList[i].unitType() : toLengthList[i].unitType();
-        SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, fromLengthList[i].value(m_contextElement), toLengthList[i].value(m_contextElement));
+        SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, fromLengthList[i].value(lengthContext), toLengthList[i].value(lengthContext));
         if (!animatedListSizeEqual)
-            animatedLengthList.append(SVGLength(m_contextElement, result, m_lengthMode, unitType));
+            animatedLengthList.append(SVGLength(lengthContext, result, m_lengthMode, unitType));
         else {
-            animatedLengthList[i].setValue(m_contextElement, result, m_lengthMode, unitType, ec);
+            animatedLengthList[i].setValue(lengthContext, result, m_lengthMode, unitType, ec);
             ASSERT(!ec);
         }
     }