Title: [93497] branches/chromium/835

Diff

Copied: branches/chromium/835/LayoutTests/svg/dom/resources/stylesheet-candidate-node-crash.svg (from rev 93227, trunk/LayoutTests/svg/dom/resources/stylesheet-candidate-node-crash.svg) (0 => 93497)


--- branches/chromium/835/LayoutTests/svg/dom/resources/stylesheet-candidate-node-crash.svg	                        (rev 0)
+++ branches/chromium/835/LayoutTests/svg/dom/resources/stylesheet-candidate-node-crash.svg	2011-08-22 08:56:12 UTC (rev 93497)
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="test">
+<text id="test1">PASS</text>
+</g>
+<use id="test2" xlink:href=""
+<use xlink:href=""
+<set attributeName="font-style" to="italic"/>
+</svg>

Copied: branches/chromium/835/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main-expected.txt (from rev 93227, trunk/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main-expected.txt) (0 => 93497)


--- branches/chromium/835/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main-expected.txt	                        (rev 0)
+++ branches/chromium/835/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main-expected.txt	2011-08-22 08:56:12 UTC (rev 93497)
@@ -0,0 +1 @@
+Test passes if it does not crash. 

Copied: branches/chromium/835/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main.html (from rev 93227, trunk/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main.html) (0 => 93497)


--- branches/chromium/835/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main.html	                        (rev 0)
+++ branches/chromium/835/LayoutTests/svg/dom/stylesheet-candidate-node-crash-main.html	2011-08-22 08:56:12 UTC (rev 93497)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+Test passes if it does not crash.
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function runTest() {
+    svgdoc = document.getElementById('root').contentDocument;
+    var style = document.createElement('style');
+    var test1 = svgdoc.getElementById('test1');
+    test1.appendChild(style);
+    svgdoc.getElementById('test2').setAttribute('xlink:href', 0);
+    svgdoc.getElementById('test').setAttribute('stroke', 0);
+}
+</script>
+<object data="" id="root" _onload_="runTest();" type="image/svg+xml"></object>
+</html>
+

Modified: branches/chromium/835/Source/WebCore/dom/ProcessingInstruction.cpp (93496 => 93497)


--- branches/chromium/835/Source/WebCore/dom/ProcessingInstruction.cpp	2011-08-22 08:49:53 UTC (rev 93496)
+++ branches/chromium/835/Source/WebCore/dom/ProcessingInstruction.cpp	2011-08-22 08:56:12 UTC (rev 93497)
@@ -62,6 +62,9 @@
 
     if (m_cachedSheet)
         m_cachedSheet->removeClient(this);
+
+    if (inDocument())
+        document()->removeStyleSheetCandidateNode(this);
 }
 
 void ProcessingInstruction::setData(const String& data, ExceptionCode&)

Modified: branches/chromium/835/Source/WebCore/dom/StyleElement.cpp (93496 => 93497)


--- branches/chromium/835/Source/WebCore/dom/StyleElement.cpp	2011-08-22 08:49:53 UTC (rev 93496)
+++ branches/chromium/835/Source/WebCore/dom/StyleElement.cpp	2011-08-22 08:56:12 UTC (rev 93497)
@@ -84,6 +84,15 @@
         document->styleSelectorChanged(DeferRecalcStyle);
 }
 
+void StyleElement::clearDocumentData(Document* document, Element* element)
+{
+    if (m_sheet)
+        m_sheet->clearOwnerNode();
+
+    if (element->inDocument())
+        document->removeStyleSheetCandidateNode(element);
+}
+
 void StyleElement::childrenChanged(Element* element)
 {
     ASSERT(element);

Modified: branches/chromium/835/Source/WebCore/dom/StyleElement.h (93496 => 93497)


--- branches/chromium/835/Source/WebCore/dom/StyleElement.h	2011-08-22 08:49:53 UTC (rev 93496)
+++ branches/chromium/835/Source/WebCore/dom/StyleElement.h	2011-08-22 08:56:12 UTC (rev 93497)
@@ -45,6 +45,7 @@
 
     void insertedIntoDocument(Document*, Element*);
     void removedFromDocument(Document*, Element*);
+    void clearDocumentData(Document*, Element*);
     void childrenChanged(Element*);
     void finishParsingChildren(Element*);
 

Modified: branches/chromium/835/Source/WebCore/html/HTMLLinkElement.cpp (93496 => 93497)


--- branches/chromium/835/Source/WebCore/html/HTMLLinkElement.cpp	2011-08-22 08:49:53 UTC (rev 93496)
+++ branches/chromium/835/Source/WebCore/html/HTMLLinkElement.cpp	2011-08-22 08:56:12 UTC (rev 93497)
@@ -76,6 +76,9 @@
         m_cachedSheet->removeClient(this);
         removePendingSheet();
     }
+
+    if (inDocument())
+        document()->removeStyleSheetCandidateNode(this);
 }
 
 void HTMLLinkElement::setDisabled(bool disabled)

Modified: branches/chromium/835/Source/WebCore/html/HTMLStyleElement.cpp (93496 => 93497)


--- branches/chromium/835/Source/WebCore/html/HTMLStyleElement.cpp	2011-08-22 08:49:53 UTC (rev 93496)
+++ branches/chromium/835/Source/WebCore/html/HTMLStyleElement.cpp	2011-08-22 08:56:12 UTC (rev 93497)
@@ -44,8 +44,7 @@
 
 HTMLStyleElement::~HTMLStyleElement()
 {
-    if (m_sheet)
-        m_sheet->clearOwnerNode();
+    StyleElement::clearDocumentData(document(), this);
 }
 
 PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)

Modified: branches/chromium/835/Source/WebCore/svg/SVGStyleElement.cpp (93496 => 93497)


--- branches/chromium/835/Source/WebCore/svg/SVGStyleElement.cpp	2011-08-22 08:49:53 UTC (rev 93496)
+++ branches/chromium/835/Source/WebCore/svg/SVGStyleElement.cpp	2011-08-22 08:56:12 UTC (rev 93497)
@@ -43,8 +43,7 @@
 
 SVGStyleElement::~SVGStyleElement()
 {
-    if (m_sheet)
-        m_sheet->clearOwnerNode();
+    StyleElement::clearDocumentData(document(), this);
 }
 
 PassRefPtr<SVGStyleElement> SVGStyleElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to