Title: [118589] trunk
Revision
118589
Author
[email protected]
Date
2012-05-25 17:18:27 -0700 (Fri, 25 May 2012)

Log Message

Fix for self-closing <use> tags
https://bugs.webkit.org/show_bug.cgi?id=87504

Reviewed by Adam Barth.

Source/WebCore:

This change causes self-closing non-html tags to behave the same
as tags immediately followed by the closing tag.

Test: svg/custom/svg-self-closing-use.html

* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::attachLater):
(WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
(WebCore::HTMLConstructionSite::insertForeignElement):
* html/parser/HTMLConstructionSite.h:
(HTMLConstructionSite):

LayoutTests:

* svg/custom/svg-self-closing-use-expected.html: Added.
* svg/custom/svg-self-closing-use.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118588 => 118589)


--- trunk/LayoutTests/ChangeLog	2012-05-25 23:59:10 UTC (rev 118588)
+++ trunk/LayoutTests/ChangeLog	2012-05-26 00:18:27 UTC (rev 118589)
@@ -1,3 +1,13 @@
+2012-05-25  Philip Rogers  <[email protected]>
+
+        Fix for self-closing <use> tags
+        https://bugs.webkit.org/show_bug.cgi?id=87504
+
+        Reviewed by Adam Barth.
+
+        * svg/custom/svg-self-closing-use-expected.html: Added.
+        * svg/custom/svg-self-closing-use.html: Added.
+
 2012-05-25  Jessie Berlin  <[email protected]>
 
         [Win] ~1/2 of all the iframe seamless tests fail

Added: trunk/LayoutTests/svg/custom/svg-self-closing-use-expected.html (0 => 118589)


--- trunk/LayoutTests/svg/custom/svg-self-closing-use-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-self-closing-use-expected.html	2012-05-26 00:18:27 UTC (rev 118589)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+<!-- Test for WK87504 that <use/> and <use></use> are equivalent -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+  <rect id="rect" width="100" height="100" fill="green"/>
+</defs>
+<use xlink:href=""
+</svg>
+</body>

Added: trunk/LayoutTests/svg/custom/svg-self-closing-use.html (0 => 118589)


--- trunk/LayoutTests/svg/custom/svg-self-closing-use.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-self-closing-use.html	2012-05-26 00:18:27 UTC (rev 118589)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+<!-- Test for WK87504 that <use/> and <use></use> are equivalent -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+  <rect id="rect" width="100" height="100" fill="green"/>
+</defs>
+<use xlink:href=""
+</svg>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (118588 => 118589)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 23:59:10 UTC (rev 118588)
+++ trunk/Source/WebCore/ChangeLog	2012-05-26 00:18:27 UTC (rev 118589)
@@ -1,3 +1,22 @@
+2012-05-25  Philip Rogers  <[email protected]>
+
+        Fix for self-closing <use> tags
+        https://bugs.webkit.org/show_bug.cgi?id=87504
+
+        Reviewed by Adam Barth.
+
+        This change causes self-closing non-html tags to behave the same
+        as tags immediately followed by the closing tag.
+
+        Test: svg/custom/svg-self-closing-use.html
+
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::attachLater):
+        (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
+        (WebCore::HTMLConstructionSite::insertForeignElement):
+        * html/parser/HTMLConstructionSite.h:
+        (HTMLConstructionSite):
+
 2012-05-25  Dan Bernstein  <[email protected]>
 
         Make the ICU-based implementation of NonSharedCharacterBreakIterator work in configurations

Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (118588 => 118589)


--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2012-05-25 23:59:10 UTC (rev 118588)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2012-05-26 00:18:27 UTC (rev 118589)
@@ -106,11 +106,12 @@
         task.child->finishParsingChildren();
 }
 
-void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild)
+void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild, bool selfClosing)
 {
     HTMLConstructionSiteTask task;
     task.parent = parent;
     task.child = prpChild;
+    task.selfClosing = selfClosing;
 
     if (shouldFosterParent()) {
         fosterParent(task.child);
@@ -315,11 +316,10 @@
 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken& token)
 {
     ASSERT(token.type() == HTMLTokenTypes::StartTag);
-    attachLater(currentNode(), createHTMLElement(token));
     // Normally HTMLElementStack is responsible for calling finishParsingChildren,
     // but self-closing elements are never in the element stack so the stack
     // doesn't get a chance to tell them that we're done parsing their children.
-    m_attachmentQueue.last().selfClosing = true;
+    attachLater(currentNode(), createHTMLElement(token), true);
     // FIXME: Do we want to acknowledge the token's self-closing flag?
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag
 }
@@ -355,9 +355,7 @@
     notImplemented(); // parseError when xmlns or xmlns:xlink are wrong.
 
     RefPtr<Element> element = createElement(token, namespaceURI);
-    attachLater(currentNode(), element);
-    // FIXME: Don't we need to set the selfClosing flag on the task if we're
-    // not going to push the element on to the stack of open elements?
+    attachLater(currentNode(), element, token.selfClosing());
     if (!token.selfClosing())
         m_openElements.push(element.release());
 }

Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.h (118588 => 118589)


--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.h	2012-05-25 23:59:10 UTC (rev 118588)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.h	2012-05-26 00:18:27 UTC (rev 118589)
@@ -155,7 +155,7 @@
     // tokens produce only one DOM mutation.
     typedef Vector<HTMLConstructionSiteTask, 1> AttachmentQueue;
 
-    void attachLater(ContainerNode* parent, PassRefPtr<Node> child);
+    void attachLater(ContainerNode* parent, PassRefPtr<Node> child, bool selfClosing = false);
 
     void findFosterSite(HTMLConstructionSiteTask&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to