Skip to content
Permalink
Browse files
REGRESSION(r201471): FormClient.textFieldDidEndEditing is no longer c…
…alled 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.


Canonical link: https://commits.webkit.org/177325@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rniwa committed Jun 28, 2016
1 parent 3ac95fd commit aca39491ec07caf71e3d55b7a41e5942b7ffe800
Showing 6 changed files with 53 additions and 3 deletions.
@@ -1,3 +1,19 @@
2016-06-28 Ryosuke Niwa <rniwa@webkit.org>

REGRESSION(r201471): FormClient.textFieldDidEndEditing is no longer called when a text field is removed
https://bugs.webkit.org/show_bug.cgi?id=159199
<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):

2016-06-28 Frederic Wang <fwang@igalia.com>

Phrasing content should be accepted in <mo> elements
@@ -82,6 +82,7 @@
#include "HTMLHtmlElement.h"
#include "HTMLIFrameElement.h"
#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
#include "HTMLLinkElement.h"
#include "HTMLMediaElement.h"
#include "HTMLNameCollection.h"
@@ -3808,8 +3809,11 @@ bool Document::setFocusedElement(Element* element, FocusDirection direction, Foc
focusChangeBlocked = true;
newFocusedElement = nullptr;
}
} else
} else {
if (is<HTMLInputElement>(*oldFocusedElement))
downcast<HTMLInputElement>(*oldFocusedElement).endEditing();
ASSERT(!m_focusedElement);
}

if (oldFocusedElement->isRootEditableElement())
frame()->editor().didEndEditing();
@@ -1,3 +1,17 @@
2016-06-28 Ryosuke Niwa <rniwa@webkit.org>

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

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.

2016-06-28 Per Arne Vollan <pvollan@apple.com>

[Win] Custom elements tests are failing.
@@ -25,7 +25,7 @@

#include "config.h"

#if WK_HAVE_C_SPI && !PLATFORM(MAC)
#if WK_HAVE_C_SPI

#include "PlatformUtilities.h"
#include "PlatformWebView.h"
@@ -126,6 +126,12 @@ TEST_F(WebKit2TextFieldBeginAndEditEditingTest, TextFieldDidBeginShouldNotBeDisp
executeJavaScriptAndCheckDidReceiveMessage("blurTextField('input')", "DidReceiveTextFieldDidEndEditing");
}

TEST_F(WebKit2TextFieldBeginAndEditEditingTest, TextFieldDidEndShouldBeDispatchedForRemovedFocusField)
{
executeJavaScriptAndCheckDidReceiveMessage("focusTextField('input')", "DidReceiveTextFieldDidBeginEditing");
executeJavaScriptAndCheckDidReceiveMessage("removeTextField('input')", "DidReceiveTextFieldDidEndEditing");
}

} // namespace TestWebKitAPI

#endif
@@ -25,7 +25,7 @@

#include "config.h"

#if WK_HAVE_C_SPI && !PLATFORM(MAC)
#if WK_HAVE_C_SPI

#include "InjectedBundleTest.h"

@@ -1,9 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<div tabindex=0></div>
<input id="input" type="text">
<input id="readonly" type="text" readonly>
<script>

document.querySelector('div').focus();

function focusTextField(id)
{
document.getElementById(id).focus();
@@ -13,6 +17,12 @@
{
document.getElementById(id).blur();
}

function removeTextField(id)
{
document.getElementById(id).remove();
}

</script>
</body>
</html>

0 comments on commit aca3949

Please sign in to comment.