Changeset 230941 in webkit


Ignore:
Timestamp:
Apr 23, 2018 7:45:32 PM (6 years ago)
Author:
Wenson Hsieh
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):

Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r230939 r230941  
     12018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
     4        https://bugs.webkit.org/show_bug.cgi?id=184901
     5        <rdar://problem/39664797>
     6
     7        Reviewed by Tim Horton.
     8
     9        Adds a basic test to verify that tapping on an input of type `time` and choosing a time actually changes the
     10        value of the input. Also adds a new UIHelper function to set the value of the currently focused input of type
     11        time to the given hours and minutes.
     12
     13        * fast/forms/extrazoom/time-picker-value-change-expected.txt: Added.
     14        * fast/forms/extrazoom/time-picker-value-change.html: Added.
     15        * resources/ui-helper.js:
     16        (window.UIHelper.setTimePickerValue):
     17        (window.UIHelper):
     18
    1192018-04-23  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/LayoutTests/resources/ui-helper.js

    r230860 r230941  
    194194        return new Promise(resolve => testRunner.runUIScript(enterTextScript, resolve));
    195195    }
     196
     197    static setTimePickerValue(hours, minutes)
     198    {
     199        const setValueScript = `(() => uiController.setTimePickerValue(${hours}, ${minutes}))()`;
     200        return new Promise(resolve => testRunner.runUIScript(setValueScript, resolve));
     201    }
    196202}
  • trunk/Source/WebKit/ChangeLog

    r230938 r230941  
     12018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
     4        https://bugs.webkit.org/show_bug.cgi?id=184901
     5        <rdar://problem/39664797>
     6
     7        Reviewed by Tim Horton.
     8
     9        Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
     10        is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.
     11
     12        * UIProcess/API/Cocoa/WKWebView.mm:
     13        (-[WKWebView setTimePickerValueToHour:minute:]):
     14        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     15        * UIProcess/ios/WKContentViewInteraction.h:
     16        * UIProcess/ios/WKContentViewInteraction.mm:
     17        (-[WKContentView setTimePickerValueToHour:minute:]):
     18
     19        Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
     20        minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
     21        as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].
     22
     23        * WebProcess/WebPage/WebPage.cpp:
     24        (WebKit::WebPage::setTextAsync):
     25
    1262018-04-23  Saam Barati  <sbarati@apple.com>
    227
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r230884 r230941  
    59005900}
    59015901
     5902- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute
     5903{
     5904    [_contentView setTimePickerValueToHour:hour minute:minute];
     5905}
     5906
    59025907- (void)selectFormAccessoryPickerRow:(int)rowIndex
    59035908{
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r230868 r230941  
    383383- (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(10.3));
    384384@property (nonatomic, readonly) NSString *selectFormPopoverTitle WK_API_AVAILABLE(ios(WK_IOS_TBA));
     385- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute WK_API_AVAILABLE(ios(WK_IOS_TBA));
    385386
    386387- (void)applyAutocorrection:(NSString *)newString toString:(NSString *)oldString withCompletionHandler:(void (^)(void))completionHandler WK_API_AVAILABLE(ios(11.0));
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r230860 r230941  
    362362- (void)_simulateTextEntered:(NSString *)text;
    363363- (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
     364- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
    364365- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem;
    365366
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r230902 r230941  
    55195519}
    55205520
     5521- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute
     5522{
     5523#if ENABLE(EXTRA_ZOOM_MODE)
     5524    if ([_presentedFullScreenInputViewController isKindOfClass:[WKTimePickerViewController class]])
     5525        [(WKTimePickerViewController *)_presentedFullScreenInputViewController.get() setHour:hour minute:minute];
     5526#endif
     5527}
     5528
    55215529- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem
    55225530{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r230908 r230941  
    46094609{
    46104610    auto frame = makeRef(m_page->focusController().focusedOrMainFrame());
    4611     if (!frame->selection().selection().isContentEditable())
    4612         return;
    4613 
    4614     UserTypingGestureIndicator indicator(frame.get());
    4615     frame->selection().selectAll();
    4616     frame->editor().insertText(text, nullptr, TextEventInputKeyboard);
     4611    if (frame->selection().selection().isContentEditable()) {
     4612        UserTypingGestureIndicator indicator(frame.get());
     4613        frame->selection().selectAll();
     4614        frame->editor().insertText(text, nullptr, TextEventInputKeyboard);
     4615        return;
     4616    }
     4617
     4618    if (is<HTMLInputElement>(m_assistedNode.get())) {
     4619        downcast<HTMLInputElement>(*m_assistedNode).setValueForUser(text);
     4620        return;
     4621    }
     4622
     4623    ASSERT_NOT_REACHED();
    46174624}
    46184625
  • trunk/Tools/ChangeLog

    r230931 r230941  
     12018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
     4        https://bugs.webkit.org/show_bug.cgi?id=184901
     5        <rdar://problem/39664797>
     6
     7        Reviewed by Tim Horton.
     8
     9        Introduce a new UIScriptController method to set the value of a currently focused input of type time, by
     10        interacting with the UI. See WebKit ChangeLogs for more detail.
     11
     12        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
     13        (WTR::UIScriptController::setTimePickerValue):
     14        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
     15        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
     16        (WTR::UIScriptController::setTimePickerValue):
     17        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     18        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
     19        (WTR::UIScriptController::setTimePickerValue):
     20
    1212018-04-23  Zalan Bujtas  <zalan@apple.com>
    222
  • trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm

    r230860 r230941  
    160160}
    161161
     162void UIScriptController::setTimePickerValue(long, long)
     163{
     164}
     165
    162166void UIScriptController::selectFormAccessoryPickerRow(long rowIndex)
    163167{
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r230860 r230941  
    191191    readonly attribute DOMString selectFormPopoverTitle;
    192192
     193    void setTimePickerValue(long hour, long minute);
     194
    193195    void keyboardAccessoryBarNext();
    194196    void keyboardAccessoryBarPrevious();
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r230860 r230941  
    299299}
    300300
     301void UIScriptController::setTimePickerValue(long, long)
     302{
     303}
     304
    301305void UIScriptController::selectFormAccessoryPickerRow(long)
    302306{
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r230860 r230941  
    100100    void selectFormAccessoryPickerRow(long);
    101101    JSRetainPtr<JSStringRef> selectFormPopoverTitle() const;
     102    void setTimePickerValue(long hour, long minute);
    102103   
    103104    JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const;
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r230860 r230941  
    437437    [webView selectFormAccessoryPickerRow:rowIndex];
    438438}
     439
     440void UIScriptController::setTimePickerValue(long hour, long minute)
     441{
     442    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
     443    [webView setTimePickerValueToHour:hour minute:minute];
     444}
    439445   
    440446JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
Note: See TracChangeset for help on using the changeset viewer.