Native text selection UI is incorrectly suppressed in Microsoft Visio
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2019 00:31:31 +0000 (00:31 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2019 00:31:31 +0000 (00:31 +0000)
commitdaecc9d193c0005e320eb4386bc0ff69dd2a45b6
treec0603b0f52791090556f12121f27dc272f6235b3
parentec1e6e612b01c56af016baaf52dcb0918e3d07d9
Native text selection UI is incorrectly suppressed in Microsoft Visio
https://bugs.webkit.org/show_bug.cgi?id=195178
<rdar://problem/48519394>

Reviewed by Darin Adler.

Source/WebCore:

Currently, our heuristics for detecting hidden editable areas attempt to search for empty parent renderers with
"overflow: hidden". It does this by ascending the layer tree in search of renderers that have an empty content
size, and whose renderers' styles indicate that they have overflow: hidden in the X or Y directions. This fails
in the case where a child renderer is positioned out of flow, relative to one of its parent layers, since the
child will be visible, but we'll incorrectly believe that it is hidden. This leads to selection UI unexpectedly
disappearing in the online version of Microsoft Visio.

To fix this, we check whether the enclosing layer around the editable element has an empty clip rect; if the
element is inside of a subframe, we additionally walk up to each enclosing frame's layer and check if that
frame's layer has an empty clip rect.

Test: editing/selection/ios/do-not-hide-selection-in-visible-container.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):

LayoutTests:

Add a new layout test that focuses several different text fields and checks whether or not editing UI is shown:

1. A text field inside an overflow: hidden container, all within an absolutely positioned iframe, such that the
text field is not visible. The caret should be hidden.

2. A text field inside an absolutely positioned iframe, inside an overflow: hidden container, such that the
text field is visible. The caret should be visible.

3. A text field inside a relatively positioned iframe in an overflow: hidden container, such that the text field
is not visible. The caret should be hidden.

4. A text field that is position: fixed inside an overflow: hidden container, such that the text field is
visible. The caret should be visible.

* editing/selection/ios/do-not-hide-selection-in-visible-container-expected.txt: Added.
* editing/selection/ios/do-not-hide-selection-in-visible-container.html: Added.
* editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html:
* resources/ui-helper.js:
(window.UIHelper.activateElementAndWaitForInputSession):

Add a convenience function in UIHelper that taps a given element and waits for the keyboard to show.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-container-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-container.html [new file with mode: 0644]
LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html
LayoutTests/resources/ui-helper.js
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObject.cpp