WebKit Bugzilla
Attachment 359583 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]
Patch for landing
bug-193565-20190118204017.patch (text/plain), 21.04 KB, created by
Ryosuke Niwa
on 2019-01-18 20:40:17 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2019-01-18 20:40:17 PST
Size:
21.04 KB
patch
obsolete
>Subversion Revision: 240031 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9d1cb04083a5b819e1bb38e8b84502540c6ccc2d..f2aa90a167f20cf1d3ae16cb0acaa302dfba5c4f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-01-18 Ryosuke Niwa <rniwa@webkit.org> >+ >+ iOS: Updating input mode should update the software keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=193565 >+ <rdar://problem/47376334> >+ >+ Reviewed by Wenson Hsieh. >+ >+ Let the chrome client know that the focused element's inputmode had changed. >+ >+ Test: fast/forms/ios/inputmode-none-removed.html >+ >+ * html/HTMLElement.cpp: >+ (WebCore::HTMLElement::parseAttribute): >+ * page/ChromeClient.h: >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 9c02605b04a1070dbbcce824e1795c0077f73e43..a4d8d0fc9c3a31edad0f9b94c335363491235642 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,33 @@ >+2019-01-18 Ryosuke Niwa <rniwa@webkit.org> >+ >+ iOS: Updating input mode should update the software keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=193565 >+ <rdar://problem/47376334> >+ >+ Reviewed by Wenson Hsieh. >+ >+ Update the software keyboard when the inputmode content attribute on the focused element had been mutated. >+ >+ * Scripts/webkit/messages.py: >+ * Shared/WebCoreArgumentCoders.h: >+ * UIProcess/PageClient.h: >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ * UIProcess/ios/PageClientImplIOS.h: >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::focusedElementDidChangeInputMode): >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _didUpdateInputMode:]): >+ * UIProcess/ios/WebPageProxyIOS.mm: >+ (WebKit::WebPageProxy::focusedElementDidChangeInputMode): >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::focusedElementDidChangeInputMode): >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::focusedElementDidChangeInputMode): >+ * WebProcess/WebPage/WebPage.h: >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp >index 82b371e37d73001da736cd62c83e4d47fbe35f49..796e42d66778005f6380666954be521cd0fccde2 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,14 @@ void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& > setTabIndexExplicitly(optionalTabIndex.value()); > return; > } >+ >+ if (name == inputmodeAttr) { >+ auto& document = this->document(); >+ if (this == document.focusedElement()) { >+ if (auto* page = document.page()) >+ 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 32040e15bf8505e70096cb653ddeea77f634caaf..a75d97c706b991db7f19d77487b1cdc45999cfaf 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 c774bc41c8294f0811671d6b74ca86d48ee17944..bfed964d7b2688d084a5280bc6ea5a4b27cb3f47 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 573aa75fd185a0585654ddd65e9a7aac7b510401..3ae7e475d8336efc27dcf2c51f722cc2db9845a6 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 007b28184f36af2abb95e32fe50e8ff915bed6dd..da9c775f00fdf686055be89c3d05a010b022d109 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 de98694aa37db3c7f2ce27cc829a9200211de10d..e7dd2e72a42f207b11f61ad32115e9ea1f5f8047 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 2d28ee18b69e8295c1f7a813f9cb471bdda48ff2..389a32bda14cd01db4c4b99cc24c694d1c1a5d9f 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 5da6f99bf524023303d871da07bf72e16afcb526..7420aaf6d2b89c71c46805f4f823be2db76fc79c 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 b237ef5052af375c1ec5647b7bdb281e07fa48bc..5d002666f2ee7eb2b3be54bc99f44339f671a12d 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 a7ffff78f30a70f4fc590d705a1d19e3a3881bef..d508a3e4ba7cd7ac82186e69a6c275a5a0c8437e 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 3e5292a78c2acf461a68293b3aac422c90d7b3c5..005b0fc4cb50b3e4d8c259bc5fc84786e74cfc54 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -4638,6 +4638,17 @@ - (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 b9bd70c9bee1069e1b4f123098b9cae12d6487c5..8a5302df11dc6b02d88c360b1d87472dff79800d 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 2bd16da826dfc4c567c170da11173ee8235bd2e8..6c8245fcdf8287ef7c57885be886c77d810a81c9 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 b1415d118cb83c1ccd7a41df199bbca80fab7251..38048be9d836e6870e7877eb69840969814d63e7 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 76203113d60545760989ebeda6127b25a8f602fd..216174bd59b72ea85e5adff411d7f3f9aa68d939 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(mode); >+#endif >+} >+ > void WebPage::didUpdateComposition() > { > sendEditorStateUpdate(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 715e124520ff076b960aed70e9b92075a6552aef..dda8e26e48a40b855821c776d7e538623a11cd30 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>&); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 173660a6d6d39314c27e7cb00e7b3c974ef2ca3e..2b9e92d04f3408e8d3fc66a46016f123a4c365b2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,21 @@ >+2019-01-18 Ryosuke Niwa <rniwa@webkit.org> >+ >+ iOS: Updating input mode should update the software keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=193565 >+ <rdar://problem/47376334> >+ >+ Reviewed by Wenson Hsieh. >+ >+ Added a regression test for removing inputmode content attribute with the value of "none". >+ >+ The test methodology is different between testRunner and in-browser since we don't force >+ software keyboard while running layout tests inside simulator which can elimiate >+ the visual viewport difference inside the test runner, and in-browser testing obviously >+ doesn't have access to the internal keyboard metrics. >+ >+ * fast/forms/ios/inputmode-none-removed-expected.txt: Added. >+ * fast/forms/ios/inputmode-none-removed.html: Added. >+ > 2019-01-15 Ryosuke Niwa <rniwa@webkit.org> > > VisualViewport API should be updated upon opening of keyboard >diff --git a/LayoutTests/fast/forms/ios/inputmode-none-removed-expected.txt b/LayoutTests/fast/forms/ios/inputmode-none-removed-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..810967ab5f71d2a565c44ff4dbfc511c7e7c1fa1 >--- /dev/null >+++ b/LayoutTests/fast/forms/ios/inputmode-none-removed-expected.txt >@@ -0,0 +1,16 @@ >+This tests updating inputmode of an input element from "none" to "text". The software keyboard should be updated. >+To manually test, focus the input element below. The software keyboard should show up after 3 seconds >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Element has inputmode=none >+PASS keyboardRect.height is 0 >+ >+inputmode has been removed >+PASS keyboardRect.height > 0 is true >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+ >diff --git a/LayoutTests/fast/forms/ios/inputmode-none-removed.html b/LayoutTests/fast/forms/ios/inputmode-none-removed.html >new file mode 100644 >index 0000000000000000000000000000000000000000..940197bc8faf8086f4f3c954742e4e2b7dfe6a0d >--- /dev/null >+++ b/LayoutTests/fast/forms/ios/inputmode-none-removed.html >@@ -0,0 +1,68 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+</head> >+<body> >+<input inputmode="none"> >+<div id="countdown"></div> >+<script> >+jsTestIsAsync = true; >+ >+description('This tests updating inputmode of an input element from "none" to "text". The software keyboard should be updated.<br>' >+ + 'To manually test, focus the input element below. The software keyboard should show up after 3 seconds'); >+ >+const input = document.querySelector("input"); >+if (!window.testRunner) { >+ input.addEventListener('focus', () => { >+ let countdown = 3; >+ const id = setInterval(() => { >+ document.getElementById('countdown').textContent = countdown ? countdown : ''; >+ if (!countdown) { >+ clearInterval(id); >+ input.removeAttribute('inputmode'); >+ } >+ countdown--; >+ }, 1000); >+ }); >+} >+ >+async function runTest() { >+ debug('Element has inputmode=none'); >+ >+ let didResize = () => { }; >+ window.visualViewport.addEventListener('resize', () => didResize()); >+ >+ if (window.testRunner) { >+ await UIHelper.activateFormControl(input); >+ window.keyboardRect = await UIHelper.inputViewBounds(); >+ shouldBe('keyboardRect.height', '0'); >+ } else { >+ await new Promise((resolve) => { didResize = resolve; }); >+ shouldBeTrue('document.documentElement.clientHeight - visualViewport.height < 100'); >+ } >+ >+ if (window.testRunner) >+ input.removeAttribute('inputmode'); >+ >+ await new Promise((resolve) => { didResize = resolve; }); >+ >+ debug(''); >+ debug('inputmode has been removed'); >+ >+ if (window.testRunner) { >+ window.keyboardRect = await UIHelper.inputViewBounds(); >+ shouldBeTrue('keyboardRect.height > 0'); >+ } else >+ shouldBeTrue('document.documentElement.clientHeight - visualViewport.height > 300'); >+ >+ finishJSTest(); >+} >+ >+window.onload = () => setTimeout(runTest, 0); >+ >+</script> >+</body> >+</html>
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