Changeset 202578 in webkit


Ignore:
Timestamp:
Jun 28, 2016 11:20:42 AM (8 years ago)
Author:
rniwa@webkit.org
Message:

REGRESSION(r201471): FormClient.textFieldDidEndEditing is no longer called when a text field is removed
https://bugs.webkit.org/show_bug.cgi?id=159199
Source/WebCore:

<rdar://problem/26748189>

Reviewed by Alexey Proskuryakov.

The bug was caused by HTMLInputElement's endEditing no longer getting called due to the behavior change.
Preserve the WebKit2 API semantics by manually calling HTMLInputElement::endEditing in setFocusedElement.

Tests: WebKit2TextFieldDidBeginAndEndEditing

  • dom/Document.cpp:

(WebCore::Document::setFocusedElement):

Tools:

Reviewed by Alexey Proskuryakov.

Added a test case for removing a text field. Also fixed the flakiness and re-enabled it on Mac.

  • TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp:
  • TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp:
  • TestWebKitAPI/Tests/WebKit2/input-focus-blur.html: Focus a div upfront to avoid the flakiness from

an input element getting automatically focused on Mac.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202572 r202578  
     12016-06-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r201471): FormClient.textFieldDidEndEditing is no longer called when a text field is removed
     4        https://bugs.webkit.org/show_bug.cgi?id=159199
     5        <rdar://problem/26748189>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        The bug was caused by HTMLInputElement's endEditing no longer getting called due to the behavior change.
     10        Preserve the WebKit2 API semantics by manually calling HTMLInputElement::endEditing in setFocusedElement.
     11
     12        Tests: WebKit2TextFieldDidBeginAndEndEditing
     13
     14        * dom/Document.cpp:
     15        (WebCore::Document::setFocusedElement):
     16
    1172016-06-28  Frederic Wang  <fwang@igalia.com>
    218
  • trunk/Source/WebCore/dom/Document.cpp

    r202559 r202578  
    8383#include "HTMLIFrameElement.h"
    8484#include "HTMLImageElement.h"
     85#include "HTMLInputElement.h"
    8586#include "HTMLLinkElement.h"
    8687#include "HTMLMediaElement.h"
     
    38093810                newFocusedElement = nullptr;
    38103811            }
    3811         } else
     3812        } else {
     3813            if (is<HTMLInputElement>(*oldFocusedElement))
     3814                downcast<HTMLInputElement>(*oldFocusedElement).endEditing();
    38123815            ASSERT(!m_focusedElement);
     3816        }
    38133817
    38143818        if (oldFocusedElement->isRootEditableElement())
  • trunk/Tools/ChangeLog

    r202559 r202578  
     12016-06-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r201471): FormClient.textFieldDidEndEditing is no longer called when a text field is removed
     4        https://bugs.webkit.org/show_bug.cgi?id=159199
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Added a test case for removing a text field. Also fixed the flakiness and re-enabled it on Mac.
     9
     10        * TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp:
     11        * TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp:
     12        * TestWebKitAPI/Tests/WebKit2/input-focus-blur.html: Focus a div upfront to avoid the flakiness from
     13        an input element getting automatically focused on Mac.
     14
    1152016-06-28  Per Arne Vollan  <pvollan@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp

    r185692 r202578  
    2626#include "config.h"
    2727
    28 #if WK_HAVE_C_SPI && !PLATFORM(MAC)
     28#if WK_HAVE_C_SPI
    2929
    3030#include "PlatformUtilities.h"
     
    127127}
    128128
     129TEST_F(WebKit2TextFieldBeginAndEditEditingTest, TextFieldDidEndShouldBeDispatchedForRemovedFocusField)
     130{
     131    executeJavaScriptAndCheckDidReceiveMessage("focusTextField('input')", "DidReceiveTextFieldDidBeginEditing");
     132    executeJavaScriptAndCheckDidReceiveMessage("removeTextField('input')", "DidReceiveTextFieldDidEndEditing");
     133}
     134
    129135} // namespace TestWebKitAPI
    130136
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp

    r185169 r202578  
    2626#include "config.h"
    2727
    28 #if WK_HAVE_C_SPI && !PLATFORM(MAC)
     28#if WK_HAVE_C_SPI
    2929
    3030#include "InjectedBundleTest.h"
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/input-focus-blur.html

    r185089 r202578  
    22<html>
    33<body>
     4<div tabindex=0></div>
    45<input id="input" type="text">
    56<input id="readonly" type="text" readonly>
    67<script>
     8
     9document.querySelector('div').focus();
     10
    711function focusTextField(id)
    812{
     
    1418    document.getElementById(id).blur();
    1519}
     20
     21function removeTextField(id)
     22{
     23    document.getElementById(id).remove();
     24}
     25
    1626</script>
    1727</body>
Note: See TracChangeset for help on using the changeset viewer.