[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

jschuh at chromium.org jschuh at chromium.org
Wed Dec 22 18:06:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e256525901f2f2fd0238ce691a1c038f7df1d274
Author: jschuh at chromium.org <jschuh at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 7 10:44:05 2010 +0000

    2010-12-07  Justin Schuh  <jschuh at chromium.org>
    
            Reviewed by Nikolas Zimmermann.
    
            Clear old SVG cursor entry before adding a new one
            https://bugs.webkit.org/show_bug.cgi?id=50549
    
            Test: svg/css/cursor-replace.svg
    
            * css/CSSCursorImageValue.cpp:
            (WebCore::CSSCursorImageValue::~CSSCursorImageValue):
            * svg/SVGCursorElement.cpp:
            (WebCore::SVGCursorElement::~SVGCursorElement):
            (WebCore::SVGCursorElement::removeClient):
            (WebCore::SVGCursorElement::removeReferencedElement):
            * svg/SVGCursorElement.h:
            * svg/SVGElement.cpp:
            (WebCore::SVGElement::setCursorElement):
            (WebCore::SVGElement::cursorElementRemoved):
            (WebCore::SVGElement::setCursorImageValue):
            (WebCore::SVGElement::cursorImageElementRemoved):
            * svg/SVGElement.h:
    2010-12-07  Justin Schuh  <jschuh at chromium.org>
    
            Reviewed by Nikolas Zimmermann.
    
            Clear old SVG cursor entry before adding a new one
            https://bugs.webkit.org/show_bug.cgi?id=50549
    
            * svg/css/cursor-replace-expected.txt: Added.
            * svg/css/cursor-replace.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b953520..5b3986e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-12-07  Justin Schuh  <jschuh at chromium.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Clear old SVG cursor entry before adding a new one
+        https://bugs.webkit.org/show_bug.cgi?id=50549
+
+        * svg/css/cursor-replace-expected.txt: Added.
+        * svg/css/cursor-replace.svg: Added.
+
 2010-12-07  Yuta Kitamura  <yutak at chromium.org>
 
         Unreviewed.
diff --git a/LayoutTests/svg/css/cursor-replace-expected.txt b/LayoutTests/svg/css/cursor-replace-expected.txt
new file mode 100644
index 0000000..18afd83
--- /dev/null
+++ b/LayoutTests/svg/css/cursor-replace-expected.txt
@@ -0,0 +1 @@
+PASS: Successfully changed cursors.
diff --git a/LayoutTests/svg/css/cursor-replace.svg b/LayoutTests/svg/css/cursor-replace.svg
new file mode 100644
index 0000000..26bfeb3
--- /dev/null
+++ b/LayoutTests/svg/css/cursor-replace.svg
@@ -0,0 +1,39 @@
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
+<script>
+function runTest() {
+    g.offsetTop;
+    g.removeChild(g.firstChild);
+    if (g.firstChild)
+        setTimeout(runTest(),0);
+    else
+        location.reload();
+}
+
+window.onload = function() {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+    
+    g = document.getElementById("g1");
+    if (location.hash != "#2") {
+        if (location.hash)
+            location.hash = "#" + (parseInt(location.hash.slice(1)) + 1).toString();
+        else
+            location.hash = "#1";
+        document.getElementById("g2").style.setProperty('cursor', 'url(#c2)');
+        setTimeout(runTest(),0);
+    } else {
+        document.getElementById("t1").appendChild(document.createTextNode("PASS: Successfully changed cursors."));
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+}
+</script>
+<g id="g1">
+    <cursor id="c1"></cursor>
+    <g cursor="url(#c1)" id="g2"></g>
+    <cursor id="c2"></cursor>
+    <text id="t1" x="20" y="20"></text>
+</g>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 97b423b..036fab0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-12-07  Justin Schuh  <jschuh at chromium.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Clear old SVG cursor entry before adding a new one
+        https://bugs.webkit.org/show_bug.cgi?id=50549
+
+        Test: svg/css/cursor-replace.svg
+
+        * css/CSSCursorImageValue.cpp:
+        (WebCore::CSSCursorImageValue::~CSSCursorImageValue):
+        * svg/SVGCursorElement.cpp:
+        (WebCore::SVGCursorElement::~SVGCursorElement):
+        (WebCore::SVGCursorElement::removeClient):
+        (WebCore::SVGCursorElement::removeReferencedElement):
+        * svg/SVGCursorElement.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::setCursorElement):
+        (WebCore::SVGElement::cursorElementRemoved):
+        (WebCore::SVGElement::setCursorImageValue):
+        (WebCore::SVGElement::cursorImageElementRemoved):
+        * svg/SVGElement.h:
+
 2010-12-07  Kenichi Ishibashi  <bashi at google.com>
 
         Reviewed by Kent Tamura.
diff --git a/WebCore/css/CSSCursorImageValue.cpp b/WebCore/css/CSSCursorImageValue.cpp
index 1c3f0bb..e82cf16 100644
--- a/WebCore/css/CSSCursorImageValue.cpp
+++ b/WebCore/css/CSSCursorImageValue.cpp
@@ -71,7 +71,7 @@ CSSCursorImageValue::~CSSCursorImageValue()
 
     for (; it != end; ++it) {
         SVGElement* referencedElement = *it;
-        referencedElement->setCursorImageValue(0);
+        referencedElement->cursorElementRemoved();
         if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, referencedElement->document()))
             cursorElement->removeClient(referencedElement);
     }
diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp
index d0a8388..aa820a5 100644
--- a/WebCore/svg/SVGCursorElement.cpp
+++ b/WebCore/svg/SVGCursorElement.cpp
@@ -51,7 +51,7 @@ SVGCursorElement::~SVGCursorElement()
 {
     HashSet<SVGElement*>::iterator end = m_clients.end();
     for (HashSet<SVGElement*>::iterator it = m_clients.begin(); it != end; ++it)
-        (*it)->setCursorElement(0);
+        (*it)->cursorElementRemoved();
 }
 
 void SVGCursorElement::parseMappedAttribute(Attribute* attr)
@@ -81,7 +81,12 @@ void SVGCursorElement::addClient(SVGElement* element)
 void SVGCursorElement::removeClient(SVGElement* element)
 {
     m_clients.remove(element);
-    element->setCursorElement(0);
+    element->cursorElementRemoved();
+}
+
+void SVGCursorElement::removeReferencedElement(SVGElement* element)
+{
+    m_clients.remove(element);
 }
 
 void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
diff --git a/WebCore/svg/SVGCursorElement.h b/WebCore/svg/SVGCursorElement.h
index 98afa48..6ce7b19 100644
--- a/WebCore/svg/SVGCursorElement.h
+++ b/WebCore/svg/SVGCursorElement.h
@@ -43,6 +43,7 @@ public:
 
     void addClient(SVGElement*);
     void removeClient(SVGElement*);
+    void removeReferencedElement(SVGElement*);
 
 private:
     SVGCursorElement(const QualifiedName&, Document*);
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index 3e9bda0..615aaab 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -196,12 +196,36 @@ bool SVGElement::boundingBox(FloatRect& rect, SVGLocatable::StyleUpdateStrategy
 
 void SVGElement::setCursorElement(SVGCursorElement* cursorElement)
 {
-    ensureRareSVGData()->setCursorElement(cursorElement);
+    SVGElementRareData* rareData = ensureRareSVGData();
+    if (SVGCursorElement* oldCursorElement = rareData->cursorElement()) {
+        if (cursorElement == oldCursorElement)
+            return;
+        oldCursorElement->removeReferencedElement(this);
+    }
+    rareData->setCursorElement(cursorElement);
+}
+
+void SVGElement::cursorElementRemoved() 
+{
+    ASSERT(hasRareSVGData());
+    rareSVGData()->setCursorElement(0);
 }
 
 void SVGElement::setCursorImageValue(CSSCursorImageValue* cursorImageValue)
 {
-    ensureRareSVGData()->setCursorImageValue(cursorImageValue);
+    SVGElementRareData* rareData = ensureRareSVGData();
+    if (CSSCursorImageValue* oldCursorImageValue = rareData->cursorImageValue()) {
+        if (cursorImageValue == oldCursorImageValue)
+            return;
+        oldCursorImageValue->removeReferencedElement(this);
+    }
+    rareData->setCursorImageValue(cursorImageValue);
+}
+
+void SVGElement::cursorImageElementRemoved()
+{
+    ASSERT(hasRareSVGData());
+    rareSVGData()->setCursorImageValue(0);
 }
 
 void SVGElement::parseMappedAttribute(Attribute* attr)
diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h
index 0af041f..3098335 100644
--- a/WebCore/svg/SVGElement.h
+++ b/WebCore/svg/SVGElement.h
@@ -75,7 +75,9 @@ namespace WebCore {
         bool boundingBox(FloatRect&, SVGLocatable::StyleUpdateStrategy = SVGLocatable::AllowStyleUpdate) const;
 
         void setCursorElement(SVGCursorElement*);
+        void cursorElementRemoved();
         void setCursorImageValue(CSSCursorImageValue*);
+        void cursorImageElementRemoved();
 
         virtual void updateAnimatedSVGAttribute(const QualifiedName&) const;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list