WebKit Bugzilla
Attachment 368715 Details for
Bug 197474
: Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197474-20190501143913.patch (text/plain), 23.86 KB, created by
Daniel Bates
on 2019-05-01 14:39:13 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-05-01 14:39:13 PDT
Size:
23.86 KB
patch
obsolete
>Subversion Revision: 244742 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index dcb5cf3c13c0cd7f1ebdc6ff7ca01e51debf9199..16b2b339f351899da03e5ce2c938ac0dbdbaadd1 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-05-01 Daniel Bates <dabates@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 NOBODY (OOPS!). >+ >+ 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-04-29 Chris Dumez <cdumez@apple.com> > > User-facing strings should use curly quotes instead of straight >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 664099d47ae525c19250f2a6eeedc721971db7d2..784f67d8a7119981fa27d7a3a3b20a4d853547a3 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,66 @@ >+2019-05-01 Daniel Bates <dabates@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 NOBODY (OOPS!). >+ >+ 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 needsToDeferUpdateTextCandidateView]): Added. >+ (-[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-04-19 Daniel Bates <dabates@apple.com> > > Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect: >diff --git a/Source/WebCore/dom/KeyboardEvent.cpp b/Source/WebCore/dom/KeyboardEvent.cpp >index 23de812c55d0d3fbb19b0567f28f6c7c0b3fefc3..4ec6c9e9251e198317c305d678c3a482c6bcfb5d 100644 >--- a/Source/WebCore/dom/KeyboardEvent.cpp >+++ b/Source/WebCore/dom/KeyboardEvent.cpp >@@ -107,8 +107,10 @@ inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<Win > , 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) >+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) > , m_handledByInputMethod(key.handledByInputMethod()) >+#endif >+#if USE(APPKIT) > , m_keypressCommands(key.commands()) > #endif > { >diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h >index 519b6cd77e8970a7e17918deb2c7769c278b7801..b7a02a90349fe1730bc733d1a98409a534c9b53f 100644 >--- a/Source/WebCore/platform/PlatformKeyboardEvent.h >+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h >@@ -53,9 +53,6 @@ namespace WebCore { > 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 @@ namespace WebCore { > #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 @@ namespace WebCore { > 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 @@ namespace WebCore { > #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; >diff --git a/Source/WebKit/Platform/spi/ios/UIKitSPI.h b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >index d867fa1e86c0bac57ad09853c6b671f64072f2e6..c262b37ff81d23eed22b46b2cd2129a16eed2c71 100644 >--- a/Source/WebKit/Platform/spi/ios/UIKitSPI.h >+++ b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >@@ -386,6 +386,10 @@ typedef enum { > @property (nonatomic, retain) UIColor *selectionHighlightColor; > @end > >+@protocol UITextInputDelegatePrivate >+- (void)layoutHasChanged; >+@end >+ > @class UITextInputArrowKeyHistory; > > @protocol UITextInputPrivate <UITextInput, UITextInputTokenizer, UITextInputTraits_Private> >@@ -1121,6 +1125,7 @@ typedef NS_OPTIONS(NSInteger, UIWKDocumentRequestFlags) { > - (void)prepareKeyboardInputModeFromPreferences:(UIKeyboardInputMode *)lastUsedMode; > - (BOOL)handleKeyTextCommandForCurrentEvent; > - (BOOL)handleKeyAppCommandForCurrentEvent; >+- (BOOL)handleKeyInputMethodCommandForCurrentEvent; > @property (nonatomic, readonly) UIKeyboardInputMode *currentInputModeInPreference; > @end > >diff --git a/Source/WebKit/Shared/NativeWebKeyboardEvent.h b/Source/WebKit/Shared/NativeWebKeyboardEvent.h >index 0a8c93b680f9535f5966afb545cc5ef450df4cf6..c0a64e362961bd6ea14ab139a904789a1b0be661 100644 >--- a/Source/WebKit/Shared/NativeWebKeyboardEvent.h >+++ b/Source/WebKit/Shared/NativeWebKeyboardEvent.h >@@ -65,12 +65,14 @@ namespace WebKit { > 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) >diff --git a/Source/WebKit/Shared/WebEvent.h b/Source/WebKit/Shared/WebEvent.h >index ed408fe7f3a30a08dbf4f7ffb90e1cecfd59ec42..28286f6cc62a991c95eb6f4ad43af6492032af9d 100644 >--- a/Source/WebKit/Shared/WebEvent.h >+++ b/Source/WebKit/Shared/WebEvent.h >@@ -259,7 +259,7 @@ public: > #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 @@ public: > 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 @@ private: > 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) >diff --git a/Source/WebKit/Shared/WebEventConversion.cpp b/Source/WebKit/Shared/WebEventConversion.cpp >index 153de819f33ddf903504db724faa84ebf04a8169..9631d422e999e369544aad56f62b618ce33c4090 100644 >--- a/Source/WebKit/Shared/WebEventConversion.cpp >+++ b/Source/WebKit/Shared/WebEventConversion.cpp >@@ -221,8 +221,10 @@ public: > #endif > m_keyIdentifier = webEvent.keyIdentifier(); > m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode(); >-#if USE(APPKIT) || PLATFORM(GTK) >+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) > m_handledByInputMethod = webEvent.handledByInputMethod(); >+#endif >+#if USE(APPKIT) || PLATFORM(GTK) > m_commands = webEvent.commands(); > #endif > m_autoRepeat = webEvent.isAutoRepeat(); >diff --git a/Source/WebKit/Shared/WebKeyboardEvent.cpp b/Source/WebKit/Shared/WebKeyboardEvent.cpp >index 30b3f6848d9f023c92b49a4f6f3fffbf22d21084..a5a23cf148ef7297f7fdd1f9fec61fe1fe7353e7 100644 >--- a/Source/WebKit/Shared/WebKeyboardEvent.cpp >+++ b/Source/WebKit/Shared/WebKeyboardEvent.cpp >@@ -83,7 +83,7 @@ WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& > > #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 @@ WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& > , 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 @@ void WebKeyboardEvent::encode(IPC::Encoder& encoder) const > encoder << m_windowsVirtualKeyCode; > encoder << m_nativeVirtualKeyCode; > encoder << m_macCharCode; >-#if USE(APPKIT) || PLATFORM(GTK) >+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) > encoder << m_handledByInputMethod; >+#endif >+#if USE(APPKIT) || PLATFORM(GTK) > encoder << m_commands; > #endif > encoder << m_isAutoRepeat; >@@ -200,9 +205,11 @@ bool WebKeyboardEvent::decode(IPC::Decoder& decoder, WebKeyboardEvent& result) > 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 >diff --git a/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm b/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm >index ccceb9a789a2249a37470f8a17dc7a978fa949cb..d046fda3a4b6fa5051ab56c82ee6b1deea0d7b55 100644 >--- a/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm >+++ b/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm >@@ -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) > { > } >diff --git a/Source/WebKit/Shared/ios/WebIOSEventFactory.h b/Source/WebKit/Shared/ios/WebIOSEventFactory.h >index 8579c334fac22707079af2fa3fd94413532396a3..138feaa25192c1a738d4bb94039ce3a86fa6e2cd 100644 >--- a/Source/WebKit/Shared/ios/WebIOSEventFactory.h >+++ b/Source/WebKit/Shared/ios/WebIOSEventFactory.h >@@ -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>); >diff --git a/Source/WebKit/Shared/ios/WebIOSEventFactory.mm b/Source/WebKit/Shared/ios/WebIOSEventFactory.mm >index 25c16ec2252d450694cc823749571ed20fbd0a47..9d0a09767c37c8ce84792f57d66893fe5a922ade 100644 >--- a/Source/WebKit/Shared/ios/WebIOSEventFactory.mm >+++ b/Source/WebKit/Shared/ios/WebIOSEventFactory.mm >@@ -64,7 +64,7 @@ static OptionSet<WebKit::WebEvent::Modifier> modifiersForEvent(::WebEvent *event > 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 @@ WebKit::WebKeyboardEvent WebIOSEventFactory::createWebKeyboardEvent(::WebEvent * > 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) >diff --git a/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm b/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm >index 48ba280e3a84c1d3a87c4358438b9cbe099bcc99..3c5cad8302953a09e07574b04fbf94a89a91d885 100644 >--- a/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm >+++ b/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm >@@ -58,7 +58,7 @@ void WebAutomationSession::sendSynthesizedEventsToPage(WebPageProxy& page, NSArr > > case WebEventKeyDown: > case WebEventKeyUp: >- page.handleKeyboardEvent(NativeWebKeyboardEvent(event)); >+ page.handleKeyboardEvent(NativeWebKeyboardEvent(event, NativeWebKeyboardEvent::HandledByInputMethod::No)); > break; > } > } >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index 107a27976d9df7286b3659eacc070c8dd95825dd..4aed1a8ca520ae3ec6a861c257cd336cf5a0868e 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -323,6 +323,10 @@ struct WKAutoCorrectionData { > > BOOL _keyboardDidRequestDismissal; > >+#if USE(UIKIT_KEYBOARD_ADDITIONS) >+ BOOL _candidateViewNeedsUpdate; >+#endif >+ > BOOL _becomingFirstResponder; > BOOL _resigningFirstResponder; > BOOL _needsDeferredEndScrollingSelectionUpdate; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 0cfad5f7b3a705d8c2d6e21c0ed14a89a25e9925..056c1e98b75b39a79207c78a86ca0efa967bf6a5 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -833,6 +833,10 @@ - (void)cleanupInteraction > > _focusRequiresStrongPasswordAssistance = NO; > >+#if USE(UIKIT_KEYBOARD_ADDITIONS) >+ _candidateViewNeedsUpdate = NO; >+#endif >+ > if (_interactionViewsContainerView) { > [self.layer removeObserver:self forKeyPath:@"transform"]; > [_interactionViewsContainerView removeFromSuperview]; >@@ -4021,6 +4025,9 @@ - (void)setMarkedTextStyle:(NSDictionary *)styleDictionary > > - (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()); > } >@@ -4404,6 +4411,7 @@ - (CGRect)rectContainingCaretSelection > } > > #if USE(UIKIT_KEYBOARD_ADDITIONS) >+ > - (void)modifierFlagsDidChangeFrom:(UIKeyModifierFlags)oldFlags to:(UIKeyModifierFlags)newFlags > { > auto dispatchSyntheticFlagsChangedEvents = [&] (UIKeyModifierFlags flags, bool keyDown) { >@@ -4420,6 +4428,12 @@ - (void)modifierFlagsDidChangeFrom:(UIKeyModifierFlags)oldFlags to:(UIKeyModifie > if (addedFlags) > dispatchSyntheticFlagsChangedEvents(addedFlags, true); > } >+ >+- (BOOL)needsToDeferUpdateTextCandidateView >+{ >+ return _candidateViewNeedsUpdate; >+} >+ > #endif > > // Web events. >@@ -4464,15 +4478,24 @@ - (void)handleKeyEvent:(::UIEvent *)event > > - (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 > { > [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 >@@ -5614,6 +5637,12 @@ - (void)_selectionChanged > if (_usingGestureForSelection) > [self _updateChangedSelection]; > >+#if USE(UIKIT_KEYBOARD_ADDITIONS) >+ if (_candidateViewNeedsUpdate && [self.inputDelegate respondsToSelector:@selector(layoutHasChanged)]) >+ [(id <UITextInputDelegatePrivate>)self.inputDelegate layoutHasChanged]; >+ _candidateViewNeedsUpdate = NO; >+#endif >+ > [_webView _didChangeEditorState]; > } > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm >index 2a4a1639c3a58e77fa0525f456bd1d1c2bf0d182..026d3eded7c2d097f52850a5c3b63f3fae8a6829 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm >+++ b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm >@@ -44,7 +44,12 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) > > void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event) > { >+#if USE(UIKIT_KEYBOARD_ADDITIONS) >+ if (event->handledByInputMethod()) >+ event->setDefaultHandled(); >+#else > notImplemented(); >+#endif > } > > void WebEditorClient::setInsertionPasteboard(const String&)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197474
:
368715
|
368775
|
369009
|
369070