Match newly-clarified spec on textarea defaultValue/value/child text content
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 20:49:52 +0000 (20:49 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 20:49:52 +0000 (20:49 +0000)
commit109fd797342373b1ec4aba57fcdc8c8bb39f1d94
tree8f8fb541f528a2f712b23a1ae3d3eb0643c810f8
parent3cdfe0f63b626c4ef9e79595490650cde814f31b
Match newly-clarified spec on textarea defaultValue/value/child text content
https://bugs.webkit.org/show_bug.cgi?id=173878

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Re-sync WPT test from upstream and rebaseline to improve test coverage.

* web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent-expected.txt:
* web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html:

Source/WebCore:

Update HTMLTextArea.defaultValue to match align with other browsers and match the
latest HTML specification:
- https://html.spec.whatwg.org/#dom-textarea-defaultvalue

The defaultValue getter should return the child text content:
- https://dom.spec.whatwg.org/#concept-child-text-content
Our code was traversing all Text descendants, not just the children.

The defaultValue setter should act as the setter of the Element's textContent
IDL attribute. Previously, we had a custom logic that was only removing the
text children.

Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::scriptContent const):
* dom/TextNodeTraversal.cpp:
(WebCore::TextNodeTraversal::childTextContent):
* dom/TextNodeTraversal.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::defaultValue const):
(WebCore::HTMLTextAreaElement::setDefaultValue):
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::text const):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220290 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/import-expectations.json
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent-xhtml-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent-xhtml.xhtml [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/w3c-import.log
Source/WebCore/ChangeLog
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/dom/TextNodeTraversal.cpp
Source/WebCore/dom/TextNodeTraversal.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTitleElement.cpp