Changeset 206026 in webkit


Ignore:
Timestamp:
Sep 16, 2016 9:32:34 AM (8 years ago)
Author:
Chris Dumez
Message:

Cloning a textarea does not clone the textarea's value
https://bugs.webkit.org/show_bug.cgi?id=156637

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import corresponding W3C web platform test.

  • web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps-expected.txt: Added.
  • web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html: Added.
  • web-platform-tests/html/semantics/forms/the-textarea-element/w3c-import.log:

Source/WebCore:

Update WebKit so that cloning a textarea element also clones its value.
This matches the HTML specification after:

The new behavior also matches Chrome and Edge.

Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):

  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::copyNonAttributePropertiesFromElement):

  • html/HTMLTextAreaElement.h:

LayoutTests:

Update existing test to reflect behavior change.

  • fast/forms/checkValidity-cloneNode-crash-expected.txt:
  • fast/forms/checkValidity-cloneNode-crash.html:
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206014 r206026  
     12016-09-16  Chris Dumez  <cdumez@apple.com>
     2
     3        Cloning a textarea does not clone the textarea's value
     4        https://bugs.webkit.org/show_bug.cgi?id=156637
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Update existing test to reflect behavior change.
     9
     10        * fast/forms/checkValidity-cloneNode-crash-expected.txt:
     11        * fast/forms/checkValidity-cloneNode-crash.html:
     12
    1132016-09-16  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash-expected.txt

    r200069 r206026  
    1111PASS element2.checkValidity() is false
    1212PASS element.checkValidity() is true
    13 PASS element2.value is ""
    14 PASS element2.checkValidity() is false
     13PASS element2.value is "a"
     14PASS element2.checkValidity() is true
    1515PASS element2.checkValidity() is true
    1616PASS successfullyParsed is true
  • trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash.html

    r200069 r206026  
    4545    shouldBeTrue("element.checkValidity()");
    4646    element2 = element.cloneNode();
    47     shouldBeEqualToString("element2.value", "");
    48     shouldBeFalse("element2.checkValidity()");
     47    shouldBeEqualToString("element2.value", "a");
     48    shouldBeTrue("element2.checkValidity()");
    4949    element2.value = element.value;
    5050    shouldBeTrue("element2.checkValidity()");
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r206014 r206026  
     12016-09-16  Chris Dumez  <cdumez@apple.com>
     2
     3        Cloning a textarea does not clone the textarea's value
     4        https://bugs.webkit.org/show_bug.cgi?id=156637
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Import corresponding W3C web platform test.
     9
     10        * web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps-expected.txt: Added.
     11        * web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html: Added.
     12        * web-platform-tests/html/semantics/forms/the-textarea-element/w3c-import.log:
     13
    1142016-09-16  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/w3c-import.log

    r200238 r206026  
    1616------------------------------------------------------------------------
    1717List of files:
     18/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html
    1819/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/textarea-newline-bidi-expected.html
    1920/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/textarea-newline-bidi.html
  • trunk/Source/WebCore/ChangeLog

    r206025 r206026  
     12016-09-16  Chris Dumez  <cdumez@apple.com>
     2
     3        Cloning a textarea does not clone the textarea's value
     4        https://bugs.webkit.org/show_bug.cgi?id=156637
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Update WebKit so that cloning a textarea element also clones its value.
     9        This matches the HTML specification after:
     10        - https://github.com/whatwg/html/pull/1784
     11
     12        The new behavior also matches Chrome and Edge.
     13
     14        Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html
     15
     16        * html/HTMLInputElement.cpp:
     17        (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
     18        * html/HTMLTextAreaElement.cpp:
     19        (WebCore::HTMLTextAreaElement::copyNonAttributePropertiesFromElement):
     20        * html/HTMLTextAreaElement.h:
     21
    1222016-09-16  Jer Noble  <jer.noble@apple.com>
    223
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r205912 r206026  
    955955void HTMLInputElement::copyNonAttributePropertiesFromElement(const Element& source)
    956956{
    957     const HTMLInputElement& sourceElement = static_cast<const HTMLInputElement&>(source);
     957    auto& sourceElement = downcast<HTMLInputElement>(source);
    958958
    959959    m_valueIfDirty = sourceElement.m_valueIfDirty;
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r205663 r206026  
    588588}
    589589
     590void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& source)
     591{
     592    auto& sourceElement = downcast<HTMLTextAreaElement>(source);
     593
     594    setValueCommon(sourceElement.value());
     595    m_isDirty = sourceElement.m_isDirty;
     596    HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
     597
     598    updateValidity();
     599}
     600
    590601} // namespace WebCore
  • trunk/Source/WebCore/html/HTMLTextAreaElement.h

    r205524 r206026  
    5656    TextControlInnerTextElement* innerTextElement() const final;
    5757    RenderStyle createInnerTextStyle(const RenderStyle&) const final;
     58    void copyNonAttributePropertiesFromElement(const Element&) final;
    5859
    5960    void rendererWillBeDestroyed();
Note: See TracChangeset for help on using the changeset viewer.