Title: [169118] trunk
Revision
169118
Author
[email protected]
Date
2014-05-20 10:13:35 -0700 (Tue, 20 May 2014)

Log Message

Only set title on SVG documents
https://bugs.webkit.org/show_bug.cgi?id=133068

Patch by Prashant Hiremath <[email protected]> on 2014-05-20
Reviewed by Dirk Schulze.

Source/WebCore:
Test: svg/custom/html_document_set_title.html

* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::insertedInto):
(WebCore::SVGTitleElement::removedFrom):
(WebCore::SVGTitleElement::childrenChanged):

LayoutTests:
* svg/custom/html_document_set_title-expected.txt: Added.
* svg/custom/html_document_set_title.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169117 => 169118)


--- trunk/LayoutTests/ChangeLog	2014-05-20 17:08:59 UTC (rev 169117)
+++ trunk/LayoutTests/ChangeLog	2014-05-20 17:13:35 UTC (rev 169118)
@@ -1,3 +1,13 @@
+2014-05-20  Prashant Hiremath  <[email protected]>
+
+        Only set title on SVG documents
+        https://bugs.webkit.org/show_bug.cgi?id=133068
+
+        Reviewed by Dirk Schulze.
+
+        * svg/custom/html_document_set_title-expected.txt: Added.
+        * svg/custom/html_document_set_title.html: Added.
+
 2014-05-20  Alexey Proskuryakov  <[email protected]>
 
         REGRESSION(r169105): fast/regions/cssom/region-range-for-box-crash.html is more crashy than before

Added: trunk/LayoutTests/svg/custom/html_document_set_title-expected.txt (0 => 169118)


--- trunk/LayoutTests/svg/custom/html_document_set_title-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/html_document_set_title-expected.txt	2014-05-20 17:13:35 UTC (rev 169118)
@@ -0,0 +1,5 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS document.title is ""
+

Added: trunk/LayoutTests/svg/custom/html_document_set_title.html (0 => 169118)


--- trunk/LayoutTests/svg/custom/html_document_set_title.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/html_document_set_title.html	2014-05-20 17:13:35 UTC (rev 169118)
@@ -0,0 +1,16 @@
+<html>
+<head>
+<script src=""
+<script>
+  function runTest()
+  {
+    shouldBe('document.title', '""');
+  }
+</script>
+</head>
+<body _onload_="runTest()">
+<svg>
+<title>Should not be set on HTML Document</title>
+</svg>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (169117 => 169118)


--- trunk/Source/WebCore/ChangeLog	2014-05-20 17:08:59 UTC (rev 169117)
+++ trunk/Source/WebCore/ChangeLog	2014-05-20 17:13:35 UTC (rev 169118)
@@ -1,3 +1,17 @@
+2014-05-20  Prashant Hiremath  <[email protected]>
+
+        Only set title on SVG documents
+        https://bugs.webkit.org/show_bug.cgi?id=133068
+
+        Reviewed by Dirk Schulze.
+
+        Test: svg/custom/html_document_set_title.html
+
+        * svg/SVGTitleElement.cpp:
+        (WebCore::SVGTitleElement::insertedInto):
+        (WebCore::SVGTitleElement::removedFrom):
+        (WebCore::SVGTitleElement::childrenChanged):
+
 2014-05-20  [email protected]  <[email protected]>
 
         [Curl] Invalid content in cache file, causes broken rendering.

Modified: trunk/Source/WebCore/svg/SVGTitleElement.cpp (169117 => 169118)


--- trunk/Source/WebCore/svg/SVGTitleElement.cpp	2014-05-20 17:08:59 UTC (rev 169117)
+++ trunk/Source/WebCore/svg/SVGTitleElement.cpp	2014-05-20 17:13:35 UTC (rev 169118)
@@ -42,26 +42,28 @@
     SVGElement::insertedInto(rootParent);
     if (!rootParent.inDocument())
         return InsertionDone;
-    // FIXME: It's possible to register SVGTitleElement to an HTMLDocument.
-    if (firstChild())
+
+    if (firstChild() && document().isSVGDocument()) {
         // FIXME: does SVG have a title text direction?
         document().setTitleElement(StringWithDirection(textContent(), LTR), this);
+    }
     return InsertionDone;
 }
 
 void SVGTitleElement::removedFrom(ContainerNode& rootParent)
 {
     SVGElement::removedFrom(rootParent);
-    if (rootParent.inDocument())
+    if (rootParent.inDocument() && document().isSVGDocument())
         document().removeTitle(this);
 }
 
 void SVGTitleElement::childrenChanged(const ChildChange& change)
 {
     SVGElement::childrenChanged(change);
-    if (inDocument())
+    if (inDocument() && document().isSVGDocument()) {
         // FIXME: does SVG have title text direction?
         document().setTitleElement(StringWithDirection(textContent(), LTR), this);
+    }
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to