Changeset 228557 in webkit


Ignore:
Timestamp:
Feb 16, 2018 6:35:49 AM (6 years ago)
Author:
Wenson Hsieh
Message:

[Extra zoom mode] Add basic support for <input type='date'> using date picker UI
https://bugs.webkit.org/show_bug.cgi?id=182847
<rdar://problem/35143111>

Reviewed by Tim Horton.

Source/WebCore:

Add new localized strings for "month", "day" and "year" as they appear in the date picker.

  • English.lproj/Localizable.strings:
  • platform/LocalizedStrings.cpp:

(WebCore::textInputModeWriteButtonTitle):
(WebCore::textInputModeSpeechButtonTitle):
(WebCore::datePickerDayLabelTitle):
(WebCore::datePickerMonthLabelTitle):
(WebCore::datePickerYearLabelTitle):
(WebCore::textInputModeWriteButton): Deleted.
(WebCore::textInputModeSpeechButton): Deleted.

  • platform/LocalizedStrings.h:

Source/WebKit:

Add support for presenting date pickers when focusing a date input.

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _stopAssistingNode]):
(-[WKContentView dismissAllInputViewControllers]):

Pull logic to dismiss input view controllers into a single helper.

(-[WKContentView presentDatePickerViewController:]):
(-[WKContentView dismissDatePickerViewController:]):
(-[WKContentView presentViewControllerForAssistedNode:]):
(-[WKContentView textInputController:didCommitText:]):
(-[WKContentView _wheelChangedWithEvent:]):

Delegate wheel events to the date picker.

  • UIProcess/ios/forms/WKDatePickerViewController.h: Added.
  • UIProcess/ios/forms/WKDatePickerViewController.mm: Added.

Add harness files for the WKDatePickerViewController implementation in WebKitAdditions.

  • WebKit.xcodeproj/project.pbxproj:
Location:
trunk/Source
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r228553 r228557  
     12018-02-16  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] Add basic support for <input type='date'> using date picker UI
     4        https://bugs.webkit.org/show_bug.cgi?id=182847
     5        <rdar://problem/35143111>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add new localized strings for "month", "day" and "year" as they appear in the date picker.
     10
     11        * English.lproj/Localizable.strings:
     12        * platform/LocalizedStrings.cpp:
     13        (WebCore::textInputModeWriteButtonTitle):
     14        (WebCore::textInputModeSpeechButtonTitle):
     15        (WebCore::datePickerDayLabelTitle):
     16        (WebCore::datePickerMonthLabelTitle):
     17        (WebCore::datePickerYearLabelTitle):
     18        (WebCore::textInputModeWriteButton): Deleted.
     19        (WebCore::textInputModeSpeechButton): Deleted.
     20        * platform/LocalizedStrings.h:
     21
    1222018-02-16  Zan Dobersek  <zdobersek@igalia.com>
    223
  • trunk/Source/WebCore/English.lproj/Localizable.strings

    r228121 r228557  
    212212"Cut (Undo action name)" = "Cut";
    213213
     214/* Day label in date picker */
     215"Day label in date picker" = "Day";
     216
    214217/* Default writing direction context menu item */
    215218"Default" = "Default";
     
    410413"Missing Plug-in" = "Missing Plug-in";
    411414
     415/* Month label in date picker */
     416"Month label in date picker" = "Month";
     417
    412418/* Media Mute context menu item */
    413419"Mute" = "Mute";
     
    818824"Write" = "Write";
    819825
     826/* Year label in date picker */
     827"Year label in date picker" = "Year";
     828
    820829/* message in authentication panel */
    821830"Your login information will be sent securely." = "Your login information will be sent securely.";
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r228121 r228557  
    10571057}
    10581058
    1059 String textInputModeWriteButton()
     1059String textInputModeWriteButtonTitle()
    10601060{
    10611061    return WEB_UI_STRING("Write", "Title of the writing button for zoomed form controls.");
    10621062}
    10631063
    1064 String textInputModeSpeechButton()
     1064String textInputModeSpeechButtonTitle()
    10651065{
    10661066    return WEB_UI_STRING("Speak", "Title of the dictation button for zoomed form controls.");
    10671067}
    10681068
     1069String datePickerDayLabelTitle()
     1070{
     1071    return WEB_UI_STRING("Day label in date picker", "Day label in date picker");
     1072}
     1073
     1074String datePickerMonthLabelTitle()
     1075{
     1076    return WEB_UI_STRING("Month label in date picker", "Month label in date picker");
     1077}
     1078
     1079String datePickerYearLabelTitle()
     1080{
     1081    return WEB_UI_STRING("Year label in date picker", "Year label in date picker");
     1082}
     1083
    10691084#endif
    10701085
  • trunk/Source/WebCore/platform/LocalizedStrings.h

    r228121 r228557  
    322322    WEBCORE_EXPORT String formControlGoButtonTitle();
    323323    WEBCORE_EXPORT String formControlSearchButtonTitle();
    324     WEBCORE_EXPORT String textInputModeWriteButton();
    325     WEBCORE_EXPORT String textInputModeSpeechButton();
     324    WEBCORE_EXPORT String textInputModeWriteButtonTitle();
     325    WEBCORE_EXPORT String textInputModeSpeechButtonTitle();
     326    WEBCORE_EXPORT String datePickerDayLabelTitle();
     327    WEBCORE_EXPORT String datePickerMonthLabelTitle();
     328    WEBCORE_EXPORT String datePickerYearLabelTitle();
    326329#endif
    327330
  • trunk/Source/WebKit/ChangeLog

    r228551 r228557  
     12018-02-16  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] Add basic support for <input type='date'> using date picker UI
     4        https://bugs.webkit.org/show_bug.cgi?id=182847
     5        <rdar://problem/35143111>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add support for presenting date pickers when focusing a date input.
     10
     11        * UIProcess/ios/WKContentViewInteraction.h:
     12        * UIProcess/ios/WKContentViewInteraction.mm:
     13        (-[WKContentView _stopAssistingNode]):
     14        (-[WKContentView dismissAllInputViewControllers]):
     15
     16        Pull logic to dismiss input view controllers into a single helper.
     17
     18        (-[WKContentView presentDatePickerViewController:]):
     19        (-[WKContentView dismissDatePickerViewController:]):
     20        (-[WKContentView presentViewControllerForAssistedNode:]):
     21        (-[WKContentView textInputController:didCommitText:]):
     22        (-[WKContentView _wheelChangedWithEvent:]):
     23
     24        Delegate wheel events to the date picker.
     25
     26        * UIProcess/ios/forms/WKDatePickerViewController.h: Added.
     27        * UIProcess/ios/forms/WKDatePickerViewController.mm: Added.
     28
     29        Add harness files for the WKDatePickerViewController implementation in WebKitAdditions.
     30
     31        * WebKit.xcodeproj/project.pbxproj:
     32
    1332018-02-15  Youenn Fablet  <youenn@apple.com>
    234
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r228393 r228557  
    8585
    8686#if ENABLE(EXTRA_ZOOM_MODE)
     87@class WKDatePickerViewController;
    8788@class WKFocusedFormControlViewController;
    8889@class WKNumberPadViewController;
     
    247248
    248249#if ENABLE(EXTRA_ZOOM_MODE)
     250    RetainPtr<WKDatePickerViewController> _datePickerViewController;
    249251    RetainPtr<WKTextInputViewController> _textInputViewController;
    250252    RetainPtr<WKFocusedFormControlViewController> _focusedFormControlViewController;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r228549 r228557  
    4141#import "UIKitSPI.h"
    4242#import "WKActionSheetAssistant.h"
     43#import "WKDatePickerViewController.h"
    4344#import "WKError.h"
    4445#import "WKFocusedFormControlViewController.h"
     
    40894090
    40904091#if ENABLE(EXTRA_ZOOM_MODE)
     4092    [self dismissAllInputViewControllers];
     4093    if (!_isChangingFocus)
     4094        [self dismissFocusedFormControlViewController:[_focusedFormControlViewController isVisible]];
     4095#endif
     4096
     4097    // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects.
     4098    if (editableChanged)
     4099        [_webView _scheduleVisibleContentRectUpdate];
     4100
     4101    [_webView didEndFormControlInteraction];
     4102}
     4103
     4104#if ENABLE(EXTRA_ZOOM_MODE)
     4105
     4106- (void)dismissAllInputViewControllers
     4107{
    40914108    [self dismissTextInputViewController:YES];
    40924109    [self dismissNumberPadViewController:YES];
    40934110    [self dismissSelectMenuViewController:YES];
    40944111    [self dismissTimePickerViewController:YES];
    4095     if (!_isChangingFocus)
    4096         [self dismissFocusedFormControlViewController:[_focusedFormControlViewController isVisible]];
    4097 #endif
    4098 
    4099     // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects.
    4100     if (editableChanged)
    4101         [_webView _scheduleVisibleContentRectUpdate];
    4102 
    4103     [_webView didEndFormControlInteraction];
    4104 }
    4105 
    4106 #if ENABLE(EXTRA_ZOOM_MODE)
     4112    [self dismissDatePickerViewController:YES];
     4113}
     4114
     4115- (void)presentDatePickerViewController:(BOOL)animated
     4116{
     4117    if (_datePickerViewController)
     4118        return;
     4119
     4120    _datePickerViewController = adoptNS([[WKDatePickerViewController alloc] initWithText:_assistedNodeInformation.value textSuggestions:@[ ]]);
     4121    [_datePickerViewController setDelegate:self];
     4122    [_focusedFormControlViewController presentViewController:_datePickerViewController.get() animated:animated completion:nil];
     4123}
     4124
     4125- (void)dismissDatePickerViewController:(BOOL)animated
     4126{
     4127    if (!_datePickerViewController)
     4128        return;
     4129
     4130    auto datePickerViewController = WTFMove(_datePickerViewController);
     4131    [datePickerViewController dismissViewControllerAnimated:animated completion:nil];
     4132}
    41074133
    41084134- (void)presentTimePickerViewController:(BOOL)animated
     
    41964222        [self presentTimePickerViewController:YES];
    41974223        break;
     4224    case InputType::Date:
     4225        [self presentDatePickerViewController:YES];
     4226        break;
    41984227    case InputType::None:
    41994228        break;
     
    42364265
    42374266    [_focusedFormControlViewController show:NO];
    4238     [self dismissTextInputViewController:YES];
    4239     [self dismissNumberPadViewController:YES];
    4240     [self dismissTimePickerViewController:YES];
     4267    [self dismissAllInputViewControllers];
    42414268}
    42424269
     
    43974424
    43984425    if ([_timePickerViewController handleWheelEvent:event])
     4426        return;
     4427
     4428    if ([_datePickerViewController handleWheelEvent:event])
    43994429        return;
    44004430
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r228523 r228557  
    737737                2E5C770F1FA7D429005932C3 /* APIAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E5C770D1FA7D429005932C3 /* APIAttachment.cpp */; };
    738738                2E7A944A1BBD97C300945547 /* _WKFocusedElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E7A94491BBD95C600945547 /* _WKFocusedElementInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
     739                2E94FC1620351A6D00974BA0 /* WKDatePickerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E94FC1420351A6D00974BA0 /* WKDatePickerViewController.h */; };
     740                2E94FC1720351A6D00974BA0 /* WKDatePickerViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E94FC1520351A6D00974BA0 /* WKDatePickerViewController.mm */; };
    739741                2EA7B3D12026CEF8009CE5AC /* WKNumberPadViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EA7B3CF2026CEF8009CE5AC /* WKNumberPadViewController.h */; };
    740742                2EA7B3D22026CEF8009CE5AC /* WKNumberPadViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EA7B3D02026CEF8009CE5AC /* WKNumberPadViewController.mm */; };
     
    31053107                2E5C770D1FA7D429005932C3 /* APIAttachment.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = APIAttachment.cpp; sourceTree = "<group>"; };
    31063108                2E7A94491BBD95C600945547 /* _WKFocusedElementInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKFocusedElementInfo.h; sourceTree = "<group>"; };
     3109                2E94FC1420351A6D00974BA0 /* WKDatePickerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKDatePickerViewController.h; path = ios/forms/WKDatePickerViewController.h; sourceTree = "<group>"; };
     3110                2E94FC1520351A6D00974BA0 /* WKDatePickerViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKDatePickerViewController.mm; path = ios/forms/WKDatePickerViewController.mm; sourceTree = "<group>"; };
    31073111                2EA7B3CF2026CEF8009CE5AC /* WKNumberPadViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKNumberPadViewController.h; path = ios/forms/WKNumberPadViewController.h; sourceTree = "<group>"; };
    31083112                2EA7B3D02026CEF8009CE5AC /* WKNumberPadViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKNumberPadViewController.mm; path = ios/forms/WKNumberPadViewController.mm; sourceTree = "<group>"; };
     
    83848388                                C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */,
    83858389                                C5FA1ED218E1062200B3F402 /* WKAirPlayRoutePicker.mm */,
     8390                                2E94FC1420351A6D00974BA0 /* WKDatePickerViewController.h */,
     8391                                2E94FC1520351A6D00974BA0 /* WKDatePickerViewController.mm */,
    83868392                                A58B6F0618FCA733008CBA53 /* WKFileUploadPanel.h */,
    83878393                                A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */,
     
    94119417                                37A709A71E3EA0FD00CA5969 /* WKDataDetectorTypes.h in Headers */,
    94129418                                37A709A91E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h in Headers */,
     9419                                2E94FC1620351A6D00974BA0 /* WKDatePickerViewController.h in Headers */,
    94139420                                377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */,
    94149421                                8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */,
     
    1110811115                                512F58F912A88A5400629530 /* WKCredential.cpp in Sources */,
    1110911116                                BC4075F7124FF0270068F20A /* WKData.cpp in Sources */,
     11117                                2E94FC1720351A6D00974BA0 /* WKDatePickerViewController.mm in Sources */,
    1111011118                                1AFF49001833DE78009AB15A /* WKDeprecatedFunctions.cpp in Sources */,
    1111111119                                BC4075F9124FF0270068F20A /* WKDictionary.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.