Title: [239685] trunk
Revision
239685
Author
[email protected]
Date
2019-01-07 10:50:39 -0800 (Mon, 07 Jan 2019)

Log Message

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.

Source/WebCore:

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:

Source/WebKit:

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):

LayoutTests:

* 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239684 => 239685)


--- trunk/LayoutTests/ChangeLog	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/LayoutTests/ChangeLog	2019-01-07 18:50:39 UTC (rev 239685)
@@ -1,3 +1,23 @@
+2019-01-07  Wenson Hsieh  <[email protected]>
+
+        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-07  Truitt Savell  <[email protected]>
 
         Mark compositing/masks/compositing-clip-path-change-no-repaint.html flakey for Mojave WK1

Added: trunk/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt (0 => 239685)


--- trunk/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container-expected.txt	2019-01-07 18:50:39 UTC (rev 239685)
@@ -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
+

Added: trunk/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html (0 => 239685)


--- trunk/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html	2019-01-07 18:50:39 UTC (rev 239685)
@@ -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=""
+<script src=""
+<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>

Added: trunk/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt (0 => 239685)


--- trunk/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document-expected.txt	2019-01-07 18:50:39 UTC (rev 239685)
@@ -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
+

Added: trunk/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html (0 => 239685)


--- trunk/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html	2019-01-07 18:50:39 UTC (rev 239685)
@@ -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=""
+<script src=""
+<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>

Modified: trunk/Source/WebCore/ChangeLog (239684 => 239685)


--- trunk/Source/WebCore/ChangeLog	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebCore/ChangeLog	2019-01-07 18:50:39 UTC (rev 239685)
@@ -1,3 +1,22 @@
+2019-01-07  Wenson Hsieh  <[email protected]>
+
+        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-07  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes.

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (239684 => 239685)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2019-01-07 18:50:39 UTC (rev 239685)
@@ -1514,7 +1514,7 @@
     delete this;
 }
 
-bool RenderObject::isTransparentRespectingParentFrames() const
+bool RenderObject::isTransparentOrFullyClippedRespectingParentFrames() const
 {
     static const double minimumVisibleOpacity = 0.01;
 
@@ -1522,7 +1522,13 @@
     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;
 

Modified: trunk/Source/WebCore/rendering/RenderObject.h (239684 => 239685)


--- trunk/Source/WebCore/rendering/RenderObject.h	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2019-01-07 18:50:39 UTC (rev 239685)
@@ -797,7 +797,7 @@
     void initializeFragmentedFlowStateOnInsertion();
     virtual void insertedIntoTree();
 
-    WEBCORE_EXPORT bool isTransparentRespectingParentFrames() const;
+    WEBCORE_EXPORT bool isTransparentOrFullyClippedRespectingParentFrames() const;
 
 protected:
     //////////////////////////////////////////

Modified: trunk/Source/WebKit/ChangeLog (239684 => 239685)


--- trunk/Source/WebKit/ChangeLog	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/ChangeLog	2019-01-07 18:50:39 UTC (rev 239685)
@@ -1,3 +1,55 @@
+2019-01-07  Wenson Hsieh  <[email protected]>
+
+        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-07  Alex Christensen  <[email protected]>
 
         Move identifierBase from SessionTracker to NetworkProcess/WebProcess

Modified: trunk/Source/WebKit/Shared/EditorState.cpp (239684 => 239685)


--- trunk/Source/WebKit/Shared/EditorState.cpp	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/Shared/EditorState.cpp	2019-01-07 18:50:39 UTC (rev 239685)
@@ -130,7 +130,7 @@
     encoder << isStableStateUpdate;
     encoder << insideFixedPosition;
     encoder << hasPlainText;
-    encoder << elementIsTransparent;
+    encoder << elementIsTransparentOrFullyClipped;
     encoder << caretColor;
 #endif
 #if PLATFORM(MAC)
@@ -187,7 +187,7 @@
         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;

Modified: trunk/Source/WebKit/Shared/EditorState.h (239684 => 239685)


--- trunk/Source/WebKit/Shared/EditorState.h	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/Shared/EditorState.h	2019-01-07 18:50:39 UTC (rev 239685)
@@ -107,7 +107,7 @@
         bool isStableStateUpdate { false };
         bool insideFixedPosition { false };
         bool hasPlainText { false };
-        bool elementIsTransparent { false };
+        bool elementIsTransparentOrFullyClipped { false };
         WebCore::Color caretColor;
 #endif
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit/Shared/FocusedElementInformation.cpp (239684 => 239685)


--- trunk/Source/WebKit/Shared/FocusedElementInformation.cpp	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/Shared/FocusedElementInformation.cpp	2019-01-07 18:50:39 UTC (rev 239685)
@@ -91,7 +91,7 @@
     encoder << title;
     encoder << acceptsAutofilledLoginCredentials;
     encoder << isAutofillableUsernameField;
-    encoder << elementIsTransparent;
+    encoder << elementIsTransparentOrFullyClipped;
     encoder << representingPageURL;
     encoder.encodeEnum(autofillFieldName);
     encoder << placeholder;
@@ -193,7 +193,7 @@
     if (!decoder.decode(result.isAutofillableUsernameField))
         return false;
 
-    if (!decoder.decode(result.elementIsTransparent))
+    if (!decoder.decode(result.elementIsTransparentOrFullyClipped))
         return false;
 
     if (!decoder.decode(result.representingPageURL))

Modified: trunk/Source/WebKit/Shared/FocusedElementInformation.h (239684 => 239685)


--- trunk/Source/WebKit/Shared/FocusedElementInformation.h	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/Shared/FocusedElementInformation.h	2019-01-07 18:50:39 UTC (rev 239685)
@@ -124,7 +124,7 @@
     String title;
     bool acceptsAutofilledLoginCredentials { false };
     bool isAutofillableUsernameField { false };
-    bool elementIsTransparent { false };
+    bool elementIsTransparentOrFullyClipped { false };
     URL representingPageURL;
     WebCore::AutofillFieldName autofillFieldName { WebCore::AutofillFieldName::None };
     String placeholder;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (239684 => 239685)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-01-07 18:50:39 UTC (rev 239685)
@@ -153,7 +153,7 @@
 namespace WebKit {
 
 enum SuppressSelectionAssistantReason : uint8_t {
-    FocusedElementIsTransparent = 1 << 0,
+    FocusedElementIsTransparentOrFullyClipped = 1 << 0,
     FocusedElementIsTooSmall = 1 << 1,
     DropAnimationIsRunning = 1 << 2
 };

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (239684 => 239685)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-01-07 18:50:39 UTC (rev 239685)
@@ -1403,7 +1403,7 @@
 
 - (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 };
@@ -4460,10 +4460,10 @@
     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)
@@ -4628,10 +4628,10 @@
 
     [_webView didEndFormControlInteraction];
 
-    [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent];
-
-    if (!_isChangingFocus)
+    if (!_isChangingFocus) {
+        [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparentOrFullyClipped];
         _didAccessoryTabInitiateFocus = NO;
+    }
 }
 
 - (void)_didReceiveEditorStateUpdateAfterFocus
@@ -4997,10 +4997,10 @@
 
     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)

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (239684 => 239685)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-01-07 18:46:21 UTC (rev 239684)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-01-07 18:50:39 UTC (rev 239685)
@@ -243,7 +243,7 @@
         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 @@
         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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to