Title: [202951] trunk
Revision
202951
Author
[email protected]
Date
2016-07-07 18:15:48 -0700 (Thu, 07 Jul 2016)

Log Message

HTMLTitleElement.text should only account for direct children Text nodes
https://bugs.webkit.org/show_bug.cgi?id=159536

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt:

Source/WebCore:

HTMLTitleElement.text should only account for direct children Text nodes:
- https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
- https://html.spec.whatwg.org/multipage/infrastructure.html#child-text-content

Firefox and Chrome match the specification. However, WebKit accounted for all
Text nodes that are descendants, not just children. This patch aligns our
behavior with the specification and other browsers.

No new tests, rebaselined existing tests.

* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::text):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (202950 => 202951)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-08 00:20:38 UTC (rev 202950)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-08 01:15:48 UTC (rev 202951)
@@ -1,5 +1,17 @@
 2016-07-07  Chris Dumez  <[email protected]>
 
+        HTMLTitleElement.text should only account for direct children Text nodes
+        https://bugs.webkit.org/show_bug.cgi?id=159536
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt:
+        * web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt:
+
+2016-07-07  Chris Dumez  <[email protected]>
+
         td / th should be exposed as HTMLTableCellElement objects
         https://bugs.webkit.org/show_bug.cgi?id=159518
         <rdar://problem/27225436>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt (202950 => 202951)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt	2016-07-08 00:20:38 UTC (rev 202950)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt	2016-07-08 01:15:48 UTC (rev 202951)
@@ -1,3 +1,3 @@
 
-FAIL COMMENT assert_equals: expected "TEXT" but got "TEXTELEMENT"
+PASS COMMENT 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt (202950 => 202951)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt	2016-07-08 00:20:38 UTC (rev 202950)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt	2016-07-08 01:15:48 UTC (rev 202951)
@@ -1,3 +1,3 @@
 
-FAIL COMMENT assert_equals: expected "TEXT" but got "TEXTELEMENT"
+PASS COMMENT 
 

Modified: trunk/Source/WebCore/ChangeLog (202950 => 202951)


--- trunk/Source/WebCore/ChangeLog	2016-07-08 00:20:38 UTC (rev 202950)
+++ trunk/Source/WebCore/ChangeLog	2016-07-08 01:15:48 UTC (rev 202951)
@@ -1,3 +1,23 @@
+2016-07-07  Chris Dumez  <[email protected]>
+
+        HTMLTitleElement.text should only account for direct children Text nodes
+        https://bugs.webkit.org/show_bug.cgi?id=159536
+
+        Reviewed by Ryosuke Niwa.
+
+        HTMLTitleElement.text should only account for direct children Text nodes:
+        - https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
+        - https://html.spec.whatwg.org/multipage/infrastructure.html#child-text-content
+
+        Firefox and Chrome match the specification. However, WebKit accounted for all
+        Text nodes that are descendants, not just children. This patch aligns our
+        behavior with the specification and other browsers.
+
+        No new tests, rebaselined existing tests.
+
+        * html/HTMLTitleElement.cpp:
+        (WebCore::HTMLTitleElement::text):
+
 2016-07-07  Dean Jackson  <[email protected]>
 
         REGRESSION(r200769): animations are no longer overridden

Modified: trunk/Source/WebCore/html/HTMLTitleElement.cpp (202950 => 202951)


--- trunk/Source/WebCore/html/HTMLTitleElement.cpp	2016-07-08 00:20:38 UTC (rev 202950)
+++ trunk/Source/WebCore/html/HTMLTitleElement.cpp	2016-07-08 01:15:48 UTC (rev 202951)
@@ -74,7 +74,10 @@
 
 String HTMLTitleElement::text() const
 {
-    return TextNodeTraversal::contentsAsString(*this);
+    StringBuilder result;
+    for (Text* text = TextNodeTraversal::firstChild(*this); text; text = TextNodeTraversal::nextSibling(*text))
+        result.append(text->data());
+    return result.toString();
 }
 
 StringWithDirection HTMLTitleElement::computedTextWithDirection()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to