⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 202951 in webkit


Ignore:
Timestamp:
Jul 7, 2016, 6:15:48 PM (10 years ago)
Author:
Chris Dumez
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:

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):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r202937 r202951  
     12016-07-07  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLTitleElement.text should only account for direct children Text nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=159536
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Rebaseline now that more checks are passing.
     9
     10        * web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt:
     11        * web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt:
     12
    1132016-07-07  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-01-expected.txt

    r189476 r202951  
    11
    2 FAIL COMMENT assert_equals: expected "TEXT" but got "TEXTELEMENT"
     2PASS COMMENT
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-title-element/title.text-02-expected.txt

    r189476 r202951  
    11
    2 FAIL COMMENT assert_equals: expected "TEXT" but got "TEXTELEMENT"
     2PASS COMMENT
    33
  • trunk/Source/WebCore/ChangeLog

    r202950 r202951  
     12016-07-07  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLTitleElement.text should only account for direct children Text nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=159536
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        HTMLTitleElement.text should only account for direct children Text nodes:
     9        - https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
     10        - https://html.spec.whatwg.org/multipage/infrastructure.html#child-text-content
     11
     12        Firefox and Chrome match the specification. However, WebKit accounted for all
     13        Text nodes that are descendants, not just children. This patch aligns our
     14        behavior with the specification and other browsers.
     15
     16        No new tests, rebaselined existing tests.
     17
     18        * html/HTMLTitleElement.cpp:
     19        (WebCore::HTMLTitleElement::text):
     20
    1212016-07-07  Dean Jackson  <dino@apple.com>
    222
  • trunk/Source/WebCore/html/HTMLTitleElement.cpp

    r202895 r202951  
    7575String HTMLTitleElement::text() const
    7676{
    77     return TextNodeTraversal::contentsAsString(*this);
     77    StringBuilder result;
     78    for (Text* text = TextNodeTraversal::firstChild(*this); text; text = TextNodeTraversal::nextSibling(*text))
     79        result.append(text->data());
     80    return result.toString();
    7881}
    7982
Note: See TracChangeset for help on using the changeset viewer.