WebKit Bugzilla
Attachment 360060 Details for
Bug 193798
: iOS: Split keyboard should not shrink visualViewport.height
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Test patch
193798-test.patch (text/plain), 8.72 KB, created by
Ryosuke Niwa
on 2019-01-24 17:28:04 PST
(
hide
)
Description:
Test patch
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2019-01-24 17:28:04 PST
Size:
8.72 KB
patch
obsolete
>commit 86a52559338239922cecf47ccb714a8b050bc354 >Author: Ryosuke Niwa <rniwa@webkit.org> >Date: Thu Jan 24 17:26:14 2019 -0800 > > Test for webkit.org/b/193798 > >diff --git a/LayoutTests/fast/visual-viewport/ipad/resize-event-for-keyboard-split-expected.txt b/LayoutTests/fast/visual-viewport/ipad/resize-event-for-keyboard-split-expected.txt >new file mode 100644 >index 00000000000..293c55da8e0 >--- /dev/null >+++ b/LayoutTests/fast/visual-viewport/ipad/resize-event-for-keyboard-split-expected.txt >@@ -0,0 +1,23 @@ >+This tests "resize" event on window.visualViewport and height getting updated upon keyboard splitting and undocking on iOS >+To manually test, tap the text field below to show the software keyboard, split the keyboard, then merge and dock it again. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS resizeCount is 0 >+PASS resizeCount is 1 >+PASS originalWidth is window.visualViewport.width >+PASS window.visualViewport.height is not originalHeight >+PASS window.visualViewport.height < originalHeight is true >+PASS resizeCount is 2 >+PASS originalWidth is window.visualViewport.width >+PASS window.visualViewport.height is originalHeight >+PASS window.visualViewport.height < originalHeight is false >+PASS resizeCount is 3 >+PASS originalWidth is window.visualViewport.width >+PASS window.visualViewport.height is not originalHeight >+PASS window.visualViewport.height < originalHeight is true >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/visual-viewport/ipad/resize-event-for-keyboard-split.html b/LayoutTests/fast/visual-viewport/ipad/resize-event-for-keyboard-split.html >new file mode 100644 >index 00000000000..990b21f40f5 >--- /dev/null >+++ b/LayoutTests/fast/visual-viewport/ipad/resize-event-for-keyboard-split.html >@@ -0,0 +1,74 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<head> >+<meta name="viewport" content="initial-scale=1, user-scalable=no"> >+</head> >+<body onload="runTest()"> >+<input type="text" onclick="didFocus()" placeholder="Tap here to open keyboard"> >+<script src="../../../resources/ui-helper.js"></script> >+<script src="../../../resources/js-test.js"></script> >+<script> >+description('This tests "resize" event on window.visualViewport and height getting updated upon keyboard splitting and undocking on iOS<br>' >+ + 'To manually test, tap the text field below to show the software keyboard, split the keyboard, then merge and dock it again.'); >+ >+jsTestIsAsync = true; >+ >+function didFocus() { } >+ >+async function runTest() { >+ if (window.testRunner) >+ await UIHelper.ensurePresentationUpdate(); >+ >+ window.originalWidth = window.visualViewport.width; >+ window.originalHeight = window.visualViewport.height; >+ window.resizeCount = 0; >+ let didResize = () => { }; >+ window.visualViewport.addEventListener('resize', () => { >+ resizeCount++; >+ didResize(); >+ }); >+ >+ shouldBe('resizeCount', '0'); >+ >+ const rect = document.querySelector('input').getBoundingClientRect(); >+ >+ if (window.testRunner) { >+ await UIHelper.activateAndWaitForInputSessionAt(rect.left + 5, rect.top + 5); >+ await UIHelper.ensurePresentationUpdate(); >+ } else { >+ await new Promise((resolve) => { >+ window.didFocus = () => setTimeout(resolve, 500); >+ }); >+ } >+ >+ shouldBe('resizeCount', '1'); >+ shouldBe('originalWidth', 'window.visualViewport.width'); >+ shouldNotBe('window.visualViewport.height', 'originalHeight'); >+ shouldBeTrue('window.visualViewport.height < originalHeight'); >+ >+ let waitForResize = new Promise((resolve) => didResize = resolve); >+ if (window.testRunner) >+ await UIHelper.splitAndUndockKeyboard(true); >+ await waitForResize; >+ >+ shouldBe('resizeCount', '2'); >+ shouldBe('originalWidth', 'window.visualViewport.width'); >+ shouldBe('window.visualViewport.height', 'originalHeight'); >+ shouldBeFalse('window.visualViewport.height < originalHeight'); >+ >+ waitForResize = new Promise((resolve) => didResize = resolve); >+ if (window.testRunner) >+ await UIHelper.splitAndUndockKeyboard(false); >+ await waitForResize; >+ >+ shouldBe('resizeCount', '3'); >+ shouldBe('originalWidth', 'window.visualViewport.width'); >+ shouldNotBe('window.visualViewport.height', 'originalHeight'); >+ shouldBeTrue('window.visualViewport.height < originalHeight'); >+ >+ finishJSTest(); >+} >+ >+</script> >+</body> >+</html> >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 1884db76596..f4b27c6ca96 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -200,6 +200,16 @@ window.UIHelper = class UIHelper { > }); > } > >+ static async splitAndUndockKeyboard(split) >+ { >+ // Keyboard doesn't like getting its style changed right away. Wait 0.5s to make it work reliably. >+ await new Promise((resolve) => setTimeout(resolve, 500)); >+ await new Promise((resolve) => { >+ testRunner.runUIScript(`uiController.splitAndUndockKeyboard(${split});`, resolve); >+ }); >+ await UIHelper.ensurePresentationUpdate(); >+ } >+ > static getUICaretRect() > { > if (!this.isWebKit2() || !this.isIOS()) >diff --git a/Source/WebKit/Platform/spi/ios/UIKitSPI.h b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >index d4479068b85..277bc82ad0d 100644 >--- a/Source/WebKit/Platform/spi/ios/UIKitSPI.h >+++ b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >@@ -159,6 +159,8 @@ typedef NS_ENUM(NSInteger, UIPreviewItemType) { > WTF_EXTERN_C_BEGIN > typedef struct __IOHIDEvent* IOHIDEventRef; > typedef struct __GSKeyboard* GSKeyboardRef; >+ >+void UIKeyboardSetSplitAndUndocked(BOOL splitAndUndock); > WTF_EXTERN_C_END > > @interface UIApplication () >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index 8a1125f4ef9..0d3d0ece1cc 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -244,6 +244,10 @@ void UIScriptController::keyboardAccessoryBarPrevious() > { > } > >+void UIScriptController::splitAndUndockKeyboard(bool) >+{ >+} >+ > void UIScriptController::applyAutocorrection(JSStringRef, JSStringRef, JSValueRef) > { > } >diff --git a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >index 5424ba8a8cf..ab387fe7588 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >+++ b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >@@ -211,6 +211,8 @@ interface UIScriptController { > void keyboardAccessoryBarNext(); > void keyboardAccessoryBarPrevious(); > >+ void splitAndUndockKeyboard(boolean split); >+ > void applyAutocorrection(DOMString newString, DOMString oldString, object callback); > > // Returned object is a dictionary with the passed in string as a key for returned object >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index a5baa06cd53..dee49fec985 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -366,6 +366,10 @@ void UIScriptController::keyboardAccessoryBarPrevious() > { > } > >+void UIScriptController::splitAndUndockKeyboard(bool) >+{ >+} >+ > void UIScriptController::applyAutocorrection(JSStringRef, JSStringRef, JSValueRef) > { > } >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index d3fb1cbb092..0ba9e031df5 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -97,6 +97,8 @@ public: > void keyboardAccessoryBarNext(); > void keyboardAccessoryBarPrevious(); > >+ void splitAndUndockKeyboard(bool split); >+ > void applyAutocorrection(JSStringRef newString, JSStringRef oldString, JSValueRef callback); > > void dismissFormAccessoryView(); >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index 4aa94290578..9fd60c77339 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -529,6 +529,12 @@ void UIScriptController::keyboardAccessoryBarPrevious() > [webView keyboardAccessoryBarPrevious]; > } > >+void UIScriptController::splitAndUndockKeyboard(bool split) >+{ >+ // FIXME: Reset the keyboard state after each test. >+ UIKeyboardSetSplitAndUndocked(split); >+} >+ > bool UIScriptController::isShowingKeyboard() const > { > return TestController::singleton().mainWebView()->platformView().showingKeyboard;
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 193798
:
360049
| 360060