Diff
Modified: trunk/Source/WebCore/ChangeLog (244974 => 244975)
--- trunk/Source/WebCore/ChangeLog 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebCore/ChangeLog 2019-05-06 20:41:02 UTC (rev 244975)
@@ -1,3 +1,18 @@
+2019-05-06 Daniel Bates <daba...@apple.com>
+
+ Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard
+ https://bugs.webkit.org/show_bug.cgi?id=197474
+ <rdar://problem/47219324>
+
+ Reviewed by Ryosuke Niwa.
+
+ Fix up some #if defs to compile more Mac code when building on iOS.
+
+ * dom/KeyboardEvent.cpp:
+ (WebCore::KeyboardEvent::KeyboardEvent):
+ * platform/PlatformKeyboardEvent.h:
+ (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+
2019-05-06 Chris Dumez <cdu...@apple.com>
Add assertions to CachedFrame to help figure out crash in CachedFrame constructor
Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (244974 => 244975)
--- trunk/Source/WebCore/dom/KeyboardEvent.cpp 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp 2019-05-06 20:41:02 UTC (rev 244975)
@@ -107,8 +107,10 @@
, 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)
+ , m_handledByInputMethod(key.handledByInputMethod())
+#endif
#if USE(APPKIT)
- , m_handledByInputMethod(key.handledByInputMethod())
, m_keypressCommands(key.commands())
#endif
{
Modified: trunk/Source/WebCore/platform/PlatformKeyboardEvent.h (244974 => 244975)
--- trunk/Source/WebCore/platform/PlatformKeyboardEvent.h 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebCore/platform/PlatformKeyboardEvent.h 2019-05-06 20:41:02 UTC (rev 244975)
@@ -53,9 +53,6 @@
PlatformKeyboardEvent()
: PlatformEvent(PlatformEvent::KeyDown)
, m_windowsVirtualKeyCode(0)
-#if USE(APPKIT) || PLATFORM(GTK)
- , m_handledByInputMethod(false)
-#endif
, m_autoRepeat(false)
, m_isKeypad(false)
, m_isSystemKey(false)
@@ -84,9 +81,6 @@
#endif
, m_keyIdentifier(keyIdentifier)
, m_windowsVirtualKeyCode(windowsVirtualKeyCode)
-#if USE(APPKIT) || PLATFORM(GTK)
- , m_handledByInputMethod(false)
-#endif
, m_autoRepeat(isAutoRepeat)
, m_isKeypad(isKeypad)
, m_isSystemKey(isSystemKey)
@@ -122,7 +116,7 @@
int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; }
-#if USE(APPKIT) || PLATFORM(GTK)
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
bool handledByInputMethod() const { return m_handledByInputMethod; }
#endif
#if USE(APPKIT)
@@ -185,8 +179,8 @@
#endif
String m_keyIdentifier;
int m_windowsVirtualKeyCode;
-#if USE(APPKIT) || PLATFORM(GTK)
- bool m_handledByInputMethod;
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
+ bool m_handledByInputMethod { false };
#endif
#if USE(APPKIT)
Vector<KeypressCommand> m_commands;
Modified: trunk/Source/WebKit/ChangeLog (244974 => 244975)
--- trunk/Source/WebKit/ChangeLog 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/ChangeLog 2019-05-06 20:41:02 UTC (rev 244975)
@@ -1,3 +1,67 @@
+2019-05-06 Daniel Bates <daba...@apple.com>
+
+ Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard
+ https://bugs.webkit.org/show_bug.cgi?id=197474
+ <rdar://problem/47219324>
+
+ Reviewed by Ryosuke Niwa.
+
+ Adopt UIKit SPI (added in <rdar://problem/50181162>) to ask the Input Manager to handle
+ the key event. If the Input Manager handled it then we pass along this information to
+ WebCore, just as we do for Mac, so that it can alter its event handling logic. Otherwise,
+ we handle the event as we do now.
+
+ A large part of this patch is fixing up #if defs to compile more Mac code when building
+ on iOS.
+
+ * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
+ * Shared/NativeWebKeyboardEvent.h:
+ * Shared/WebEvent.h:
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
+ * Shared/WebKeyboardEvent.cpp:
+ (WebKit::WebKeyboardEvent::WebKeyboardEvent):
+ (WebKit::WebKeyboardEvent::encode const):
+ (WebKit::WebKeyboardEvent::decode):
+ * Shared/ios/NativeWebKeyboardEventIOS.mm:
+ (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
+ * Shared/ios/WebIOSEventFactory.h:
+ * Shared/ios/WebIOSEventFactory.mm:
+ (WebIOSEventFactory::createWebKeyboardEvent):
+ Compile more Mac code on iOS. Just like on Mac we maintain some bookkeeping on
+ whether an event was handled by the Input Manager.
+
+ * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
+ (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
+ to keep the behavior we have now.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView cleanupInteraction]):
+ (-[WKContentView shouldSuppressUpdateCandidateView]): Added. Used to tell UIKit whether to
+ suppress updating/showing the candidate view.
+ (-[WKContentView setMarkedText:selectedRange:]):
+ Bookkeeping to track whether we need to delay showing/updating the inline candidate view.
+ The concept in UIKit is deferment, but at the time of writing its simply a request to delay
+ the update for 0.4 seconds. We opt into this delay only for the first key that begins
+ marked text (i.e. the transition from no marked text to marked text). We do this because we
+ may not have up-to-date editor state at the time UIKit is ready to show/update the inline
+ candidate view for us to answer -textFirstRect and -textLastRect, which UIKit calls as part
+ of computing the frame rect for the inline candidate view on screen. Once we receive up-to-date
+ editor state, in -selectionChanged, we tell UIKit to layout the keyboard, which ultimately
+ causes it to re-compute the frame rect for the inline candidate view and show it.
+
+ (-[WKContentView handleKeyWebEvent:]): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
+ to keep the behavior we have now.
+ (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): Ask the keyboard to handle the
+ event using the Input Manager. If it was handled then there is no need to delay calling the
+ completion handler, call it, then tell the web process about the key event and that it was
+ already handled by the Input Manager.
+ (-[WKContentView _selectionChanged]): Tell the keyboard to update the candidate view, if needed.
+ * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
+ (WebKit::WebEditorClient::handleInputMethodKeydown): Mark the event as default handled if
+ the UI process told us that the event was handled by the Input Manager just like we do on Mac.
+
2019-05-06 Alex Christensen <achristen...@webkit.org>
Null check m_mainFrame in WebPageProxy.cpp
Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (244974 => 244975)
--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-05-06 20:41:02 UTC (rev 244975)
@@ -386,6 +386,10 @@
@property (nonatomic, retain) UIColor *selectionHighlightColor;
@end
+@protocol UITextInputDelegatePrivate
+- (void)layoutHasChanged;
+@end
+
@class UITextInputArrowKeyHistory;
@protocol UITextInputPrivate <UITextInput, UITextInputTokenizer, UITextInputTraits_Private>
@@ -1121,6 +1125,7 @@
- (void)prepareKeyboardInputModeFromPreferences:(UIKeyboardInputMode *)lastUsedMode;
- (BOOL)handleKeyTextCommandForCurrentEvent;
- (BOOL)handleKeyAppCommandForCurrentEvent;
+- (BOOL)handleKeyInputMethodCommandForCurrentEvent;
@property (nonatomic, readonly) UIKeyboardInputMode *currentInputModeInPreference;
@end
Modified: trunk/Source/WebKit/Shared/NativeWebKeyboardEvent.h (244974 => 244975)
--- trunk/Source/WebKit/Shared/NativeWebKeyboardEvent.h 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/NativeWebKeyboardEvent.h 2019-05-06 20:41:02 UTC (rev 244975)
@@ -65,12 +65,14 @@
class NativeWebKeyboardEvent : public WebKeyboardEvent {
public:
#if USE(APPKIT)
+ // FIXME: Share iOS's HandledByInputMethod enum here instead of passing a boolean.
NativeWebKeyboardEvent(NSEvent *, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>&);
#elif PLATFORM(GTK)
NativeWebKeyboardEvent(const NativeWebKeyboardEvent&);
NativeWebKeyboardEvent(GdkEvent*, const WebCore::CompositionResults&, InputMethodFilter::EventFakedForComposition, Vector<String>&& commands);
#elif PLATFORM(IOS_FAMILY)
- NativeWebKeyboardEvent(::WebEvent *);
+ enum class HandledByInputMethod : bool { No, Yes };
+ NativeWebKeyboardEvent(::WebEvent *, HandledByInputMethod);
#elif USE(LIBWPE)
NativeWebKeyboardEvent(struct wpe_input_keyboard_event*);
#elif PLATFORM(WIN)
Modified: trunk/Source/WebKit/Shared/WebEvent.h (244974 => 244975)
--- trunk/Source/WebKit/Shared/WebEvent.h 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/WebEvent.h 2019-05-06 20:41:02 UTC (rev 244975)
@@ -259,7 +259,7 @@
#elif PLATFORM(GTK)
WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, OptionSet<Modifier>, WallTime timestamp);
#elif PLATFORM(IOS_FAMILY)
- WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier>, WallTime timestamp);
+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier>, WallTime timestamp);
#elif USE(LIBWPE)
WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isKeypad, OptionSet<Modifier>, WallTime timestamp);
#else
@@ -278,7 +278,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) || PLATFORM(GTK)
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
bool handledByInputMethod() const { return m_handledByInputMethod; }
#endif
#if USE(APPKIT)
@@ -308,7 +308,7 @@
int32_t m_windowsVirtualKeyCode;
int32_t m_nativeVirtualKeyCode;
int32_t m_macCharCode;
-#if USE(APPKIT) || PLATFORM(GTK)
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
bool m_handledByInputMethod;
#endif
#if USE(APPKIT)
Modified: trunk/Source/WebKit/Shared/WebEventConversion.cpp (244974 => 244975)
--- trunk/Source/WebKit/Shared/WebEventConversion.cpp 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/WebEventConversion.cpp 2019-05-06 20:41:02 UTC (rev 244975)
@@ -221,8 +221,10 @@
#endif
m_keyIdentifier = webEvent.keyIdentifier();
m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode();
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
+ m_handledByInputMethod = webEvent.handledByInputMethod();
+#endif
#if USE(APPKIT) || PLATFORM(GTK)
- m_handledByInputMethod = webEvent.handledByInputMethod();
m_commands = webEvent.commands();
#endif
m_autoRepeat = webEvent.isAutoRepeat();
Modified: trunk/Source/WebKit/Shared/WebKeyboardEvent.cpp (244974 => 244975)
--- trunk/Source/WebKit/Shared/WebKeyboardEvent.cpp 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/WebKeyboardEvent.cpp 2019-05-06 20:41:02 UTC (rev 244975)
@@ -83,7 +83,7 @@
#elif PLATFORM(IOS_FAMILY)
-WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp)
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_text(text)
, m_unmodifiedText(unmodifiedText)
@@ -97,6 +97,9 @@
, 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)
@@ -166,8 +169,10 @@
encoder << m_windowsVirtualKeyCode;
encoder << m_nativeVirtualKeyCode;
encoder << m_macCharCode;
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
+ encoder << m_handledByInputMethod;
+#endif
#if USE(APPKIT) || PLATFORM(GTK)
- encoder << m_handledByInputMethod;
encoder << m_commands;
#endif
encoder << m_isAutoRepeat;
@@ -200,9 +205,11 @@
return false;
if (!decoder.decode(result.m_macCharCode))
return false;
-#if USE(APPKIT) || PLATFORM(GTK)
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
if (!decoder.decode(result.m_handledByInputMethod))
return false;
+#endif
+#if USE(APPKIT) || PLATFORM(GTK)
if (!decoder.decode(result.m_commands))
return false;
#endif
Modified: trunk/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm (244974 => 244975)
--- trunk/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm 2019-05-06 20:41:02 UTC (rev 244975)
@@ -34,8 +34,8 @@
namespace WebKit {
-NativeWebKeyboardEvent::NativeWebKeyboardEvent(::WebEvent *event)
- : WebKeyboardEvent(WebIOSEventFactory::createWebKeyboardEvent(event))
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(::WebEvent *event, HandledByInputMethod handledByInputMethod)
+ : WebKeyboardEvent(WebIOSEventFactory::createWebKeyboardEvent(event, handledByInputMethod == HandledByInputMethod::Yes))
, m_nativeEvent(event)
{
}
Modified: trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.h (244974 => 244975)
--- trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.h 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.h 2019-05-06 20:41:02 UTC (rev 244975)
@@ -33,7 +33,7 @@
class WebIOSEventFactory {
public:
- static WebKit::WebKeyboardEvent createWebKeyboardEvent(::WebEvent *);
+ static WebKit::WebKeyboardEvent createWebKeyboardEvent(::WebEvent *, bool handledByInputMethod);
static WebKit::WebMouseEvent createWebMouseEvent(::WebEvent *);
static UIKeyModifierFlags toUIKeyModifierFlags(OptionSet<WebKit::WebEvent::Modifier>);
Modified: trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm (244974 => 244975)
--- trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm 2019-05-06 20:41:02 UTC (rev 244975)
@@ -64,7 +64,7 @@
return modifiers;
}
-WebKit::WebKeyboardEvent WebIOSEventFactory::createWebKeyboardEvent(::WebEvent *event)
+WebKit::WebKeyboardEvent WebIOSEventFactory::createWebKeyboardEvent(::WebEvent *event, bool handledByInputMethod)
{
WebKit::WebEvent::Type type = (event.type == WebEventKeyUp) ? WebKit::WebEvent::KeyUp : WebKit::WebEvent::KeyDown;
String text;
@@ -109,7 +109,7 @@
unmodifiedText = text;
}
- return WebKit::WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, WallTime::fromRawSeconds(timestamp));
+ return WebKit::WebKeyboardEvent { type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, handledByInputMethod, autoRepeat, isKeypad, isSystemKey, modifiers, WallTime::fromRawSeconds(timestamp) };
}
WebKit::WebMouseEvent WebIOSEventFactory::createWebMouseEvent(::WebEvent *event)
Modified: trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm (244974 => 244975)
--- trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm 2019-05-06 20:41:02 UTC (rev 244975)
@@ -58,7 +58,7 @@
case WebEventKeyDown:
case WebEventKeyUp:
- page.handleKeyboardEvent(NativeWebKeyboardEvent(event));
+ page.handleKeyboardEvent(NativeWebKeyboardEvent(event, NativeWebKeyboardEvent::HandledByInputMethod::No));
break;
}
}
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (244974 => 244975)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2019-05-06 20:41:02 UTC (rev 244975)
@@ -324,6 +324,10 @@
BOOL _keyboardDidRequestDismissal;
+#if USE(UIKIT_KEYBOARD_ADDITIONS)
+ BOOL _candidateViewNeedsUpdate;
+#endif
+
BOOL _becomingFirstResponder;
BOOL _resigningFirstResponder;
BOOL _needsDeferredEndScrollingSelectionUpdate;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (244974 => 244975)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-05-06 20:41:02 UTC (rev 244975)
@@ -839,6 +839,10 @@
_focusRequiresStrongPasswordAssistance = NO;
+#if USE(UIKIT_KEYBOARD_ADDITIONS)
+ _candidateViewNeedsUpdate = NO;
+#endif
+
if (_interactionViewsContainerView) {
[self.layer removeObserver:self forKeyPath:@"transform"];
[_interactionViewsContainerView removeFromSuperview];
@@ -4040,6 +4044,9 @@
- (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRange
{
+#if USE(UIKIT_KEYBOARD_ADDITIONS)
+ _candidateViewNeedsUpdate = !self.hasMarkedText;
+#endif
_markedText = markedText;
_page->setCompositionAsync(markedText, Vector<WebCore::CompositionUnderline>(), selectedRange, WebKit::EditingRange());
}
@@ -4423,6 +4430,7 @@
}
#if USE(UIKIT_KEYBOARD_ADDITIONS)
+
- (void)modifierFlagsDidChangeFrom:(UIKeyModifierFlags)oldFlags to:(UIKeyModifierFlags)newFlags
{
auto dispatchSyntheticFlagsChangedEvents = [&] (UIKeyModifierFlags flags, bool keyDown) {
@@ -4439,6 +4447,12 @@
if (addedFlags)
dispatchSyntheticFlagsChangedEvents(addedFlags, true);
}
+
+- (BOOL)shouldSuppressUpdateCandidateView
+{
+ return _candidateViewNeedsUpdate;
+}
+
#endif
// Web events.
@@ -4483,7 +4497,7 @@
- (void)handleKeyWebEvent:(::WebEvent *)theEvent
{
- _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent));
+ _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, WebKit::NativeWebKeyboardEvent::HandledByInputMethod::No));
}
- (void)handleKeyWebEvent:(::WebEvent *)theEvent withCompletionHandler:(void (^)(::WebEvent *theEvent, BOOL wasHandled))completionHandler
@@ -4490,8 +4504,17 @@
{
[self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
+ using HandledByInputMethod = WebKit::NativeWebKeyboardEvent::HandledByInputMethod;
+#if USE(UIKIT_KEYBOARD_ADDITIONS)
+ auto* keyboard = [UIKeyboardImpl sharedInstance];
+ if ([keyboard respondsToSelector:@selector(handleKeyInputMethodCommandForCurrentEvent)] && [keyboard handleKeyInputMethodCommandForCurrentEvent]) {
+ completionHandler(theEvent, YES);
+ _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, HandledByInputMethod::Yes));
+ return;
+ }
+#endif
_keyWebEventHandler = makeBlockPtr(completionHandler);
- _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent));
+ _page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, HandledByInputMethod::No));
}
- (void)_didHandleKeyEvent:(::WebEvent *)event eventWasHandled:(BOOL)eventWasHandled
@@ -5633,6 +5656,14 @@
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/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm (244974 => 244975)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm 2019-05-06 20:39:28 UTC (rev 244974)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm 2019-05-06 20:41:02 UTC (rev 244975)
@@ -44,7 +44,12 @@
void WebEditorClient::handleInputMethodKeydown(KeyboardEvent&)
{
+#if USE(UIKIT_KEYBOARD_ADDITIONS)
+ if (event->handledByInputMethod())
+ event->setDefaultHandled();
+#else
notImplemented();
+#endif
}
void WebEditorClient::setInsertionPasteboard(const String&)