[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

zimmermann at webkit.org zimmermann at webkit.org
Thu Apr 8 00:58:02 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit be274bd64fc03c2604145cd6105a0fd55218ee23
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 8 00:36:10 2010 +0000

    2010-01-07  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            SVGTextElement & friends need to implement svgAttributeChanged
            https://bugs.webkit.org/show_bug.cgi?id=33284
    
            Implement svgAttributeChanged() for SVGTextElement & SVGTRefElement. As <text> element contain children,
            childrenChanged() has to be implemented as well for SVGTextElement.
    
            Simplify SVGTransformable::parseTransformAttribute() code, clearing lists in the beginning
            and on error case, after parsing - previously the calling site had to take care of that.
    
            Tests: svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
                   svg/dynamic-updates/SVGTextElement-dom-transform-attr.html
                   svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html
    
            * svg/SVGGradientElement.cpp:
            (WebCore::SVGGradientElement::parseMappedAttribute):
            * svg/SVGPatternElement.cpp:
            (WebCore::SVGPatternElement::parseMappedAttribute):
            * svg/SVGStyledTransformableElement.cpp:
            (WebCore::SVGStyledTransformableElement::parseMappedAttribute):
            * svg/SVGTRefElement.cpp:
            (WebCore::SVGTRefElement::svgAttributeChanged):
            * svg/SVGTRefElement.h:
            * svg/SVGTextElement.cpp:
            (WebCore::SVGTextElement::parseMappedAttribute):
            (WebCore::SVGTextElement::svgAttributeChanged):
            (WebCore::SVGTextElement::childrenChanged):
            * svg/SVGTextElement.h:
            * svg/SVGTextPositioningElement.cpp:
            (WebCore::SVGTextPositioningElement::svgAttributeChanged):
            * svg/SVGTextPositioningElement.h:
            * svg/SVGTransformable.cpp:
            (WebCore::SVGTransformable::parseTransformAttribute):
            * svg/SVGTransformable.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52960 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e138cc0..d9b9928 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-07  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        SVGTextElement & friends need to implement svgAttributeChanged
+        https://bugs.webkit.org/show_bug.cgi?id=33284
+
+        * svg/dynamic-updates/SVGTRefElement-dom-href-attr-expected.txt: Added.
+        * svg/dynamic-updates/SVGTRefElement-dom-href-attr.html: Added.
+        * svg/dynamic-updates/SVGTextElement-dom-transform-attr-expected.txt: Added.
+        * svg/dynamic-updates/SVGTextElement-dom-transform-attr.html: Added.
+        * svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.txt: Added.
+        * svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html: Added.
+        * svg/dynamic-updates/script-tests/SVGTRefElement-dom-href-attr.js: Added.
+        (executeTest):
+        * svg/dynamic-updates/script-tests/SVGTextElement-dom-transform-attr.js: Added.
+        (executeTest):
+        * svg/dynamic-updates/script-tests/SVGTextElement-svgdom-transform-prop.js: Added.
+        (executeTest):
+
 2010-01-07  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Geoffrey Garen.
diff --git a/LayoutTests/svg/dynamic-updates/SVGTRefElement-dom-href-attr-expected.txt b/LayoutTests/svg/dynamic-updates/SVGTRefElement-dom-href-attr-expected.txt
new file mode 100644
index 0000000..1b2071a
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/SVGTRefElement-dom-href-attr-expected.txt
@@ -0,0 +1,18 @@
+SVG 1.1 dynamic update tests
+
+Test failed
+Test passed
+Test passed
+Tests dynamic updates of the 'href' attribute of the SVGTRefElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS trefElement.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "testFail"
+PASS textElement.textContent is "Test failed"
+PASS trefElement.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "testPass"
+PASS textElement.textContent is "Test passed"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGTRefElement-dom-href-attr.html b/LayoutTests/svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
new file mode 100644
index 0000000..ca2d2ce
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGTRefElement-dom-href-attr.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/SVGTextElement-dom-transform-attr-expected.txt b/LayoutTests/svg/dynamic-updates/SVGTextElement-dom-transform-attr-expected.txt
new file mode 100644
index 0000000..428af6c
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/SVGTextElement-dom-transform-attr-expected.txt
@@ -0,0 +1,14 @@
+SVG 1.1 dynamic update tests
+
+Test passed
+Tests dynamic updates of the 'transform' attribute of the SVGTextElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textElement.getAttribute('transform') is null
+PASS textElement.getAttribute('transform') is "translate(0,-200)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGTextElement-dom-transform-attr.html b/LayoutTests/svg/dynamic-updates/SVGTextElement-dom-transform-attr.html
new file mode 100644
index 0000000..d402aca
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/SVGTextElement-dom-transform-attr.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGTextElement-dom-transform-attr.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.txt b/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.txt
new file mode 100644
index 0000000..605bcdb
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.txt
@@ -0,0 +1,14 @@
+SVG 1.1 dynamic update tests
+
+Text content
+Tests dynamic updates of the 'transform' property of the SVGTextElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textElement.transform.baseVal.getItem(0).matrix.f is 0.0
+PASS textElement.transform.baseVal.getItem(0).matrix.f is -200.0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html b/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html
new file mode 100644
index 0000000..7e235be
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGTextElement-svgdom-transform-prop.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGTRefElement-dom-href-attr.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGTRefElement-dom-href-attr.js
new file mode 100644
index 0000000..de41df1
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/script-tests/SVGTRefElement-dom-href-attr.js
@@ -0,0 +1,41 @@
+// [Name] SVGTRefElement-dom-href-attr.js
+// [Expected rendering result] 'Test passed' message - and a series of PASS messages
+
+description("Tests dynamic updates of the 'href' attribute of the SVGTRefElement object")
+createSVGTestCase();
+
+var defsElement = createSVGElement("defs");
+rootSVGElement.appendChild(defsElement);
+
+var textElement1 = createSVGElement("text");
+textElement1.setAttribute("id", "testFail");
+textElement1.textContent = "Test failed";
+defsElement.appendChild(textElement1);
+
+var textElement2 = createSVGElement("text");
+textElement2.setAttribute("id", "testPass");
+textElement2.textContent = "Test passed";
+defsElement.appendChild(textElement2);
+ 
+var textElement = createSVGElement("text");
+textElement.setAttribute("y", "15");
+rootSVGElement.appendChild(textElement);
+
+var trefElement = createSVGElement("tref");
+trefElement.setAttributeNS(xlinkNS, "xlink:href", "testFail");
+textElement.appendChild(trefElement);    
+
+shouldBeEqualToString("trefElement.getAttributeNS('" + xlinkNS + "', 'href')", "testFail");
+shouldBeEqualToString("textElement.textContent", "Test failed");
+
+function executeTest() {
+    trefElement.setAttributeNS(xlinkNS, "xlink:href", "testPass");
+    shouldBeEqualToString("trefElement.getAttributeNS('" + xlinkNS + "', 'href')", "testPass");
+    shouldBeEqualToString("textElement.textContent", "Test passed");
+
+    completeTest();
+}
+
+startTest(textElement, 10, 10);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-dom-transform-attr.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-dom-transform-attr.js
new file mode 100644
index 0000000..b407f97
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-dom-transform-attr.js
@@ -0,0 +1,24 @@
+// [Name] SVGTextElement-dom-transform-attr.js
+// [Expected rendering result] 'Test passed' message - and a series of PASS messages
+
+description("Tests dynamic updates of the 'transform' attribute of the SVGTextElement object")
+createSVGTestCase();
+
+var textElement = createSVGElement("text");
+textElement.setAttribute("x", "0");
+textElement.setAttribute("y", "215");
+textElement.textContent = "Test passed";
+
+rootSVGElement.appendChild(textElement);
+shouldBeNull("textElement.getAttribute('transform')", "");
+
+function executeTest() {
+    textElement.setAttribute("transform", "translate(0,-200)");
+    shouldBeEqualToString("textElement.getAttribute('transform')", "translate(0,-200)");
+
+    completeTest();
+}
+
+startTest(textElement, 10, 210);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-svgdom-transform-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-svgdom-transform-prop.js
new file mode 100644
index 0000000..ea79334
--- /dev/null
+++ b/LayoutTests/svg/dynamic-updates/script-tests/SVGTextElement-svgdom-transform-prop.js
@@ -0,0 +1,24 @@
+// [Name] SVGTextElement-svgdom-transform-prop.js
+// [Expected rendering result] 'Test passed' message - and a series of PASS messages
+description("Tests dynamic updates of the 'transform' property of the SVGTextElement object")
+createSVGTestCase();
+
+var textElement = createSVGElement("text");
+textElement.setAttribute("x", "0");
+textElement.setAttribute("y", "215");
+textElement.setAttribute("transform", "translate(0,0)");
+textElement.textContent = "Text content";
+rootSVGElement.appendChild(textElement);
+
+shouldBe("textElement.transform.baseVal.getItem(0).matrix.f", "0.0");
+
+function executeTest() {
+    textElement.transform.baseVal.getItem(0).matrix.f = -200;
+    shouldBe("textElement.transform.baseVal.getItem(0).matrix.f", "-200.0");
+
+    completeTest();
+}
+
+startTest(textElement, 10, 210);
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 35e563a..c14267f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-01-07  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        SVGTextElement & friends need to implement svgAttributeChanged
+        https://bugs.webkit.org/show_bug.cgi?id=33284
+
+        Implement svgAttributeChanged() for SVGTextElement & SVGTRefElement. As <text> element contain children,
+        childrenChanged() has to be implemented as well for SVGTextElement.
+
+        Simplify SVGTransformable::parseTransformAttribute() code, clearing lists in the beginning
+        and on error case, after parsing - previously the calling site had to take care of that.
+
+        Tests: svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
+               svg/dynamic-updates/SVGTextElement-dom-transform-attr.html
+               svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html
+
+        * svg/SVGGradientElement.cpp:
+        (WebCore::SVGGradientElement::parseMappedAttribute):
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::parseMappedAttribute):
+        * svg/SVGStyledTransformableElement.cpp:
+        (WebCore::SVGStyledTransformableElement::parseMappedAttribute):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::svgAttributeChanged):
+        * svg/SVGTRefElement.h:
+        * svg/SVGTextElement.cpp:
+        (WebCore::SVGTextElement::parseMappedAttribute):
+        (WebCore::SVGTextElement::svgAttributeChanged):
+        (WebCore::SVGTextElement::childrenChanged):
+        * svg/SVGTextElement.h:
+        * svg/SVGTextPositioningElement.cpp:
+        (WebCore::SVGTextPositioningElement::svgAttributeChanged):
+        * svg/SVGTextPositioningElement.h:
+        * svg/SVGTransformable.cpp:
+        (WebCore::SVGTransformable::parseTransformAttribute):
+        * svg/SVGTransformable.h:
+
 2010-01-07  Brian Weinstein  <bweinstein at apple.com>
 
         Reviewed by Adele Peterson.
diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp
index 4e97c83..f952c46 100644
--- a/WebCore/svg/SVGStyledTransformableElement.cpp
+++ b/WebCore/svg/SVGStyledTransformableElement.cpp
@@ -70,17 +70,13 @@ TransformationMatrix* SVGStyledTransformableElement::supplementalTransform()
 
 void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute* attr)
 {
-    if (attr->name() == SVGNames::transformAttr) {
+    if (SVGTransformable::isKnownAttribute(attr->name())) {
         SVGTransformList* localTransforms = transformBaseValue();
-
-        ExceptionCode ec = 0;
-        localTransforms->clear(ec);
- 
-        if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value()))
+        if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value())) {
+            ExceptionCode ec = 0;
             localTransforms->clear(ec);
-        else
-            setTransformBaseValue(localTransforms);
-    } else
+        }
+    } else 
         SVGStyledLocatableElement::parseMappedAttribute(attr);
 }
 
diff --git a/WebCore/svg/SVGTRefElement.cpp b/WebCore/svg/SVGTRefElement.cpp
index 1f32e90..2d151c0 100644
--- a/WebCore/svg/SVGTRefElement.cpp
+++ b/WebCore/svg/SVGTRefElement.cpp
@@ -61,6 +61,17 @@ void SVGTRefElement::parseMappedAttribute(MappedAttribute* attr)
     SVGTextPositioningElement::parseMappedAttribute(attr);
 }
 
+void SVGTRefElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+    SVGTextPositioningElement::svgAttributeChanged(attrName);
+
+    if (!renderer())
+        return;
+
+    if (SVGURIReference::isKnownAttribute(attrName))
+        renderer()->setNeedsLayout(true);
+}
+
 bool SVGTRefElement::childShouldCreateRenderer(Node* child) const
 {
     if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag) ||
diff --git a/WebCore/svg/SVGTRefElement.h b/WebCore/svg/SVGTRefElement.h
index 71d40a0..3e2243d 100644
--- a/WebCore/svg/SVGTRefElement.h
+++ b/WebCore/svg/SVGTRefElement.h
@@ -34,6 +34,7 @@ namespace WebCore {
         virtual ~SVGTRefElement();
 
         virtual void parseMappedAttribute(MappedAttribute*);
+        virtual void svgAttributeChanged(const QualifiedName&);
 
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
         bool childShouldCreateRenderer(Node*) const;
diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp
index c1481cf..b198f04 100644
--- a/WebCore/svg/SVGTextElement.cpp
+++ b/WebCore/svg/SVGTextElement.cpp
@@ -47,18 +47,11 @@ SVGTextElement::~SVGTextElement()
 
 void SVGTextElement::parseMappedAttribute(MappedAttribute* attr)
 {
-    if (attr->name() == SVGNames::transformAttr) {
+    if (SVGTransformable::isKnownAttribute(attr->name())) {
         SVGTransformList* localTransforms = transformBaseValue();
-
-        ExceptionCode ec = 0;
-        localTransforms->clear(ec);
-
-        if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value()))
+        if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value())) {
+            ExceptionCode ec = 0;
             localTransforms->clear(ec);
-        else {
-            setTransformBaseValue(localTransforms);
-            if (renderer())
-                renderer()->setNeedsLayout(true); // should be in setTransformBaseValue
         }
     } else
         SVGTextPositioningElement::parseMappedAttribute(attr);
@@ -124,10 +117,20 @@ void SVGTextElement::svgAttributeChanged(const QualifiedName& attrName)
     if (!renderer())
         return;
 
-    if (SVGTextPositioningElement::isKnownAttribute(attrName))
+    if (SVGTransformable::isKnownAttribute(attrName))
         renderer()->setNeedsLayout(true);
 }
 
+void SVGTextElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+    SVGTextPositioningElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+
+    if (!renderer())
+        return;
+
+    renderer()->setNeedsLayout(true);
+}
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h
index 400aa47..305e310 100644
--- a/WebCore/svg/SVGTextElement.h
+++ b/WebCore/svg/SVGTextElement.h
@@ -48,6 +48,7 @@ namespace WebCore {
         virtual bool childShouldCreateRenderer(Node*) const;
                 
         virtual void svgAttributeChanged(const QualifiedName&);
+        virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGTextElement, SVGNames::textTagString, SVGNames::transformAttrString, SVGTransformList, Transform, transform)
diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp
index fd7c8aa..71c62ee 100644
--- a/WebCore/svg/SVGTextPositioningElement.cpp
+++ b/WebCore/svg/SVGTextPositioningElement.cpp
@@ -24,6 +24,7 @@
 #include "SVGTextPositioningElement.h"
 
 #include "MappedAttribute.h"
+#include "RenderObject.h"
 #include "SVGLengthList.h"
 #include "SVGNames.h"
 #include "SVGNumberList.h"
@@ -62,6 +63,17 @@ void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
         SVGTextContentElement::parseMappedAttribute(attr);
 }
 
+void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+    SVGTextContentElement::svgAttributeChanged(attrName);
+
+    if (!renderer())
+        return;
+
+    if (isKnownAttribute(attrName))
+        renderer()->setNeedsLayout(true);
+}
+
 bool SVGTextPositioningElement::isKnownAttribute(const QualifiedName& attrName)
 {
     return (attrName.matches(SVGNames::xAttr) ||
diff --git a/WebCore/svg/SVGTextPositioningElement.h b/WebCore/svg/SVGTextPositioningElement.h
index 2b07d09..6da1a74 100644
--- a/WebCore/svg/SVGTextPositioningElement.h
+++ b/WebCore/svg/SVGTextPositioningElement.h
@@ -36,6 +36,7 @@ namespace WebCore {
         virtual ~SVGTextPositioningElement();
 
         virtual void parseMappedAttribute(MappedAttribute*);
+        virtual void svgAttributeChanged(const QualifiedName&);
 
         bool isKnownAttribute(const QualifiedName&);
 
diff --git a/WebCore/svg/SVGTransformable.cpp b/WebCore/svg/SVGTransformable.cpp
index 17344ea..78afbc8 100644
--- a/WebCore/svg/SVGTransformable.cpp
+++ b/WebCore/svg/SVGTransformable.cpp
@@ -190,18 +190,23 @@ static inline bool parseAndSkipType(const UChar*& currTransform, const UChar* en
 bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const AtomicString& transform)
 {
     const UChar* start = transform.characters();
-    const UChar* end = start + transform.length();
-    return parseTransformAttribute(list, start, end);
+    return parseTransformAttribute(list, start, start + transform.length());
 }
 
-bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const UChar*& currTransform, const UChar* end)
+bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const UChar*& currTransform, const UChar* end, TransformParsingMode mode)
 {
+    ExceptionCode ec = 0;
+    if (mode == ClearList) {
+        list->clear(ec);
+        ASSERT(!ec);
+    }
+
     bool delimParsed = false;
     while (currTransform < end) {
         delimParsed = false;
         unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
         skipOptionalSpaces(currTransform, end);
-        
+
         if (!parseAndSkipType(currTransform, end, type))
             return false;
 
@@ -209,12 +214,11 @@ bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const UCh
         if (!parseTransformValue(type, currTransform, end, t))
             return false;
 
-        ExceptionCode ec = 0;
         list->appendItem(t, ec);
         skipOptionalSpaces(currTransform, end);
         if (currTransform < end && *currTransform == ',') {
             delimParsed = true;
-            currTransform++;
+            ++currTransform;
         }
         skipOptionalSpaces(currTransform, end);
     }
diff --git a/WebCore/svg/SVGTransformable.h b/WebCore/svg/SVGTransformable.h
index 1e87b78..a74eff7 100644
--- a/WebCore/svg/SVGTransformable.h
+++ b/WebCore/svg/SVGTransformable.h
@@ -38,8 +38,13 @@ namespace WebCore {
         SVGTransformable();
         virtual ~SVGTransformable();
 
+        enum TransformParsingMode {
+            ClearList,
+            DoNotClearList
+        };
+
         static bool parseTransformAttribute(SVGTransformList*, const AtomicString& transform);
-        static bool parseTransformAttribute(SVGTransformList*, const UChar*& ptr, const UChar* end);
+        static bool parseTransformAttribute(SVGTransformList*, const UChar*& ptr, const UChar* end, TransformParsingMode mode = ClearList);
         static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&);
         
         TransformationMatrix getCTM(const SVGElement*) const;
diff --git a/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp
index 0910a8a..6787e93 100644
--- a/WebCore/svg/SVGViewSpec.cpp
+++ b/WebCore/svg/SVGViewSpec.cpp
@@ -152,7 +152,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
             if (currViewSpec >= end || *currViewSpec != '(')
                 return false;
             currViewSpec++;
-            SVGTransformable::parseTransformAttribute(m_transform.get(), currViewSpec, end);
+            SVGTransformable::parseTransformAttribute(m_transform.get(), currViewSpec, end, SVGTransformable::DoNotClearList);
             if (currViewSpec >= end || *currViewSpec != ')')
                 return false;
             currViewSpec++;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list