Changeset 247158 in webkit
- Timestamp:
- Jul 5, 2019 9:22:42 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247148 r247158 1 2019-07-05 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Touching media controls sometimes shows software keyboard 4 https://bugs.webkit.org/show_bug.cgi?id=199490 5 <rdar://problem/52076270> 6 7 Reviewed by Eric Carlson. 8 9 Adds a new layout test to verify that the keyboard only appears after a handled touch event if the focused 10 element is inside a hidden editable area; otherwise, the keyboard should not be present. 11 12 * fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart-expected.txt: Added. 13 * fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart.html: Added. 14 15 This test passes as long as we didn't begin showing the keyboard after tapping. 16 17 * fast/events/touch/ios/show-keyboard-after-preventing-touchstart-expected.txt: 18 * fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html: 19 20 Adjust this existing test to make the focused textarea hidden. 21 22 * resources/ui-helper.js: 23 (window.UIHelper.hasInputSession): 24 25 Add a new testing hook to check whether there is an active input session. 26 1 27 2019-07-05 Antoine Quint <graouts@apple.com> 2 28 -
trunk/LayoutTests/fast/events/touch/ios/show-keyboard-after-preventing-touchstart-expected.txt
r243044 r247158 1 1 2 Verifies that the keyboard shows up even after preventing default on touchstart . To manually test, tap the textarea; the textarea should remain focused, and the keyboard should appear.2 Verifies that the keyboard shows up even after preventing default on touchstart when focusing a hidden editable area. To manually test, tap the red box; the textarea should remain focused, and the keyboard should appear. 3 3 4 4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -
trunk/LayoutTests/fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
r243044 r247158 11 11 } 12 12 13 textarea {13 textarea, #target { 14 14 width: 100%; 15 15 height: 100px; 16 font-size: 50px; 17 text-align: center; 16 position: absolute; 17 top: 0; 18 } 19 20 #target { 21 background-color: tomato; 22 z-index: 1; 23 opacity: 0.25; 24 } 25 26 textarea { 27 opacity: 0; 28 } 29 30 #description { 31 margin-top: 100px; 18 32 } 19 33 </style> … … 21 35 <body> 22 36 <textarea></textarea> 37 <div id="target"></div> 23 38 <pre id="description"></pre> 24 39 <pre id="console"></pre> … … 27 42 jsTestIsAsync = true; 28 43 textarea = document.querySelector("textarea"); 44 target = document.getElementById("target"); 45 target.addEventListener("touchstart", event => event.preventDefault()); 29 46 30 description("Verifies that the keyboard shows up even after preventing default on touchstart . To manually test, tap the textarea; the textarea should remain focused, and the keyboard should appear.");47 description("Verifies that the keyboard shows up even after preventing default on touchstart when focusing a hidden editable area. To manually test, tap the red box; the textarea should remain focused, and the keyboard should appear."); 31 48 32 textarea.addEventListener("touchstart", event => event.preventDefault());33 49 addEventListener("load", async () => { 34 50 textarea.focus(); 35 await UIHelper.activateElementAndWaitForInputSession(t extarea);51 await UIHelper.activateElementAndWaitForInputSession(target); 36 52 testPassed("keyboard was shown."); 37 53 shouldBe("document.activeElement", "textarea"); -
trunk/LayoutTests/resources/ui-helper.js
r246817 r247158 373 373 } 374 374 375 static hasInputSession() 376 { 377 return new Promise(resolve => { 378 testRunner.runUIScript("uiController.hasInputSession", result => resolve(result === "true")); 379 }); 380 } 381 375 382 static isPresentingModally() 376 383 { -
trunk/Source/WebKit/ChangeLog
r247146 r247158 1 2019-07-05 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Touching media controls sometimes shows software keyboard 4 https://bugs.webkit.org/show_bug.cgi?id=199490 5 <rdar://problem/52076270> 6 7 Reviewed by Eric Carlson. 8 9 In r243044, we added a compatibility hack for Google Slides (and other G-suite properties) to allow the on- 10 screen keyboard to show up after a prevented touch event in the case where an element was already focused, even 11 if the touch event handler doesn't explicitly refocus the element. However, this means that if a regular text 12 field (or other form control) has been programmatically focused, then interacting with any other element that 13 prevents default on touchstart will cause us to show the keyboard for that focused element. 14 15 To mitigate this, only fall down this refocusing codepath in the case where the focused element is a hidden 16 editable element (in the style of many Google productivity web apps). For non-hidden editable elements that are 17 already focused, this refocusing logic is not necessary, since the user should be able to interact with the 18 control to show the keyboard anyways; for hidden editable areas, this compatibility hack is actually needed, 19 since there is typically no other way for a user to focus these elements and show an on-screen keyboard. 20 21 Tests: fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html 22 fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart.html 23 24 * WebProcess/WebPage/WebPage.cpp: 25 (WebKit::WebPage::dispatchTouchEvent): 26 * WebProcess/WebPage/WebPage.h: 27 * WebProcess/WebPage/ios/WebPageIOS.mm: 28 (WebKit::WebPage::isTransparentOrFullyClipped const): 29 30 Renamed from enclosingLayerIsTransparentOrFullyClipped, and pulled out into a private helper method. 31 32 (WebKit::WebPage::platformEditorState const): 33 (WebKit::WebPage::requestEvasionRectsAboveSelection): 34 (WebKit::WebPage::getFocusedElementInformation): 35 (WebKit::enclosingLayerIsTransparentOrFullyClipped): Deleted. 36 1 37 2019-07-04 Chris Dumez <cdumez@apple.com> 2 38 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r246938 r247158 2897 2897 auto newFocusedFrame = makeRefPtr(m_page->focusController().focusedFrame()); 2898 2898 auto newFocusedElement = makeRefPtr(newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr); 2899 if (oldFocusedElement == newFocusedElement )2899 if (oldFocusedElement == newFocusedElement && isTransparentOrFullyClipped(*newFocusedElement)) 2900 2900 elementDidRefocus(*newFocusedElement); 2901 2901 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r247027 r247158 1449 1449 #if PLATFORM(IOS_FAMILY) 1450 1450 void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData); 1451 bool isTransparentOrFullyClipped(const WebCore::Element&) const; 1451 1452 #endif 1452 1453 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r247145 r247158 186 186 } 187 187 188 static bool enclosingLayerIsTransparentOrFullyClipped(const RenderObject& renderer) 189 { 190 auto* enclosingLayer = renderer.enclosingLayer(); 188 bool WebPage::isTransparentOrFullyClipped(const Element& element) const 189 { 190 auto* renderer = element.renderer(); 191 if (!renderer) 192 return false; 193 194 auto* enclosingLayer = renderer->enclosingLayer(); 191 195 return enclosingLayer && enclosingLayer->isTransparentOrFullyClippedRespectingParentFrames(); 192 196 } … … 265 269 } 266 270 if (result.isContentEditable) { 267 auto container = makeRefPtr(selection.rootEditableElement()); 268 if (container && container->renderer()) 269 postLayoutData.editableRootIsTransparentOrFullyClipped = enclosingLayerIsTransparentOrFullyClipped(*container->renderer()); 271 if (auto container = makeRefPtr(selection.rootEditableElement())) 272 postLayoutData.editableRootIsTransparentOrFullyClipped = isTransparentOrFullyClipped(*container); 270 273 } 271 274 computeEditableRootHasContentAndPlainText(selection, postLayoutData); … … 1802 1805 } 1803 1806 1804 if (!m_focusedElement || !m_focusedElement->renderer() || enclosingLayerIsTransparentOrFullyClipped(*m_focusedElement->renderer())) {1807 if (!m_focusedElement || !m_focusedElement->renderer() || isTransparentOrFullyClipped(*m_focusedElement)) { 1805 1808 reply({ }); 1806 1809 return; … … 2992 2995 } 2993 2996 2994 if (m_focusedElement->document().quirks().shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() && m_focusedElement->renderer() && enclosingLayerIsTransparentOrFullyClipped(*m_focusedElement->renderer())) {2997 if (m_focusedElement->document().quirks().shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() && isTransparentOrFullyClipped(*m_focusedElement)) { 2995 2998 information.autocapitalizeType = AutocapitalizeTypeNone; 2996 2999 information.isAutocorrect = false; -
trunk/Tools/ChangeLog
r247143 r247158 1 2019-07-05 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Touching media controls sometimes shows software keyboard 4 https://bugs.webkit.org/show_bug.cgi?id=199490 5 <rdar://problem/52076270> 6 7 Reviewed by Eric Carlson. 8 9 Adds plumbing for a new testing hook to check whether or not there is an active input session. See other 10 ChangeLog entries for more detail. 11 12 * DumpRenderTree/ios/UIScriptControllerIOS.mm: 13 (WTR::UIScriptController::hasInputSession const): 14 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 15 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 16 (WTR::UIScriptController::hasInputSession const): 17 * TestRunnerShared/UIScriptContext/UIScriptController.h: 18 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 19 (WTR::UIScriptController::hasInputSession const): 20 1 21 2019-07-04 Aakash Jain <aakash_jain@apple.com> 2 22 -
trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
r244370 r247158 288 288 } 289 289 290 bool UIScriptController::hasInputSession() const 291 { 292 return false; 293 } 294 290 295 double UIScriptController::minimumZoomScale() const 291 296 { -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r244370 r247158 225 225 attribute object didHideKeyboardCallback; 226 226 readonly attribute boolean isShowingKeyboard; 227 readonly attribute boolean hasInputSession; 227 228 228 229 attribute object didShowMenuCallback; -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r246639 r247158 454 454 } 455 455 456 bool UIScriptController::hasInputSession() const 457 { 458 return false; 459 } 460 456 461 double UIScriptController::zoomScale() const 457 462 { -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r244370 r247158 164 164 165 165 bool isShowingKeyboard() const; 166 bool hasInputSession() const; 166 167 167 168 void setDidHideMenuCallback(JSValueRef); -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r245057 r247158 626 626 } 627 627 628 bool UIScriptController::hasInputSession() const 629 { 630 return TestController::singleton().mainWebView()->platformView().isInteractingWithFormControl; 631 } 632 628 633 void UIScriptController::applyAutocorrection(JSStringRef newString, JSStringRef oldString, JSValueRef callback) 629 634 {
Note: See TracChangeset
for help on using the changeset viewer.