WebKit Bugzilla
Attachment 359452 Details for
Bug 193565
: iOS: Updating input mode should update the software keyboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
wip193565.patch (text/plain), 13.11 KB, created by
Ryosuke Niwa
on 2019-01-17 22:43:25 PST
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2019-01-17 22:43:25 PST
Size:
13.11 KB
patch
obsolete
>diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp >index 82b371e37d7..5ec76bfd948 100644 >--- a/Source/WebCore/html/HTMLElement.cpp >+++ b/Source/WebCore/html/HTMLElement.cpp >@@ -29,6 +29,8 @@ > #include "CSSPropertyNames.h" > #include "CSSValueKeywords.h" > #include "CSSValuePool.h" >+#include "Chrome.h" >+#include "ChromeClient.h" > #include "DOMTokenList.h" > #include "DocumentFragment.h" > #include "ElementAncestorIterator.h" >@@ -448,6 +450,12 @@ void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& > setTabIndexExplicitly(optionalTabIndex.value()); > return; > } >+ >+ if (name == inputmodeAttr) { >+ auto& document = this->document(); >+ if (this == document.focusedElement()) >+ document.page()->chrome().client().focusedElementDidChangeInputMode(*this, canonicalInputMode()); >+ } > > auto& eventName = eventNameForEventHandlerAttribute(name); > if (!eventName.isNull()) >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index 32040e15bf8..a75d97c706b 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -34,6 +34,7 @@ > #include "HTMLMediaElementEnums.h" > #include "HostWindow.h" > #include "Icon.h" >+#include "InputMode.h" > #include "LayerFlushThrottleState.h" > #include "MediaProducer.h" > #include "PopupMenu.h" >@@ -292,7 +293,9 @@ public: > virtual void elementDidFocus(Element&) { } > virtual void elementDidBlur(Element&) { } > virtual void elementDidRefocus(Element&) { } >- >+ >+ virtual void focusedElementDidChangeInputMode(Element&, InputMode) { } >+ > virtual bool shouldPaintEntireContents() const { return false; } > virtual bool hasStablePageScaleFactor() const { return true; } > >diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py >index c774bc41c82..bfed964d7b2 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -407,6 +407,7 @@ def headers_for_type(type): > 'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'], > 'WebCore::Highlight': ['<WebCore/InspectorOverlay.h>'], > 'WebCore::IncludeSecureCookies': ['<WebCore/CookieJar.h>'], >+ 'WebCore::InputMode': ['<WebCore/InputMode.h>'], > 'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'], > 'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'], > 'WebCore::LockBackForwardList': ['<WebCore/FrameLoaderTypes.h>'], >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.h b/Source/WebKit/Shared/WebCoreArgumentCoders.h >index 573aa75fd18..3ae7e475d83 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -32,6 +32,7 @@ > #include <WebCore/DiagnosticLoggingClient.h> > #include <WebCore/FrameLoaderTypes.h> > #include <WebCore/IndexedDB.h> >+#include <WebCore/InputMode.h> > #include <WebCore/MediaSelectionOption.h> > #include <WebCore/NetworkLoadMetrics.h> > #include <WebCore/NotificationDirection.h> >@@ -766,6 +767,21 @@ template<> struct EnumTraits<WebCore::AutoplayEvent> { > >; > }; > >+template<> struct EnumTraits<WebCore::InputMode> { >+ using values = EnumValues< >+ WebCore::InputMode, >+ WebCore::InputMode::Unspecified, >+ WebCore::InputMode::None, >+ WebCore::InputMode::Text, >+ WebCore::InputMode::Telephone, >+ WebCore::InputMode::Url, >+ WebCore::InputMode::Email, >+ WebCore::InputMode::Numeric, >+ WebCore::InputMode::Decimal, >+ WebCore::InputMode::Search >+ >; >+}; >+ > template<> struct EnumTraits<WebCore::NetworkLoadPriority> { > using values = EnumValues< > WebCore::NetworkLoadPriority, >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index 007b28184f3..da9c775f00f 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -34,6 +34,7 @@ > #include <WebCore/AlternativeTextClient.h> > #include <WebCore/EditorClient.h> > #include <WebCore/FocusDirection.h> >+#include <WebCore/InputMode.h> > #include <WebCore/UserInterfaceLayoutDirection.h> > #include <WebCore/ValidationBubble.h> > #include <wtf/CompletionHandler.h> >@@ -369,6 +370,7 @@ public: > > virtual void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) = 0; > virtual void elementDidBlur() = 0; >+ virtual void focusedElementDidChangeInputMode(WebCore::InputMode) = 0; > virtual void didReceiveEditorStateUpdateAfterFocus() = 0; > virtual bool isFocusingElement() = 0; > virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, bool isCharEvent) = 0; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index de98694aa37..e7dd2e72a42 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -75,6 +75,7 @@ > #include <WebCore/FontAttributes.h> > #include <WebCore/FrameLoaderTypes.h> > #include <WebCore/FrameView.h> // FIXME: Move LayoutViewportConstraint to its own file and stop including this. >+#include <WebCore/InputMode.h> > #include <WebCore/LayoutPoint.h> > #include <WebCore/LayoutSize.h> > #include <WebCore/MediaPlaybackTargetContext.h> >@@ -1785,6 +1786,7 @@ private: > > void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData&); > void elementDidBlur(); >+ void focusedElementDidChangeInputMode(WebCore::InputMode); > void didReceiveEditorStateUpdateAfterFocus(); > > void showInspectorHighlight(const WebCore::Highlight&); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index 2d28ee18b69..389a32bda14 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -405,6 +405,7 @@ messages -> WebPageProxy { > > ElementDidFocus(struct WebKit::FocusedElementInformation information, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, WebKit::UserData userData) > ElementDidBlur() >+ FocusedElementDidChangeInputMode(enum:uint8_t WebCore::InputMode mode) > ScrollingNodeScrollWillStartScroll() > ScrollingNodeScrollDidEndScroll() > ShowInspectorHighlight(struct WebCore::Highlight highlight) >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index 5da6f99bf52..7420aaf6d2b 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >@@ -143,6 +143,7 @@ private: > > void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) override; > void elementDidBlur() override; >+ void focusedElementDidChangeInputMode(WebCore::InputMode) override; > void didReceiveEditorStateUpdateAfterFocus() override; > bool isFocusingElement() override; > void selectionDidChange() override; >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index b237ef5052a..5d002666f2e 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -547,6 +547,11 @@ void PageClientImpl::elementDidBlur() > [m_contentView _elementDidBlur]; > } > >+void PageClientImpl::focusedElementDidChangeInputMode(WebCore::InputMode mode) >+{ >+ [m_contentView _didUpdateInputMode:mode]; >+} >+ > void PageClientImpl::didReceiveEditorStateUpdateAfterFocus() > { > [m_contentView _didReceiveEditorStateUpdateAfterFocus]; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index a7ffff78f30..d508a3e4ba7 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -388,6 +388,7 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (void)_disableDoubleTapGesturesDuringTapIfNecessary:(uint64_t)requestID; > - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject; > - (void)_elementDidBlur; >+- (void)_didUpdateInputMode:(WebCore::InputMode)mode; > - (void)_didReceiveEditorStateUpdateAfterFocus; > - (void)_selectionChanged; > - (void)_updateChangedSelection; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 3e5292a78c2..42d0be7fb69 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -4638,6 +4638,18 @@ - (void)_elementDidBlur > } > } > >+- (void)_didUpdateInputMode:(WebCore::InputMode)mode >+{ >+ if (!self.inputDelegate || _focusedElementInformation.elementType == WebKit::InputType::None) >+ return; >+ >+#if !PLATFORM(WATCHOS) >+ _focusedElementInformation.inputMode = mode; >+ [self reloadInputViews]; >+#endif >+} >+ >+ > - (void)_didReceiveEditorStateUpdateAfterFocus > { > [self _updateInitialWritingDirectionIfNecessary]; >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index b9bd70c9bee..8a5302df11d 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -920,6 +920,11 @@ void WebPageProxy::elementDidBlur() > pageClient().elementDidBlur(); > } > >+void WebPageProxy::focusedElementDidChangeInputMode(WebCore::InputMode mode) >+{ >+ pageClient().focusedElementDidChangeInputMode(mode); >+} >+ > void WebPageProxy::autofillLoginCredentials(const String& username, const String& password) > { > m_process->send(Messages::WebPage::AutofillLoginCredentials(username, password), m_pageID); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 2bd16da826d..6c8245fcdf8 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -213,6 +213,11 @@ void WebChromeClient::elementDidBlur(Element& element) > m_page.elementDidBlur(element); > } > >+void WebChromeClient::focusedElementDidChangeInputMode(Element& element, InputMode mode) >+{ >+ m_page.focusedElementDidChangeInputMode(element, mode); >+} >+ > void WebChromeClient::makeFirstResponder() > { > m_page.send(Messages::WebPageProxy::MakeFirstResponder()); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index b1415d118cb..38048be9d83 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -275,6 +275,7 @@ private: > void elementDidFocus(WebCore::Element&) final; > void elementDidBlur(WebCore::Element&) final; > void elementDidRefocus(WebCore::Element&) final; >+ void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode) final; > > void makeFirstResponder() final; > void assistiveTechnologyMakeFirstResponder() final; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 76203113d60..5980eef7da0 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -172,6 +172,7 @@ > #include <WebCore/HTMLOListElement.h> > #include <WebCore/HTMLPlugInElement.h> > #include <WebCore/HTMLPlugInImageElement.h> >+#include <WebCore/HTMLTextAreaElement.h> > #include <WebCore/HTMLUListElement.h> > #include <WebCore/HistoryController.h> > #include <WebCore/HistoryItem.h> >@@ -5366,6 +5367,22 @@ void WebPage::elementDidBlur(WebCore::Element& element) > } > } > >+void WebPage::focusedElementDidChangeInputMode(WebCore::Element& element, WebCore::InputMode mode) >+{ >+#if PLATFORM(IOS_FAMILY) >+ ASSERT(m_focusedElement == &element); >+ ASSERT(element.canonicalInputMode() == mode); >+ >+ if (!is<HTMLTextAreaElement>(*m_focusedElement) && !is<HTMLInputElement>(*m_focusedElement) && !m_focusedElement->hasEditableStyle()) >+ return; >+ >+ send(Messages::WebPageProxy::FocusedElementDidChangeInputMode(mode)); >+#else >+ UNUSED_PARAM(element); >+ UNUSED_PARAM(element); >+#endif >+} >+ > void WebPage::didUpdateComposition() > { > sendEditorStateUpdate(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 715e124520f..dda8e26e48a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -589,6 +589,7 @@ public: > void elementDidFocus(WebCore::Element&); > void elementDidRefocus(WebCore::Element&); > void elementDidBlur(WebCore::Element&); >+ void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode); > void resetFocusedElementForFrame(WebFrame*); > > void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
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 193565
:
359452
|
359582
|
359583