Title: [230941] trunk
Revision
230941
Author
[email protected]
Date
2018-04-23 19:45:32 -0700 (Mon, 23 Apr 2018)

Log Message

[Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
https://bugs.webkit.org/show_bug.cgi?id=184901
<rdar://problem/39664797>

Reviewed by Tim Horton.

Source/WebKit:

Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView setTimePickerValueToHour:minute:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setTimePickerValueToHour:minute:]):

Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setTextAsync):

Tools:

Introduce a new UIScriptController method to set the value of a currently focused input of type time, by
interacting with the UI. See WebKit ChangeLogs for more detail.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setTimePickerValue):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setTimePickerValue):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setTimePickerValue):

LayoutTests:

Adds a basic test to verify that tapping on an input of type `time` and choosing a time actually changes the
value of the input. Also adds a new UIHelper function to set the value of the currently focused input of type
time to the given hours and minutes.

* fast/forms/extrazoom/time-picker-value-change-expected.txt: Added.
* fast/forms/extrazoom/time-picker-value-change.html: Added.
* resources/ui-helper.js:
(window.UIHelper.setTimePickerValue):
(window.UIHelper):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (230940 => 230941)


--- trunk/LayoutTests/ChangeLog	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/LayoutTests/ChangeLog	2018-04-24 02:45:32 UTC (rev 230941)
@@ -1,3 +1,21 @@
+2018-04-23  Wenson Hsieh  <[email protected]>
+
+        [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
+        https://bugs.webkit.org/show_bug.cgi?id=184901
+        <rdar://problem/39664797>
+
+        Reviewed by Tim Horton.
+
+        Adds a basic test to verify that tapping on an input of type `time` and choosing a time actually changes the
+        value of the input. Also adds a new UIHelper function to set the value of the currently focused input of type
+        time to the given hours and minutes.
+
+        * fast/forms/extrazoom/time-picker-value-change-expected.txt: Added.
+        * fast/forms/extrazoom/time-picker-value-change.html: Added.
+        * resources/ui-helper.js:
+        (window.UIHelper.setTimePickerValue):
+        (window.UIHelper):
+
 2018-04-23  Chris Dumez  <[email protected]>
 
         Unreviewed, fix a few tests that became flaky after r230919.

Added: trunk/LayoutTests/fast/forms/extrazoom/time-picker-value-change-expected.txt (0 => 230941)


--- trunk/LayoutTests/fast/forms/extrazoom/time-picker-value-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/extrazoom/time-picker-value-change-expected.txt	2018-04-24 02:45:32 UTC (rev 230941)
@@ -0,0 +1,5 @@
+PASS time.value is '09:41'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/extrazoom/time-picker-value-change.html (0 => 230941)


--- trunk/LayoutTests/fast/forms/extrazoom/time-picker-value-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/extrazoom/time-picker-value-change.html	2018-04-24 02:45:32 UTC (rev 230941)
@@ -0,0 +1,38 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<meta name="viewport" content="width=device-width">
+<head>
+<script src=""
+<script src=""
+<script>
+doneCount = 0;
+jsTestIsAsync = true;
+
+async function runTest() {
+    if (!window.testRunner) {
+        description(`This test requires WebKitTestRunner.`);
+        return;
+    }
+
+    time = document.querySelector("input");
+    time.addEventListener("change", checkDone);
+    time.addEventListener("blur", checkDone);
+
+    await UIHelper.activateAndWaitForInputSessionAt(75, 75);
+    UIHelper.waitForKeyboardToHide().then(checkDone)
+    UIHelper.setTimePickerValue(9, 41);
+}
+
+function checkDone() {
+    if (++doneCount < 3)
+        return;
+
+    shouldBe("time.value", "'09:41'");
+    finishJSTest();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<input type="time" value="04:01" style="width: 320px; height: 568px;"></input>
+</body>
+</html>

Modified: trunk/LayoutTests/resources/ui-helper.js (230940 => 230941)


--- trunk/LayoutTests/resources/ui-helper.js	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/LayoutTests/resources/ui-helper.js	2018-04-24 02:45:32 UTC (rev 230941)
@@ -193,4 +193,10 @@
         const enterTextScript = `(() => uiController.enterText(\`${escapedText}\`))()`;
         return new Promise(resolve => testRunner.runUIScript(enterTextScript, resolve));
     }
+
+    static setTimePickerValue(hours, minutes)
+    {
+        const setValueScript = `(() => uiController.setTimePickerValue(${hours}, ${minutes}))()`;
+        return new Promise(resolve => testRunner.runUIScript(setValueScript, resolve));
+    }
 }

Modified: trunk/Source/WebKit/ChangeLog (230940 => 230941)


--- trunk/Source/WebKit/ChangeLog	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Source/WebKit/ChangeLog	2018-04-24 02:45:32 UTC (rev 230941)
@@ -1,3 +1,28 @@
+2018-04-23  Wenson Hsieh  <[email protected]>
+
+        [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
+        https://bugs.webkit.org/show_bug.cgi?id=184901
+        <rdar://problem/39664797>
+
+        Reviewed by Tim Horton.
+
+        Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
+        is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView setTimePickerValueToHour:minute:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setTimePickerValueToHour:minute:]):
+
+        Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
+        minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
+        as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setTextAsync):
+
 2018-04-23  Saam Barati  <[email protected]>
 
         Keep around a pre-warmed process when doing process swap on navigation

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (230940 => 230941)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-04-24 02:45:32 UTC (rev 230941)
@@ -5899,6 +5899,11 @@
     [_contentView accessoryDone];
 }
 
+- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute
+{
+    [_contentView setTimePickerValueToHour:hour minute:minute];
+}
+
 - (void)selectFormAccessoryPickerRow:(int)rowIndex
 {
     [_contentView selectFormAccessoryPickerRow:rowIndex];

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (230940 => 230941)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-04-24 02:45:32 UTC (rev 230941)
@@ -382,6 +382,7 @@
 - (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(10.3));
 - (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(10.3));
 @property (nonatomic, readonly) NSString *selectFormPopoverTitle WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute WK_API_AVAILABLE(ios(WK_IOS_TBA));
 
 - (void)applyAutocorrection:(NSString *)newString toString:(NSString *)oldString withCompletionHandler:(void (^)(void))completionHandler WK_API_AVAILABLE(ios(11.0));
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (230940 => 230941)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-04-24 02:45:32 UTC (rev 230941)
@@ -361,6 +361,7 @@
 - (void)_simulateLongPressActionAtLocation:(CGPoint)location;
 - (void)_simulateTextEntered:(NSString *)text;
 - (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
+- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem;
 
 @property (nonatomic, readonly) NSString *selectFormPopoverTitle;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (230940 => 230941)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-04-24 02:45:32 UTC (rev 230941)
@@ -5518,6 +5518,14 @@
     return [(WKFormSelectControl *)_inputPeripheral selectFormPopoverTitle];
 }
 
+- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute
+{
+#if ENABLE(EXTRA_ZOOM_MODE)
+    if ([_presentedFullScreenInputViewController isKindOfClass:[WKTimePickerViewController class]])
+        [(WKTimePickerViewController *)_presentedFullScreenInputViewController.get() setHour:hour minute:minute];
+#endif
+}
+
 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem
 {
     if ([userInterfaceItem isEqualToString:@"actionSheet"])

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (230940 => 230941)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-04-24 02:45:32 UTC (rev 230941)
@@ -4608,12 +4608,19 @@
 void WebPage::setTextAsync(const String& text)
 {
     auto frame = makeRef(m_page->focusController().focusedOrMainFrame());
-    if (!frame->selection().selection().isContentEditable())
+    if (frame->selection().selection().isContentEditable()) {
+        UserTypingGestureIndicator indicator(frame.get());
+        frame->selection().selectAll();
+        frame->editor().insertText(text, nullptr, TextEventInputKeyboard);
         return;
+    }
 
-    UserTypingGestureIndicator indicator(frame.get());
-    frame->selection().selectAll();
-    frame->editor().insertText(text, nullptr, TextEventInputKeyboard);
+    if (is<HTMLInputElement>(m_assistedNode.get())) {
+        downcast<HTMLInputElement>(*m_assistedNode).setValueForUser(text);
+        return;
+    }
+
+    ASSERT_NOT_REACHED();
 }
 
 void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)

Modified: trunk/Tools/ChangeLog (230940 => 230941)


--- trunk/Tools/ChangeLog	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Tools/ChangeLog	2018-04-24 02:45:32 UTC (rev 230941)
@@ -1,3 +1,23 @@
+2018-04-23  Wenson Hsieh  <[email protected]>
+
+        [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
+        https://bugs.webkit.org/show_bug.cgi?id=184901
+        <rdar://problem/39664797>
+
+        Reviewed by Tim Horton.
+
+        Introduce a new UIScriptController method to set the value of a currently focused input of type time, by
+        interacting with the UI. See WebKit ChangeLogs for more detail.
+
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::setTimePickerValue):
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::setTimePickerValue):
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::setTimePickerValue):
+
 2018-04-23  Zalan Bujtas  <[email protected]>
 
         [LayoutFormattingContext] Initial commit.

Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (230940 => 230941)


--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2018-04-24 02:45:32 UTC (rev 230941)
@@ -159,6 +159,10 @@
 {
 }
 
+void UIScriptController::setTimePickerValue(long, long)
+{
+}
+
 void UIScriptController::selectFormAccessoryPickerRow(long rowIndex)
 {
 }

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (230940 => 230941)


--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2018-04-24 02:45:32 UTC (rev 230941)
@@ -190,6 +190,8 @@
     void selectFormAccessoryPickerRow(long rowIndex);
     readonly attribute DOMString selectFormPopoverTitle;
 
+    void setTimePickerValue(long hour, long minute);
+
     void keyboardAccessoryBarNext();
     void keyboardAccessoryBarPrevious();
 

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (230940 => 230941)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp	2018-04-24 02:45:32 UTC (rev 230941)
@@ -298,6 +298,10 @@
 {
 }
 
+void UIScriptController::setTimePickerValue(long, long)
+{
+}
+
 void UIScriptController::selectFormAccessoryPickerRow(long)
 {
 }

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (230940 => 230941)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2018-04-24 02:45:32 UTC (rev 230941)
@@ -99,6 +99,7 @@
     void dismissFormAccessoryView();
     void selectFormAccessoryPickerRow(long);
     JSRetainPtr<JSStringRef> selectFormPopoverTitle() const;
+    void setTimePickerValue(long hour, long minute);
     
     JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const;
     void overridePreference(JSStringRef preference, JSStringRef value);

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (230940 => 230941)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2018-04-24 02:34:11 UTC (rev 230940)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2018-04-24 02:45:32 UTC (rev 230941)
@@ -436,6 +436,12 @@
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
     [webView selectFormAccessoryPickerRow:rowIndex];
 }
+
+void UIScriptController::setTimePickerValue(long hour, long minute)
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+    [webView setTimePickerValueToHour:hour minute:minute];
+}
     
 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to