WebKit Bugzilla
Attachment 358506 Details for
Bug 193180
: Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-193180-20190107101245.patch (text/plain), 25.96 KB, created by
Wenson Hsieh
on 2019-01-07 10:12:46 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-07 10:12:46 PST
Size:
25.96 KB
patch
obsolete
>Subversion Revision: 239627 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7b30489104eecef630bacfe1e9d6f40d35208b38..8ec773dbabf14ae438d2335dfc1eed6597fc74d0 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2019-01-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net >+ https://bugs.webkit.org/show_bug.cgi?id=193180 >+ <rdar://problem/45971041> >+ >+ Reviewed by Tim Horton. >+ >+ Adjust a method on RenderObject to additionally detect when the RenderObject is inside of an `overflow: hidden` >+ container that is also empty. See WebKit ChangeLog for more details. >+ >+ Test: editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html >+ editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html >+ >+ * rendering/RenderObject.cpp: >+ (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const): >+ (WebCore::RenderObject::isTransparentRespectingParentFrames const): Deleted. >+ * rendering/RenderObject.h: >+ > 2019-01-04 Wenson Hsieh <wenson_hsieh@apple.com> > > [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 22635b0c328c66f18d037993385b3908d545728c..9a66097a43fc5f8de43d258d3be601337fb12451 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,55 @@ >+2019-01-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net >+ https://bugs.webkit.org/show_bug.cgi?id=193180 >+ <rdar://problem/45971041> >+ >+ Reviewed by Tim Horton. >+ >+ JSFiddle uses CodeMirror; CodeMirror's editor works by capturing keystrokes and input in a hidden textarea >+ element, and then drawing its own selection caret using web content. This textarea is hidden by being placed >+ underneath an empty div with `overflow: hidden;`. >+ >+ When requesting desktop site on iOS, both CodeMirror's caret and the native iOS caret are shown because iOS >+ selection UI consists of native views overlaid on the page, whereas on macOS, the entire textarea (along with >+ the caret) are occluded by the hidden overflow container. Additionally, various iOS behaviors related to >+ selection and editing, such as zooming to reveal the focused element and showing the platform callout bar, are >+ active when focusing this hidden editable area; these don't work as intended, and just interfere with the page's >+ custom editing UI. >+ >+ To fix this, we augment the text interaction suppression mechanism added in r238146 to detect when the focused >+ element is in an empty `overflow: hidden` container, and bail out of native text editing behaviors. >+ >+ * Shared/EditorState.cpp: >+ (WebKit::EditorState::PostLayoutData::encode const): >+ (WebKit::EditorState::PostLayoutData::decode): >+ * Shared/EditorState.h: >+ >+ Rename elementIsTransparent to elementIsTransparentOrFullyClipped. >+ >+ * Shared/FocusedElementInformation.cpp: >+ (WebKit::FocusedElementInformation::encode const): >+ (WebKit::FocusedElementInformation::decode): >+ * Shared/FocusedElementInformation.h: >+ * UIProcess/ios/WKContentViewInteraction.h: >+ >+ Rename FocusedElementIsTransparent to FocusedElementIsTransparentOrFullyClipped. >+ >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _zoomToRevealFocusedElement]): >+ (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): >+ (-[WKContentView _elementDidBlur]): >+ >+ Make an additional tweak here to only stop suppressing text interaction assistant in `-_elementDidBlur` if we're >+ not also in the middle of changing the focused element. Without this, focusing a hidden editable element while >+ another hidden editable element is currently focused causes us to zoom to reveal the newly focused hidden >+ editable element, when we should be avoiding this behavior. >+ >+ (-[WKContentView _updateChangedSelection:]): >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::platformEditorState const): >+ (WebKit::WebPage::getFocusedElementInformation): >+ > 2019-01-04 Wenson Hsieh <wenson_hsieh@apple.com> > > [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index bc283e263b1c1593a7a232a38e455079c9ee0e97..676017c4c6c77a07b22739f0d567315f276be064 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -1514,7 +1514,7 @@ void RenderObject::destroy() > delete this; > } > >-bool RenderObject::isTransparentRespectingParentFrames() const >+bool RenderObject::isTransparentOrFullyClippedRespectingParentFrames() const > { > static const double minimumVisibleOpacity = 0.01; > >@@ -1522,7 +1522,13 @@ bool RenderObject::isTransparentRespectingParentFrames() const > auto* layer = enclosingLayer(); > while (layer) { > auto& layerRenderer = layer->renderer(); >- currentOpacity *= layerRenderer.style().opacity(); >+ auto& style = layerRenderer.style(); >+ if (auto* box = layer->renderBox()) { >+ bool isOverflowHidden = style.overflowX() == Overflow::Hidden || style.overflowY() == Overflow::Hidden; >+ if (isOverflowHidden && !box->isDocumentElementRenderer() && box->contentSize().isEmpty()) >+ return true; >+ } >+ currentOpacity *= style.opacity(); > if (currentOpacity < minimumVisibleOpacity) > return true; > >diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h >index 0dd0a509c468694ffe8f3ab5edcaf6adc3890d6b..97cc0faf9c62ce87d0c38e3cc728d5780499a38e 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -797,7 +797,7 @@ public: > void initializeFragmentedFlowStateOnInsertion(); > virtual void insertedIntoTree(); > >- WEBCORE_EXPORT bool isTransparentRespectingParentFrames() const; >+ WEBCORE_EXPORT bool isTransparentOrFullyClippedRespectingParentFrames() const; > > protected: > ////////////////////////////////////////// >diff --git a/Source/WebKit/Shared/EditorState.cpp b/Source/WebKit/Shared/EditorState.cpp >index e30e939c02a7abccdfce67b0390ce719fb78b5d1..896c03bede1a2c39d9c532814779eadb06cf7add 100644 >--- a/Source/WebKit/Shared/EditorState.cpp >+++ b/Source/WebKit/Shared/EditorState.cpp >@@ -130,7 +130,7 @@ void EditorState::PostLayoutData::encode(IPC::Encoder& encoder) const > encoder << isStableStateUpdate; > encoder << insideFixedPosition; > encoder << hasPlainText; >- encoder << elementIsTransparent; >+ encoder << elementIsTransparentOrFullyClipped; > encoder << caretColor; > #endif > #if PLATFORM(MAC) >@@ -187,7 +187,7 @@ bool EditorState::PostLayoutData::decode(IPC::Decoder& decoder, PostLayoutData& > return false; > if (!decoder.decode(result.hasPlainText)) > return false; >- if (!decoder.decode(result.elementIsTransparent)) >+ if (!decoder.decode(result.elementIsTransparentOrFullyClipped)) > return false; > if (!decoder.decode(result.caretColor)) > return false; >diff --git a/Source/WebKit/Shared/EditorState.h b/Source/WebKit/Shared/EditorState.h >index e314d0ae5a0150627a3b212a2c4e450e3d2d2920..0cc25cd8127e9d7ad3ee694d1d20f4827fcaa387 100644 >--- a/Source/WebKit/Shared/EditorState.h >+++ b/Source/WebKit/Shared/EditorState.h >@@ -107,7 +107,7 @@ struct EditorState { > bool isStableStateUpdate { false }; > bool insideFixedPosition { false }; > bool hasPlainText { false }; >- bool elementIsTransparent { false }; >+ bool elementIsTransparentOrFullyClipped { false }; > WebCore::Color caretColor; > #endif > #if PLATFORM(MAC) >diff --git a/Source/WebKit/Shared/FocusedElementInformation.cpp b/Source/WebKit/Shared/FocusedElementInformation.cpp >index 9ee815f42d64b0688969b38341ac44470585c122..4c5b72c8b3641007b92f44e4d005ada7e7783a55 100644 >--- a/Source/WebKit/Shared/FocusedElementInformation.cpp >+++ b/Source/WebKit/Shared/FocusedElementInformation.cpp >@@ -91,7 +91,7 @@ void FocusedElementInformation::encode(IPC::Encoder& encoder) const > encoder << title; > encoder << acceptsAutofilledLoginCredentials; > encoder << isAutofillableUsernameField; >- encoder << elementIsTransparent; >+ encoder << elementIsTransparentOrFullyClipped; > encoder << representingPageURL; > encoder.encodeEnum(autofillFieldName); > encoder << placeholder; >@@ -193,7 +193,7 @@ bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInfo > if (!decoder.decode(result.isAutofillableUsernameField)) > return false; > >- if (!decoder.decode(result.elementIsTransparent)) >+ if (!decoder.decode(result.elementIsTransparentOrFullyClipped)) > return false; > > if (!decoder.decode(result.representingPageURL)) >diff --git a/Source/WebKit/Shared/FocusedElementInformation.h b/Source/WebKit/Shared/FocusedElementInformation.h >index 053070361e59c303d83bb6670d18ac43dcc16c5d..835a0ca271cf17060f4c2d7eff7c7b7f4a6f4ffe 100644 >--- a/Source/WebKit/Shared/FocusedElementInformation.h >+++ b/Source/WebKit/Shared/FocusedElementInformation.h >@@ -124,7 +124,7 @@ struct FocusedElementInformation { > String title; > bool acceptsAutofilledLoginCredentials { false }; > bool isAutofillableUsernameField { false }; >- bool elementIsTransparent { false }; >+ bool elementIsTransparentOrFullyClipped { false }; > URL representingPageURL; > WebCore::AutofillFieldName autofillFieldName { WebCore::AutofillFieldName::None }; > String placeholder; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index 7cc65fb43d79f4893965b9a98c7bb0f91f794056..9e7d3a95446766a9de7cea6407d4177d103d81eb 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -153,7 +153,7 @@ typedef std::pair<WebKit::InteractionInformationRequest, InteractionInformationC > namespace WebKit { > > enum SuppressSelectionAssistantReason : uint8_t { >- FocusedElementIsTransparent = 1 << 0, >+ FocusedElementIsTransparentOrFullyClipped = 1 << 0, > FocusedElementIsTooSmall = 1 << 1, > DropAnimationIsRunning = 1 << 2 > }; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index f5162b00591d497775b6779f8b0fc577ac9ec9c7..8b84d9431027c6b924ef120af12c412ecd6bd5e5 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -1398,7 +1398,7 @@ - (BOOL)_requiresKeyboardResetOnReload > > - (void)_zoomToRevealFocusedElement > { >- if (_suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTransparent) || _suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTooSmall)) >+ if (_suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTransparentOrFullyClipped) || _suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTooSmall)) > return; > > SetForScope<BOOL> isZoomingToRevealFocusedElementForScope { _isZoomingToRevealFocusedElement, YES }; >@@ -4455,10 +4455,10 @@ - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information u > if ([inputDelegate respondsToSelector:@selector(_webView:decidePolicyForFocusedElement:)]) > startInputSessionPolicy = [inputDelegate _webView:_webView decidePolicyForFocusedElement:focusedElementInfo.get()]; > >- if (information.elementIsTransparent) >- [self _beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; >+ if (information.elementIsTransparentOrFullyClipped) >+ [self _beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparentOrFullyClipped]; > else >- [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; >+ [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparentOrFullyClipped]; > > auto elementArea = information.elementRect.area<RecordOverflow>(); > if (!elementArea.hasOverflowed() && elementArea < minimumFocusedElementAreaForSuppressingSelectionAssistant) >@@ -4624,10 +4624,10 @@ - (void)_elementDidBlur > > [_webView didEndFormControlInteraction]; > >- [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; >- >- if (!_isChangingFocus) >+ if (!_isChangingFocus) { >+ [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparentOrFullyClipped]; > _didAccessoryTabInitiateFocus = NO; >+ } > } > > - (void)_didReceiveEditorStateUpdateAfterFocus >@@ -4993,10 +4993,10 @@ - (void)_updateChangedSelection:(BOOL)force > > auto& postLayoutData = state.postLayoutData(); > if (!state.selectionIsNone && hasFocusedElement(_focusedElementInformation)) { >- if (postLayoutData.elementIsTransparent) >- [self _beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; >+ if (postLayoutData.elementIsTransparentOrFullyClipped) >+ [self _beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparentOrFullyClipped]; > else >- [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; >+ [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparentOrFullyClipped]; > > auto elementArea = postLayoutData.focusedElementRect.area<RecordOverflow>(); > if (!elementArea.hasOverflowed() && elementArea < minimumFocusedElementAreaForSuppressingSelectionAssistant) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index ebdc370c1a54a67226711bd51ff22fb722fb7db4..910080e660fba0710133b1e472e26f29fa5e135d 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -243,7 +243,7 @@ void WebPage::platformEditorState(Frame& frame, EditorState& result, IncludePost > if (m_focusedElement && m_focusedElement->renderer()) { > postLayoutData.focusedElementRect = view->contentsToRootView(m_focusedElement->renderer()->absoluteBoundingBoxRect()); > postLayoutData.caretColor = m_focusedElement->renderer()->style().caretColor(); >- postLayoutData.elementIsTransparent = m_focusedElement->renderer()->isTransparentRespectingParentFrames(); >+ postLayoutData.elementIsTransparentOrFullyClipped = m_focusedElement->renderer()->isTransparentOrFullyClippedRespectingParentFrames(); > } > computeEditableRootHasContentAndPlainText(selection, postLayoutData); > } >@@ -2368,7 +2368,7 @@ void WebPage::getFocusedElementInformation(FocusedElementInformation& informatio > auto& elementFrame = m_page->focusController().focusedOrMainFrame(); > information.elementRect = elementRectInRootViewCoordinates(*m_focusedElement, elementFrame); > information.nodeFontSize = renderer->style().fontDescription().computedSize(); >- information.elementIsTransparent = renderer->isTransparentRespectingParentFrames(); >+ information.elementIsTransparentOrFullyClipped = renderer->isTransparentOrFullyClippedRespectingParentFrames(); > > bool inFixed = false; > renderer->localToContainerPoint(FloatPoint(), nullptr, UseTransforms, &inFixed); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 6c934d69ca102d357ac6e6648f09e4b7166575bb..5faeb023a5b527a2421be7cee8ed5c32968daf9f 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net >+ https://bugs.webkit.org/show_bug.cgi?id=193180 >+ <rdar://problem/45971041> >+ >+ Reviewed by Tim Horton. >+ >+ * editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt: Added. >+ * editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html: Added. >+ >+ Add a layout test to verify that focusing a hidden editable element underneath an empty container with >+ `overflow: hidden` doesn't cause platform selection UI to appear. >+ >+ * editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt: Added. >+ * editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html: Added. >+ >+ Add a layout test to verify that native selection UI shows up when the document element is made empty with >+ `overflow: hidden`, but the focused elements are still visible. >+ > 2019-01-04 Chris Fleizach <cfleizach@apple.com> > > AX: String check: "Rule" does not reflect the meaning of the <hr> html tag >diff --git a/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt b/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f82e764da525f3a3f32dc1b4c7e37580a0b73edc >--- /dev/null >+++ b/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt >@@ -0,0 +1,19 @@ >+Verifies that native selection UI is suppressed when focusing a textarea that is completely hidden underneath an empty container with overflow: hidden;. To manually test, tap the top button, and then tap on the bottom button. In both cases, there should be no platform selection shown. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+PASS caretViewRect.top is null >+PASS caretViewRect.left is null >+PASS caretViewRect.width is 0 >+PASS caretViewRect.height is 0 >+PASS document.activeElement.id is "editor" >+PASS caretViewRect.top is null >+PASS caretViewRect.left is null >+PASS caretViewRect.width is 0 >+PASS caretViewRect.height is 0 >+PASS document.activeElement.id is "frame" >+PASS frame.contentWindow.document.activeElement.id is "editor" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html b/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html >new file mode 100644 >index 0000000000000000000000000000000000000000..db3f054bb620761d5204b2b43074ee5dd6e54cf7 >--- /dev/null >+++ b/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html >@@ -0,0 +1,84 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<head> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<style> >+body { >+ width: 100%; >+ height: 100%; >+ margin: 0; >+} >+ >+button { >+ width: 320px; >+ height: 80px; >+ display: block; >+} >+ >+ >+#container { >+ width: 30px; >+ height: 0px; >+ font-size: 6px; >+ overflow: hidden; >+} >+</style> >+<script> >+addEventListener("load", runTest); >+jsTestIsAsync = true; >+ >+async function runTest() { >+ description("Verifies that native selection UI is suppressed when focusing a textarea that is completely hidden " >+ + "underneath an empty container with <code>overflow: hidden;</code>. To manually test, tap the top button, " >+ + "and then tap on the bottom button. In both cases, there should be no platform selection shown."); >+ >+ if (!window.testRunner) >+ return; >+ >+ frame = document.getElementById("frame"); >+ caretViewRect = null; >+ >+ function caretViewRectShouldBeNull() { >+ shouldBeNull("caretViewRect.top"); >+ shouldBeNull("caretViewRect.left"); >+ shouldBe("caretViewRect.width", "0"); >+ shouldBe("caretViewRect.height", "0"); >+ } >+ >+ await UIHelper.activateAndWaitForInputSessionAt(160, 40); >+ await UIHelper.ensurePresentationUpdate(); >+ caretViewRect = await UIHelper.getUICaretViewRect(); >+ caretViewRectShouldBeNull(); >+ shouldBeEqualToString("document.activeElement.id", "editor"); >+ >+ document.activeElement.blur(); >+ await UIHelper.waitForKeyboardToHide(); >+ await UIHelper.activateAndWaitForInputSessionAt(160, 120); >+ await UIHelper.ensurePresentationUpdate(); >+ caretViewRect = await UIHelper.getUICaretViewRect(); >+ caretViewRectShouldBeNull(); >+ shouldBeEqualToString("document.activeElement.id", "frame"); >+ shouldBeEqualToString("frame.contentWindow.document.activeElement.id", "editor"); >+ >+ frame.contentWindow.document.activeElement.blur(); >+ await UIHelper.waitForKeyboardToHide(); >+ document.querySelectorAll("button, #container").forEach(element => element.remove()) >+ finishJSTest(); >+} >+</script> >+</head> >+<body> >+<button onclick="document.getElementById('editor').focus()">Focus hidden textarea</button> >+<button onclick="frame.contentWindow.document.getElementById('editor').focus()"> >+ Focus hidden textarea (in subframe) >+</button> >+<div id="container"> >+ <textarea id="editor"></textarea> >+ <iframe id="frame" srcdoc="<textarea id='editor'></textarea>" onload="runTest()"></iframe> >+</div> >+<div id="description"></div> >+<div id="console"></div> >+</body> >+</html> >diff --git a/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt b/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7b82ebdc190554ecdf096269c80b2058667b4249 >--- /dev/null >+++ b/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt >@@ -0,0 +1,13 @@ >+Verifies that native selection UI is not suppressed when the document element has overflow: hidden; and is empty, but the editable element is otherwise still visible. To manually test, tap on the top button and then tap on the bottom button. In both cases, the platform selection UI should be shown. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+Caret view rect became {{ 8, 165 }, { 2, 14 }} >+PASS document.activeElement.id is "editor" >+Caret view rect became {{ 18, 218 }, { 2, 14 }} >+PASS document.activeElement.id is "frame" >+PASS frame.contentWindow.document.activeElement.id is "editor" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html b/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html >new file mode 100644 >index 0000000000000000000000000000000000000000..47e045360783c7c60580920091664b0eb815cc6d >--- /dev/null >+++ b/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html >@@ -0,0 +1,96 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<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> >+<style> >+body { >+ width: 100%; >+ height: 100%; >+ margin: 0; >+} >+ >+html { >+ overflow: hidden; >+ height: 0; >+} >+ >+button { >+ width: 320px; >+ height: 80px; >+ display: block; >+} >+ >+#container { >+ width: 0; >+ height: 0; >+} >+ >+#description { >+ margin-top: 200px; >+} >+</style> >+<script> >+addEventListener("load", runTest); >+jsTestIsAsync = true; >+ >+async function waitForCaretViewRectToBecome(left, top, width, height) { >+ return new Promise(async resolve => { >+ let caretViewRect = null; >+ do { >+ caretViewRect = await UIHelper.getUICaretViewRect(); >+ if (caretViewRect.left === left >+ && caretViewRect.top === top >+ && caretViewRect.width === width >+ && caretViewRect.height === height) >+ break; >+ } while (true); >+ debug(`Caret view rect became {{ ${left}, ${top} }, { ${width}, ${height} }}`); >+ resolve(caretViewRect); >+ }); >+} >+ >+async function runTest() { >+ description("Verifies that native selection UI is not suppressed when the document element has " >+ + "<code>overflow: hidden;</code> and is empty, but the editable element is otherwise still visible. To " >+ + "manually test, tap on the top button and then tap on the bottom button. In both cases, the platform " >+ + "selection UI should be shown."); >+ >+ if (!window.testRunner) >+ return; >+ >+ frame = document.getElementById("frame"); >+ caretViewRect = null; >+ >+ await UIHelper.activateAndWaitForInputSessionAt(160, 40); >+ await waitForCaretViewRectToBecome(8, 165, 2, 14); >+ shouldBeEqualToString("document.activeElement.id", "editor"); >+ >+ document.activeElement.blur(); >+ await UIHelper.waitForKeyboardToHide(); >+ await UIHelper.activateAndWaitForInputSessionAt(160, 120); >+ await waitForCaretViewRectToBecome(18, 218, 2, 14); >+ shouldBeEqualToString("document.activeElement.id", "frame"); >+ shouldBeEqualToString("frame.contentWindow.document.activeElement.id", "editor"); >+ >+ frame.contentWindow.document.activeElement.blur(); >+ await UIHelper.waitForKeyboardToHide(); >+ document.querySelectorAll("button, #container").forEach(element => element.remove()) >+ finishJSTest(); >+} >+</script> >+</head> >+<body> >+<button onclick="document.getElementById('editor').focus()">Focus hidden textarea</button> >+<button onclick="frame.contentWindow.document.getElementById('editor').focus()"> >+ Focus hidden textarea (in subframe) >+</button> >+<div id="container"> >+ <textarea id="editor"></textarea> >+ <iframe id="frame" srcdoc="<textarea id='editor'></textarea>" onload="runTest()"></iframe> >+</div> >+<div id="description"></div> >+<div id="console"></div> >+</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 193180
:
358472
|
358478
|
358480
|
358499
| 358506