Changeset 259950 in webkit


Ignore:
Timestamp:
Apr 12, 2020 6:03:13 AM (4 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r258532 - A change event gets dispatched when textarea gets changed without focus
https://bugs.webkit.org/show_bug.cgi?id=202144

Patch by ChangSeok Oh <ChangSeok Oh> on 2020-03-16
Reviewed by Ryosuke Niwa.

Source/WebCore:

A crash happens in WebCore::ValidationMessage::buildBubbleTree. An immediate reason
is that DOM tree is modified in buildBubbleTree triggered by a timer.
The function calls document.updateLayout() that causes a change event
for textarea to fire when something changed in the textarea.
This bug is not reproduced on Mac because buildBubbleTree is not called.
See ValidationMessage::setMessage.
On the other hand, the root cause of this issue is triggering the change event
for textarea even if it is not focused when a change is made. This behavior
is different to what Gecko and Chromium do. When loading the test, they do not
trigger the change event although the textarea is filled by the script
since the textarea is not focused. Only when we manually make a change (meaning
the textarea is focused by user input), the event gets dispatched. To fix it,
setChangedSinceLastFormControlChangeEvent(true) is moved below the focus check
in HTMLTextAreaElement::subtreeHasChanged();

Test: fast/forms/textfield-onchange-without-focus.html

  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::subtreeHasChanged):

LayoutTests:

The test should be identical to the extected result without crash.

  • fast/forms/textfield-onchange-without-focus-expected.html: Added.
  • fast/forms/textfield-onchange-without-focus.html: Added.
Location:
releases/WebKitGTK/webkit-2.28
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog

    r257994 r259950  
     12020-03-16  ChangSeok Oh  <changseok@webkit.org>
     2
     3        A change event gets dispatched when textarea gets changed without focus
     4        https://bugs.webkit.org/show_bug.cgi?id=202144
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        The test should be identical to the extected result without crash.
     9
     10        * fast/forms/textfield-onchange-without-focus-expected.html: Added.
     11        * fast/forms/textfield-onchange-without-focus.html: Added.
     12
    1132020-03-06  Enrique Ocaña González  <eocanha@igalia.com>
    214
  • releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog

    r259947 r259950  
     12020-03-16  ChangSeok Oh  <changseok@webkit.org>
     2
     3        A change event gets dispatched when textarea gets changed without focus
     4        https://bugs.webkit.org/show_bug.cgi?id=202144
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        A crash happens in WebCore::ValidationMessage::buildBubbleTree. An immediate reason
     9        is that DOM tree is modified in buildBubbleTree triggered by a timer.
     10        The function calls document.updateLayout() that causes a change event
     11        for textarea to fire when something changed in the textarea.
     12        This bug is not reproduced on Mac because buildBubbleTree is not called.
     13        See ValidationMessage::setMessage.
     14        On the other hand, the root cause of this issue is triggering the change event
     15        for textarea even if it is not focused when a change is made. This behavior
     16        is different to what Gecko and Chromium do. When loading the test, they do not
     17        trigger the change event although the textarea is filled by the script
     18        since the textarea is not focused. Only when we manually make a change (meaning
     19        the textarea is focused by user input), the event gets dispatched. To fix it,
     20        setChangedSinceLastFormControlChangeEvent(true) is moved below the focus check
     21        in HTMLTextAreaElement::subtreeHasChanged();
     22
     23        Test: fast/forms/textfield-onchange-without-focus.html
     24
     25        * html/HTMLTextAreaElement.cpp:
     26        (WebCore::HTMLTextAreaElement::subtreeHasChanged):
     27
    1282020-03-17  Philippe Normand  <pnormand@igalia.com>
    229
  • releases/WebKitGTK/webkit-2.28/Source/WebCore/html/HTMLTextAreaElement.cpp

    r248914 r259950  
    285285void HTMLTextAreaElement::subtreeHasChanged()
    286286{
    287     setChangedSinceLastFormControlChangeEvent(true);
    288287    setFormControlValueMatchesRenderer(false);
    289288    updateValidity();
     
    291290    if (!focused())
    292291        return;
     292
     293    setChangedSinceLastFormControlChangeEvent(true);
    293294
    294295    if (RefPtr<Frame> frame = document().frame())
Note: See TracChangeset for help on using the changeset viewer.