Title: [281610] trunk
Revision
281610
Author
[email protected]
Date
2021-08-25 18:38:24 -0700 (Wed, 25 Aug 2021)

Log Message

Remove some iOS-specific compile-time guards that are no longer needed
https://bugs.webkit.org/show_bug.cgi?id=229500

Reviewed by Tim Horton.

Source/WebCore:

See WebKit/ChangeLog for more details.

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* platform/PlatformKeyboardEvent.h:
* platform/ios/KeyEventIOS.mm:
(WebCore::isFunctionKey):

Source/WebKit:

Remove two compile-time flags that were no longer necessary after WebKit's minimum supported iOS version became
iOS 14: `USE(UIKIT_KEYBOARD_ADDITIONS)` and `HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)`.

`HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)` was only needed for a workaround in our test infrastructure,
while `USE(UIKIT_KEYBOARD_ADDITIONS)` was only introduced to maintain basic hardware keyboard functionality in
iOS 12, while supporting improvements to hardware keyboard support in iOS 13.

The latter now only guards `PLATFORM(IOS) || PLATFORM(MACCATALYST)`. However, there's no reason the codepaths
for hardware keyboard support can't exist on watchOS as well (especially since most of hardware keyboard
support is already implemented there -- just unreachable because it's not possible to attach a hardware keyboard
to an Apple watch). We can remove this feature flag, and simply delete code that was formerly guarded by
`!USE(UIKIT_KEYBOARD_ADDITIONS)`.

* Platform/spi/ios/UIKitSPI.h:
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
(WebKit::WebKeyboardEvent::encode const):
(WebKit::WebKeyboardEvent::decode):
* Shared/WebKeyboardEvent.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _disableAutomaticKeyboardUI]):
(-[WKContentView _requiresKeyboardWhenFirstResponder]):
(-[WKContentView applyAutocorrection:toString:withCompletionHandler:]):
(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
(-[WKContentView _didCommitLoadForMainFrame]):
(-[WKContentView _setMarkedText:highlights:selectedRange:]):
(-[WKContentView textInputTraits]):
(-[WKContentView _handleKeyUIEvent:]):
(-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
(-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
(-[WKContentView _elementDidBlur]):
(-[WKContentView _hardwareKeyboardAvailabilityChanged]):
(-[WKContentView _selectionChanged]):
(-[WKContentView keyCommands]): Deleted.
(-[WKContentView handleKeyEvent:]): Deleted.
* UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h:
* UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm:
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectPopover initWithView:hasGroups:]):
(-[WKSelectTableViewController hasText]): Deleted.
(-[WKSelectTableViewController insertText:]): Deleted.
(-[WKSelectTableViewController deleteBackward]): Deleted.
* WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
(WebKit::WebEditorClient::handleInputMethodKeydown):

Source/WTF:

Remove the feature flags. See WebKit/ChangeLog for more details.

* wtf/PlatformHave.h:
* wtf/PlatformUse.h:

Tools:

Remove this workaround, which was only required to keep an API test passing on iOS 13.

* WebKitTestRunner/TestController.h:
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(overrideKeyboardDelegateSupportsImagePaste): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (281609 => 281610)


--- trunk/Source/WTF/ChangeLog	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WTF/ChangeLog	2021-08-26 01:38:24 UTC (rev 281610)
@@ -1,3 +1,15 @@
+2021-08-25  Wenson Hsieh  <[email protected]>
+
+        Remove some iOS-specific compile-time guards that are no longer needed
+        https://bugs.webkit.org/show_bug.cgi?id=229500
+
+        Reviewed by Tim Horton.
+
+        Remove the feature flags. See WebKit/ChangeLog for more details.
+
+        * wtf/PlatformHave.h:
+        * wtf/PlatformUse.h:
+
 2021-08-24  Yusuke Suzuki  <[email protected]>
 
         [JSC] Add Intl Enumeration APIs

Modified: trunk/Source/WTF/wtf/PlatformHave.h (281609 => 281610)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -85,10 +85,6 @@
 #define HAVE_AVSTREAMSESSION 1
 #endif
 
-#if !defined(USE_UIKIT_KEYBOARD_ADDITIONS) && (PLATFORM(IOS) || PLATFORM(MACCATALYST))
-#define USE_UIKIT_KEYBOARD_ADDITIONS 1
-#endif
-
 #if !defined(HAVE_ACCESSIBILITY) && (PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(WPE))
 #define HAVE_ACCESSIBILITY 1
 #endif
@@ -732,10 +728,6 @@
 #define HAVE_DISPLAY_LAYER_BIPLANAR_SUPPORT 1
 #endif
 
-#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000
-#define HAVE_NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY 1
-#endif
-
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
 #define HAVE_LOGGING_PRIVACY_LEVEL 1
 #endif

Modified: trunk/Source/WTF/wtf/PlatformUse.h (281609 => 281610)


--- trunk/Source/WTF/wtf/PlatformUse.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WTF/wtf/PlatformUse.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -123,10 +123,6 @@
 #define USE_WEB_THREAD 1
 #endif
 
-#if !defined(USE_UIKIT_KEYBOARD_ADDITIONS) && (PLATFORM(IOS) || PLATFORM(MACCATALYST))
-#define USE_UIKIT_KEYBOARD_ADDITIONS 1
-#endif
-
 #if OS(UNIX)
 #define USE_PTHREADS 1
 #endif

Modified: trunk/Source/WebCore/ChangeLog (281609 => 281610)


--- trunk/Source/WebCore/ChangeLog	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebCore/ChangeLog	2021-08-26 01:38:24 UTC (rev 281610)
@@ -1,3 +1,18 @@
+2021-08-25  Wenson Hsieh  <[email protected]>
+
+        Remove some iOS-specific compile-time guards that are no longer needed
+        https://bugs.webkit.org/show_bug.cgi?id=229500
+
+        Reviewed by Tim Horton.
+
+        See WebKit/ChangeLog for more details.
+
+        * dom/KeyboardEvent.cpp:
+        (WebCore::KeyboardEvent::KeyboardEvent):
+        * platform/PlatformKeyboardEvent.h:
+        * platform/ios/KeyEventIOS.mm:
+        (WebCore::isFunctionKey):
+
 2021-08-25  Eric Carlson  <[email protected]>
 
         [GPUP] RemoteAudioSession doesn't implement begin/endInterruption

Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (281609 => 281610)


--- trunk/Source/WebCore/dom/KeyboardEvent.cpp	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp	2021-08-26 01:38:24 UTC (rev 281610)
@@ -112,7 +112,7 @@
     , m_location(keyLocationCode(key))
     , m_repeat(key.isAutoRepeat())
     , m_isComposing(view && is<DOMWindow>(view->window()) && downcast<DOMWindow>(*view->window()).frame() && downcast<DOMWindow>(*view->window()).frame()->editor().hasComposition())
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY)
     , m_handledByInputMethod(key.handledByInputMethod())
 #endif
 #if USE(APPKIT)

Modified: trunk/Source/WebCore/platform/PlatformKeyboardEvent.h (281609 => 281610)


--- trunk/Source/WebCore/platform/PlatformKeyboardEvent.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebCore/platform/PlatformKeyboardEvent.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -90,7 +90,7 @@
         int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
         void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; }
 
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
         bool handledByInputMethod() const { return m_handledByInputMethod; }
 #endif
 #if PLATFORM(GTK) || USE(LIBWPE)
@@ -159,7 +159,7 @@
         int m_windowsVirtualKeyCode { 0 };
 
         bool m_isSyntheticEvent { false };
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
         bool m_handledByInputMethod { false };
 #endif
 #if PLATFORM(GTK) || USE(LIBWPE)

Modified: trunk/Source/WebCore/platform/ios/KeyEventIOS.mm (281609 => 281610)


--- trunk/Source/WebCore/platform/ios/KeyEventIOS.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebCore/platform/ios/KeyEventIOS.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -274,14 +274,6 @@
 static bool isFunctionKey(UChar charCode)
 {
     switch (charCode) {
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-    case 1: // Home
-    case 4: // End
-    case 5: // FIXME: For some reason WebKitTestRunner generates this code for F14 (why?).
-    case 0x7F: // Forward Delete
-    case 0x10: // Function key (e.g. F1, F2, ...)
-#endif
-
     // WebKit uses Unicode PUA codes in the OpenStep reserve range for some special keys.
     case NSUpArrowFunctionKey:
     case NSDownArrowFunctionKey:
@@ -290,18 +282,14 @@
     case NSPageUpFunctionKey:
     case NSPageDownFunctionKey:
     case NSClearLineFunctionKey: // Num Lock / Clear
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     case NSDeleteFunctionKey: // Forward delete
     case NSEndFunctionKey:
     case NSInsertFunctionKey:
     case NSHomeFunctionKey:
-#endif
         return true;
     }
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if (charCode >= NSF1FunctionKey && charCode <= NSF24FunctionKey)
         return true;
-#endif
     return false;
 }
 

Modified: trunk/Source/WebKit/ChangeLog (281609 => 281610)


--- trunk/Source/WebKit/ChangeLog	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/ChangeLog	2021-08-26 01:38:24 UTC (rev 281610)
@@ -1,3 +1,61 @@
+2021-08-25  Wenson Hsieh  <[email protected]>
+
+        Remove some iOS-specific compile-time guards that are no longer needed
+        https://bugs.webkit.org/show_bug.cgi?id=229500
+
+        Reviewed by Tim Horton.
+
+        Remove two compile-time flags that were no longer necessary after WebKit's minimum supported iOS version became
+        iOS 14: `USE(UIKIT_KEYBOARD_ADDITIONS)` and `HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)`.
+
+        `HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)` was only needed for a workaround in our test infrastructure,
+        while `USE(UIKIT_KEYBOARD_ADDITIONS)` was only introduced to maintain basic hardware keyboard functionality in
+        iOS 12, while supporting improvements to hardware keyboard support in iOS 13.
+
+        The latter now only guards `PLATFORM(IOS) || PLATFORM(MACCATALYST)`. However, there's no reason the codepaths
+        for hardware keyboard support can't exist on watchOS as well (especially since most of hardware keyboard
+        support is already implemented there -- just unreachable because it's not possible to attach a hardware keyboard
+        to an Apple watch). We can remove this feature flag, and simply delete code that was formerly guarded by
+        `!USE(UIKIT_KEYBOARD_ADDITIONS)`.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
+        * Shared/WebKeyboardEvent.cpp:
+        (WebKit::WebKeyboardEvent::WebKeyboardEvent):
+        (WebKit::WebKeyboardEvent::encode const):
+        (WebKit::WebKeyboardEvent::decode):
+        * Shared/WebKeyboardEvent.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView cleanUpInteraction]):
+        (-[WKContentView _disableAutomaticKeyboardUI]):
+        (-[WKContentView _requiresKeyboardWhenFirstResponder]):
+        (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]):
+        (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
+        (-[WKContentView _didCommitLoadForMainFrame]):
+        (-[WKContentView _setMarkedText:highlights:selectedRange:]):
+        (-[WKContentView textInputTraits]):
+        (-[WKContentView _handleKeyUIEvent:]):
+        (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
+        (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
+        (-[WKContentView _elementDidBlur]):
+        (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
+        (-[WKContentView _selectionChanged]):
+        (-[WKContentView keyCommands]): Deleted.
+        (-[WKContentView handleKeyEvent:]): Deleted.
+        * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h:
+        * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm:
+        * UIProcess/ios/forms/WKFormSelectPopover.mm:
+        (-[WKSelectPopover initWithView:hasGroups:]):
+        (-[WKSelectTableViewController hasText]): Deleted.
+        (-[WKSelectTableViewController insertText:]): Deleted.
+        (-[WKSelectTableViewController deleteBackward]): Deleted.
+        * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
+        (WebKit::WebEditorClient::handleInputMethodKeydown):
+
 2021-08-25  Simon Fraser  <[email protected]>
 
         Replace the uint64_t used to identify form submits with a strongly typed identifier

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (281609 => 281610)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -354,6 +354,10 @@
 + (UIKeyboardImpl *)activeInstance;
 + (UIKeyboardImpl *)sharedInstance;
 + (CGSize)defaultSizeForInterfaceOrientation:(UIInterfaceOrientation)orientation;
+- (BOOL)handleKeyTextCommandForCurrentEvent;
+- (BOOL)handleKeyAppCommandForCurrentEvent;
+- (BOOL)handleKeyInputMethodCommandForCurrentEvent;
+- (BOOL)isCallingInputDelegate;
 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags;
 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags withInputManagerHint:(NSString *)hint;
 - (BOOL)autocorrectSpellingEnabled;
@@ -540,9 +544,7 @@
 - (void)insertDictationResult:(NSArray *)dictationResult withCorrectionIdentifier:(id)correctionIdentifier;
 - (void)replaceRangeWithTextWithoutClosingTyping:(UITextRange *)range replacementText:(NSString *)text;
 - (void)setBottomBufferHeight:(CGFloat)bottomBuffer;
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
 - (void)modifierFlagsDidChangeFrom:(UIKeyModifierFlags)oldFlags to:(UIKeyModifierFlags)newFlags;
-#endif
 @property (nonatomic) UITextGranularity selectionGranularity;
 @required
 - (BOOL)hasContent;
@@ -1413,11 +1415,6 @@
 @interface UIKeyboardImpl (IPI)
 - (void)setInitialDirection;
 - (void)prepareKeyboardInputModeFromPreferences:(UIKeyboardInputMode *)lastUsedMode;
-- (BOOL)handleKeyTextCommandForCurrentEvent;
-- (BOOL)handleKeyAppCommandForCurrentEvent;
-- (BOOL)handleKeyInputMethodCommandForCurrentEvent;
-- (BOOL)isCallingInputDelegate;
-- (BOOL)delegateSupportsImagePaste;
 - (void)syncInputManagerToAcceptedAutocorrection:(TIKeyboardCandidate *)autocorrection forInput:(TIKeyboardInput *)inputEvent;
 @property (nonatomic, readonly) UIKeyboardInputMode *currentInputModeInPreference;
 @end

Modified: trunk/Source/WebKit/Shared/WebEventConversion.cpp (281609 => 281610)


--- trunk/Source/WebKit/Shared/WebEventConversion.cpp	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/Shared/WebEventConversion.cpp	2021-08-26 01:38:24 UTC (rev 281610)
@@ -223,7 +223,7 @@
         m_code = webEvent.code();
         m_keyIdentifier = webEvent.keyIdentifier();
         m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode();
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
         m_handledByInputMethod = webEvent.handledByInputMethod();
 #endif
 #if PLATFORM(GTK) || USE(LIBWPE)

Modified: trunk/Source/WebKit/Shared/WebKeyboardEvent.cpp (281609 => 281610)


--- trunk/Source/WebKit/Shared/WebKeyboardEvent.cpp	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/Shared/WebKeyboardEvent.cpp	2021-08-26 01:38:24 UTC (rev 281610)
@@ -91,9 +91,7 @@
     , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
     , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
     , m_macCharCode(macCharCode)
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     , m_handledByInputMethod(handledByInputMethod)
-#endif
     , m_isAutoRepeat(isAutoRepeat)
     , m_isKeypad(isKeypad)
     , m_isSystemKey(isSystemKey)
@@ -160,7 +158,7 @@
     encoder << m_windowsVirtualKeyCode;
     encoder << m_nativeVirtualKeyCode;
     encoder << m_macCharCode;
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
     encoder << m_handledByInputMethod;
 #endif
 #if PLATFORM(GTK) || USE(LIBWPE)
@@ -196,7 +194,7 @@
         return false;
     if (!decoder.decode(result.m_macCharCode))
         return false;
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
     if (!decoder.decode(result.m_handledByInputMethod))
         return false;
 #endif

Modified: trunk/Source/WebKit/Shared/WebKeyboardEvent.h (281609 => 281610)


--- trunk/Source/WebKit/Shared/WebKeyboardEvent.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/Shared/WebKeyboardEvent.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -61,7 +61,7 @@
     int32_t windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
     int32_t nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
     int32_t macCharCode() const { return m_macCharCode; }
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
     bool handledByInputMethod() const { return m_handledByInputMethod; }
 #endif
 #if PLATFORM(GTK) || USE(LIBWPE)
@@ -91,7 +91,7 @@
     int32_t m_windowsVirtualKeyCode { 0 };
     int32_t m_nativeVirtualKeyCode { 0 };
     int32_t m_macCharCode { 0 };
-#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
+#if USE(APPKIT) || PLATFORM(IOS_FAMILY) || PLATFORM(GTK) || USE(LIBWPE)
     bool m_handledByInputMethod { false };
 #endif
 #if PLATFORM(GTK) || USE(LIBWPE)

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentView.mm (281609 => 281610)


--- trunk/Source/WebKit/UIProcess/ios/WKContentView.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentView.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -152,8 +152,6 @@
     Vector<RetainPtr<NSURL>> _temporaryURLsToDeleteWhenDeallocated;
 }
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
-
 // Evernote expects to swizzle -keyCommands on WKContentView or they crash. Remove this hack
 // as soon as reasonably possible. See <rdar://problem/51759247>.
 static NSArray *keyCommandsPlaceholderHackForEvernote(id self, SEL _cmd)
@@ -163,8 +161,6 @@
     return reinterpret_cast<SuperKeyCommandsFunction>(&objc_msgSendSuper)(&super, @selector(keyCommands));
 }
 
-#endif
-
 - (instancetype)_commonInitializationWithProcessPool:(WebKit::WebProcessPool&)processPool configuration:(Ref<API::PageConfiguration>&&)configuration
 {
     ASSERT(_pageClient);
@@ -226,10 +222,8 @@
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_screenCapturedDidChange:) name:UIScreenCapturedDidChangeNotification object:[UIScreen mainScreen]];
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if (WebCore::IOSApplication::isEvernote() && !linkedOnOrAfter(WebCore::SDKVersion::FirstWhereWKContentViewDoesNotOverrideKeyCommands))
         class_addMethod(self.class, @selector(keyCommands), reinterpret_cast<IMP>(&keyCommandsPlaceholderHackForEvernote), method_getTypeEncoding(class_getInstanceMethod(self.class, @selector(keyCommands))));
-#endif
 
     return self;
 }

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (281609 => 281610)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -383,9 +383,6 @@
     WebKit::InteractionInformationAtPosition _positionInformation;
     WebKit::FocusedElementInformation _focusedElementInformation;
     RetainPtr<NSObject<WKFormPeripheral>> _inputPeripheral;
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-    RetainPtr<UIEvent> _uiEventBeingResent;
-#endif
     BlockPtr<void(::WebEvent *, BOOL)> _keyWebEventHandler;
 
     CGPoint _lastInteractionLocation;
@@ -436,10 +433,8 @@
 
     BOOL _keyboardDidRequestDismissal;
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     BOOL _candidateViewNeedsUpdate;
     BOOL _seenHardwareKeyDownInNonEditableElement;
-#endif
 
     BOOL _becomingFirstResponder;
     BOOL _resigningFirstResponder;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (281609 => 281610)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -172,10 +172,6 @@
 #import "WKFormColorControl.h"
 #endif
 
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-#import "WKWebEvent.h"
-#endif
-
 #if HAVE(PEPPER_UI_CORE)
 #import "PepperUICoreSPI.h"
 #endif
@@ -1084,10 +1080,8 @@
 
     _lastAutocorrectionContext = { };
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     _candidateViewNeedsUpdate = NO;
     _seenHardwareKeyDownInNonEditableElement = NO;
-#endif
 
     _textInteractionDidChangeFocusedElement = NO;
     _activeTextInteractionCount = 0;
@@ -2271,7 +2265,6 @@
     return NO;
 }
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
 - (BOOL)_disableAutomaticKeyboardUI
 {
     // Always enable automatic keyboard UI if we are not the first responder to avoid
@@ -2278,16 +2271,11 @@
     // interfering with other focused views (e.g. Find-in-page).
     return [self isFirstResponder] && ![self shouldShowAutomaticKeyboardUI];
 }
-#endif
 
 - (BOOL)_requiresKeyboardWhenFirstResponder
 {
     // FIXME: We should add the logic to handle keyboard visibility during focus redirects.
-    return [self _shouldShowAutomaticKeyboardUIIgnoringInputMode]
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
-        || _seenHardwareKeyDownInNonEditableElement
-#endif
-        ;
+    return [self _shouldShowAutomaticKeyboardUIIgnoringInputMode] || _seenHardwareKeyDownInNonEditableElement;
 }
 
 - (BOOL)_requiresKeyboardResetOnReload
@@ -4625,13 +4613,11 @@
 // The completion handler should pass the rect of the correction text after replacing the input text, or nil if the replacement could not be performed.
 - (void)applyAutocorrection:(NSString *)correction toString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForCorrection))completionHandler
 {
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if ([self _disableAutomaticKeyboardUI]) {
         if (completionHandler)
             completionHandler(nil);
         return;
     }
-#endif
 
     // FIXME: Remove the synchronous call when <rdar://problem/16207002> is fixed.
     const bool useSyncRequest = true;
@@ -4666,12 +4652,10 @@
         return;
     }
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if ([self _disableAutomaticKeyboardUI]) {
         completionHandler(WKAutocorrectionContext.emptyAutocorrectionContext);
         return;
     }
-#endif
 
     if (!_page->hasRunningProcess()) {
         completionHandler(WKAutocorrectionContext.emptyAutocorrectionContext);
@@ -4769,9 +4753,8 @@
 
 - (void)_didCommitLoadForMainFrame
 {
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     _seenHardwareKeyDownInNonEditableElement = NO;
-#endif
+
     [self _elementDidBlur];
     [self _cancelLongPressGestureRecognizer];
     [self _removeContainerForContextMenuHintPreviews];
@@ -4789,20 +4772,6 @@
 #endif
 }
 
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-- (NSArray *)keyCommands
-{
-    if (!_page->editorState().isContentEditable)
-        return nil;
-
-    static NeverDestroyed<RetainPtr<NSArray>> editableKeyCommands = @[
-        [UIKeyCommand keyCommandWithInput:@"\t" modifierFlags:0 action:@selector(_nextAccessoryTab:)],
-        [UIKeyCommand keyCommandWithInput:@"\t" modifierFlags:UIKeyModifierShift action:@selector(_previousAccessoryTab:)]
-    ];
-    return editableKeyCommands.get().get();
-}
-#endif
-
 - (void)_nextAccessoryTabForWebView:(id)sender
 {
     [self accessoryTab:YES];
@@ -5210,9 +5179,7 @@
 
 - (void)_setMarkedText:(NSString *)markedText highlights:(const Vector<WebCore::CompositionHighlight>&)highlights selectedRange:(NSRange)selectedRange
 {
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     _candidateViewNeedsUpdate = !self.hasMarkedText;
-#endif
     _markedText = markedText;
     _page->setCompositionAsync(markedText, { }, highlights, selectedRange, { });
 }
@@ -5494,11 +5461,9 @@
     if (!_traits)
         _traits = adoptNS([[UITextInputTraits alloc] init]);
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     // Do not change traits when dismissing the keyboard.
     if (_isBlurringFocusedElement)
         return _traits.get();
-#endif
 
     [self _updateTextInputTraits:_traits.get()];
     return _traits.get();
@@ -5793,8 +5758,6 @@
     _page->setShouldRevealCurrentSelectionAfterInsertion(true);
 }
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
-
 - (void)modifierFlagsDidChangeFrom:(UIKeyModifierFlags)oldFlags to:(UIKeyModifierFlags)newFlags
 {
     auto dispatchSyntheticFlagsChangedEvents = [&] (UIKeyModifierFlags flags, bool keyDown) {
@@ -5817,8 +5780,6 @@
     return _candidateViewNeedsUpdate;
 }
 
-#endif
-
 // Web events.
 - (BOOL)requiresKeyEvents
 {
@@ -5835,15 +5796,11 @@
             if ([_inputPeripheral handleKeyEvent:event])
                 return;
         }
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
         if (!_seenHardwareKeyDownInNonEditableElement) {
             _seenHardwareKeyDownInNonEditableElement = YES;
             [self reloadInputViews];
         }
         [super _handleKeyUIEvent:event];
-#else
-        [self handleKeyEvent:event];
-#endif
         return;
     }
 
@@ -5855,19 +5812,6 @@
     _page->generateSyntheticEditingCommand(command);
 }
 
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-- (void)handleKeyEvent:(::UIEvent *)event
-{
-    // WebCore has already seen the event, no need for custom processing.
-    if (event == _uiEventBeingResent)
-        return;
-
-    auto webEvent = adoptNS([[WKWebEvent alloc] initWithEvent:event]);
-    
-    [self handleKeyWebEvent:webEvent.get()];
-}
-#endif
-
 - (void)handleKeyWebEvent:(::WebEvent *)theEvent
 {
     _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, WebKit::NativeWebKeyboardEvent::HandledByInputMethod::No));
@@ -5884,7 +5828,6 @@
     [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
 
     using HandledByInputMethod = WebKit::NativeWebKeyboardEvent::HandledByInputMethod;
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     auto* keyboard = [UIKeyboardImpl sharedInstance];
     if ((_page->editorState().isContentEditable || _treatAsContentEditableUntilNextEditorStateUpdate) && [keyboard handleKeyInputMethodCommandForCurrentEvent]) {
         completionHandler(theEvent, YES);
@@ -5891,7 +5834,7 @@
         _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, HandledByInputMethod::Yes));
         return;
     }
-#endif
+
     if (_page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, HandledByInputMethod::No)))
         _keyWebEventHandler = makeBlockPtr(completionHandler);
     else
@@ -5900,10 +5843,8 @@
 
 - (void)_didHandleKeyEvent:(::WebEvent *)event eventWasHandled:(BOOL)eventWasHandled
 {
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if ([event isKindOfClass:[WKSyntheticFlagsChangedWebEvent class]])
         return;
-#endif
 
     if (!(event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged))
         [_keyboardScrollingAnimator handleKeyEvent:event];
@@ -5912,27 +5853,6 @@
         handler(event, eventWasHandled);
         return;
     }
-
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-    // If we aren't interacting with editable content, we still need to call [super _handleKeyUIEvent:]
-    // so that keyboard repeat will work correctly. If we are interacting with editable content,
-    // we already did so in _handleKeyUIEvent.
-    if (eventWasHandled && _page->editorState().isContentEditable)
-        return;
-
-    if (![event isKindOfClass:[WKWebEvent class]])
-        return;
-
-    // Resending the event may destroy this WKContentView.
-    RetainPtr<WKContentView> protector(self);
-
-    // We keep here the event when resending it to the application to distinguish
-    // the case of a new event from one that has been already sent to WebCore.
-    ASSERT(!_uiEventBeingResent);
-    _uiEventBeingResent = [(WKWebEvent *)event uiEvent];
-    [super _handleKeyUIEvent:_uiEventBeingResent.get()];
-    _uiEventBeingResent = nil;
-#endif
 }
 
 - (BOOL)_interpretKeyEvent:(::WebEvent *)event isCharEvent:(BOOL)isCharEvent
@@ -6579,9 +6499,7 @@
 {
     SetForScope<BOOL> isBlurringFocusedElementForScope { _isBlurringFocusedElement, YES };
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     [self _endEditing];
-#endif
 
     [_formInputSession invalidate];
     _formInputSession = nil;
@@ -6603,12 +6521,10 @@
     _focusRequiresStrongPasswordAssistance = NO;
     _additionalContextForStrongPasswordAssistance = nil;
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     // When defocusing an editable element reset a seen keydown before calling -_hideKeyboard so that we
     // re-evaluate whether we still need a keyboard when UIKit calls us back in -_requiresKeyboardWhenFirstResponder.
     if (editableChanged)
         _seenHardwareKeyDownInNonEditableElement = NO;
-#endif
 
     [self _hideKeyboard];
 
@@ -6658,9 +6574,7 @@
 
 - (void)_hardwareKeyboardAvailabilityChanged
 {
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     _seenHardwareKeyDownInNonEditableElement = NO;
-#endif
     [self reloadInputViews];
 }
 
@@ -7229,13 +7143,11 @@
     if (_usingGestureForSelection)
         [self _updateChangedSelection];
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if (_candidateViewNeedsUpdate) {
         _candidateViewNeedsUpdate = NO;
         if ([self.inputDelegate respondsToSelector:@selector(layoutHasChanged)])
             [(id <UITextInputDelegatePrivate>)self.inputDelegate layoutHasChanged];
     }
-#endif
     
     [_webView _didChangeEditorState];
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h (281609 => 281610)


--- trunk/Source/WebKit/UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS) && PLATFORM(IOS_FAMILY)
+#if PLATFORM(IOS_FAMILY)
 
 #import <WebCore/WebEvent.h>
 
@@ -34,4 +34,4 @@
 
 @end
 
-#endif // USE(UIKIT_KEYBOARD_ADDITIONS) && PLATFORM(IOS_FAMILY)
+#endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm (281609 => 281610)


--- trunk/Source/WebKit/UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WKSyntheticFlagsChangedWebEvent.h"
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS) && PLATFORM(IOS_FAMILY)
+#if PLATFORM(IOS_FAMILY)
 
 #import <pal/spi/cocoa/IOKitSPI.h>
 #import <pal/spi/ios/GraphicsServicesSPI.h>
@@ -51,4 +51,4 @@
 
 @end
 
-#endif // USE(UIKIT_KEYBOARD_ADDITIONS) && PLATFORM(IOS_FAMILY)
+#endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm (281609 => 281610)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -79,11 +79,7 @@
 
 @class WKSelectPopover;
 
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
 @interface WKSelectTableViewController : UITableViewController
-#else
-@interface WKSelectTableViewController : UITableViewController <UIKeyInput>
-#endif
 {
     NSUInteger _singleSelectionIndex;
     NSUInteger _singleSelectionSection;
@@ -369,24 +365,6 @@
     return _contentView._shouldUseLegacySelectPopoverDismissalBehavior;
 }
 
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-#pragma mark UIKeyInput delegate methods
-
-- (BOOL)hasText
-{
-    return NO;
-}
-
-- (void)insertText:(NSString *)text
-{
-}
-
-- (void)deleteBackward
-{
-}
-
-#endif
-
 @end
 
 @implementation WKSelectPopover {
@@ -415,10 +393,6 @@
     self.popoverController = adoptNS([[UIPopoverController alloc] initWithContentViewController:popoverViewController.get()]).get();
     ALLOW_DEPRECATED_DECLARATIONS_END
 
-#if !USE(UIKIT_KEYBOARD_ADDITIONS)
-    [[UIKeyboardImpl sharedInstance] setDelegate:_tableViewController.get()];
-#endif
-    
     return self;
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm (281609 => 281610)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -44,13 +44,8 @@
 
 void WebEditorClient::handleInputMethodKeydown(KeyboardEvent& event)
 {
-#if USE(UIKIT_KEYBOARD_ADDITIONS)
     if (event.handledByInputMethod())
         event.setDefaultHandled();
-#else
-    notImplemented();
-    UNUSED_PARAM(event);
-#endif
 }
 
 void WebEditorClient::setInsertionPasteboard(const String&)

Modified: trunk/Tools/ChangeLog (281609 => 281610)


--- trunk/Tools/ChangeLog	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Tools/ChangeLog	2021-08-26 01:38:24 UTC (rev 281610)
@@ -1,3 +1,17 @@
+2021-08-25  Wenson Hsieh  <[email protected]>
+
+        Remove some iOS-specific compile-time guards that are no longer needed
+        https://bugs.webkit.org/show_bug.cgi?id=229500
+
+        Reviewed by Tim Horton.
+
+        Remove this workaround, which was only required to keep an API test passing on iOS 13.
+
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformResetStateToConsistentValues):
+        (overrideKeyboardDelegateSupportsImagePaste): Deleted.
+
 2021-08-25  Jonathan Bedard  <[email protected]>
 
         [git-webkit] Use Python 3 in CI

Modified: trunk/Tools/WebKitTestRunner/TestController.h (281609 => 281610)


--- trunk/Tools/WebKitTestRunner/TestController.h	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2021-08-26 01:38:24 UTC (rev 281610)
@@ -560,10 +560,7 @@
     Vector<std::unique_ptr<InstanceMethodSwizzler>> m_inputModeSwizzlers;
     RetainPtr<UIKeyboardInputMode> m_overriddenKeyboardInputMode;
     Vector<std::unique_ptr<InstanceMethodSwizzler>> m_presentPopoverSwizzlers;
-#if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
-    std::unique_ptr<InstanceMethodSwizzler> m_keyboardDelegateSupportsImagePasteSwizzler;
 #endif
-#endif
 
     enum State {
         Initial,

Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (281609 => 281610)


--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2021-08-26 00:47:59 UTC (rev 281609)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2021-08-26 01:38:24 UTC (rev 281610)
@@ -62,15 +62,6 @@
 {
 }
 
-#if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
-
-static BOOL overrideKeyboardDelegateSupportsImagePaste(id, SEL)
-{
-    return NO;
-}
-
-#endif
-
 namespace WTR {
 
 static bool isDoneWaitingForKeyboardToDismiss = true;
@@ -197,12 +188,6 @@
     // FIXME: Investigate whether this can be removed. The swizzled return value is inconsistent with GSEventSetHardwareKeyboardAttached.
     method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
 
-#if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
-    // FIXME: Remove this workaround once -[UIKeyboardImpl delegateSupportsImagePaste] no longer increments the general pasteboard's changeCount.
-    if (!m_keyboardDelegateSupportsImagePasteSwizzler)
-        m_keyboardDelegateSupportsImagePasteSwizzler = makeUnique<InstanceMethodSwizzler>(UIKeyboardImpl.class, @selector(delegateSupportsImagePaste), reinterpret_cast<IMP>(overrideKeyboardDelegateSupportsImagePaste));
-#endif
-
     if (m_overriddenKeyboardInputMode) {
         m_overriddenKeyboardInputMode = nil;
         m_inputModeSwizzlers.clear();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to