Title: [258333] trunk
- Revision
- 258333
- Author
- dba...@webkit.org
- Date
- 2020-03-12 09:19:20 -0700 (Thu, 12 Mar 2020)
Log Message
FocusController::setFocusedElement() should tell client of refocused element
https://bugs.webkit.org/show_bug.cgi?id=208880
Reviewed by Wenson Hsieh.
Source/WebCore:
If the specified new focus element is non-nullptr and is already focused then tell the client
that the element was re-focused so that it may update its input state, if needed. On iOS, this
lets the UI process evaluate again whether to start an input session (i.e. bring up the keyboard),
which may have been disallowed when the element was originally focused (say, it was programmatically
focused and there was no hardware keyboard attached).
* page/FocusController.cpp:
(WebCore::FocusController::setFocusedElement):
Tools:
Adds a test to ensure that calling -selectPositionAtPoint on an already focused element tries
to start an input session. Currently, it does not even try.
* TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (258332 => 258333)
--- trunk/Source/WebCore/ChangeLog 2020-03-12 15:47:57 UTC (rev 258332)
+++ trunk/Source/WebCore/ChangeLog 2020-03-12 16:19:20 UTC (rev 258333)
@@ -1,3 +1,19 @@
+2020-03-12 Daniel Bates <daba...@apple.com>
+
+ FocusController::setFocusedElement() should tell client of refocused element
+ https://bugs.webkit.org/show_bug.cgi?id=208880
+
+ Reviewed by Wenson Hsieh.
+
+ If the specified new focus element is non-nullptr and is already focused then tell the client
+ that the element was re-focused so that it may update its input state, if needed. On iOS, this
+ lets the UI process evaluate again whether to start an input session (i.e. bring up the keyboard),
+ which may have been disallowed when the element was originally focused (say, it was programmatically
+ focused and there was no hardware keyboard attached).
+
+ * page/FocusController.cpp:
+ (WebCore::FocusController::setFocusedElement):
+
2020-03-12 Rob Buis <rb...@igalia.com>
Implement wildcard behavior for Cross-Origin-Expose-Headers
Modified: trunk/Source/WebCore/page/FocusController.cpp (258332 => 258333)
--- trunk/Source/WebCore/page/FocusController.cpp 2020-03-12 15:47:57 UTC (rev 258332)
+++ trunk/Source/WebCore/page/FocusController.cpp 2020-03-12 16:19:20 UTC (rev 258333)
@@ -820,8 +820,11 @@
RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : nullptr;
Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : nullptr;
- if (oldFocusedElement == element)
+ if (oldFocusedElement == element) {
+ if (element)
+ m_page.chrome().client().elementDidRefocus(*element);
return true;
+ }
// FIXME: Might want to disable this check for caretBrowsing
if (oldFocusedElement && oldFocusedElement->isRootEditableElement() && !relinquishesEditingFocus(oldFocusedElement))
Modified: trunk/Tools/ChangeLog (258332 => 258333)
--- trunk/Tools/ChangeLog 2020-03-12 15:47:57 UTC (rev 258332)
+++ trunk/Tools/ChangeLog 2020-03-12 16:19:20 UTC (rev 258333)
@@ -1,3 +1,16 @@
+2020-03-12 Daniel Bates <daba...@apple.com>
+
+ FocusController::setFocusedElement() should tell client of refocused element
+ https://bugs.webkit.org/show_bug.cgi?id=208880
+
+ Reviewed by Wenson Hsieh.
+
+ Adds a test to ensure that calling -selectPositionAtPoint on an already focused element tries
+ to start an input session. Currently, it does not even try.
+
+ * TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm:
+ (TEST):
+
2020-03-12 Michael Catanzaro <mcatanz...@gnome.org>
[GTK] Use #!/usr/bin/python3 shebang to run generate-gtkdoc
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm (258332 => 258333)
--- trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm 2020-03-12 15:47:57 UTC (rev 258332)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm 2020-03-12 16:19:20 UTC (rev 258333)
@@ -130,4 +130,28 @@
EXPECT_WK_STREQ("DIV", [webView stringByEvaluatingJavaScript:@"document.activeElement.tagName"]);
}
+TEST(UIWKInteractionViewProtocol, SelectPositionAtPointInFocusedElementStartsInputSession)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)]);
+ auto inputDelegate = adoptNS([TestInputDelegate new]);
+ [webView _setInputDelegate:inputDelegate.get()];
+
+ bool didCallDecidePolicyForFocusedElement = false;
+ [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy {
+ didCallDecidePolicyForFocusedElement = true;
+ return _WKFocusStartsInputSessionPolicyDisallow;
+ }];
+
+ // 1. Focus element
+ [webView synchronouslyLoadHTMLString:@"<body style='margin: 0; padding: 0'><div contenteditable='true' style='height: 200px; width: 200px'></div></body>"];
+ [webView stringByEvaluatingJavaScript:@"document.querySelector('div').focus()"];
+ TestWebKitAPI::Util::run(&didCallDecidePolicyForFocusedElement);
+
+ // 2. Focus the element again via selecting a position at a point inside it.
+ didCallDecidePolicyForFocusedElement = false;
+ [webView becomeFirstResponder];
+ [webView selectPositionAtPoint:CGPointMake(8, 8)];
+ TestWebKitAPI::Util::run(&didCallDecidePolicyForFocusedElement);
+}
+
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes