- Revision
- 245381
- Author
- [email protected]
- Date
- 2019-05-15 22:43:18 -0700 (Wed, 15 May 2019)
Log Message
Cherry-pick r245317. rdar://problem/50291989
Missing cursor/caret showing in search field on google.com
https://bugs.webkit.org/show_bug.cgi?id=197862
<rdar://problem/50291989>
Reviewed by Simon Fraser.
Source/WebCore:
In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
clipped.
To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
layer, and then walk up to the parent frame and repeat if necessary.
Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):
LayoutTests:
Add a new layout test that represents a reduced test case version of google.com's search field.
* editing/selection/ios/do-not-hide-selection-in-visible-field.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-608.1.24-branch/LayoutTests/ChangeLog (245380 => 245381)
--- branches/safari-608.1.24-branch/LayoutTests/ChangeLog 2019-05-16 05:43:14 UTC (rev 245380)
+++ branches/safari-608.1.24-branch/LayoutTests/ChangeLog 2019-05-16 05:43:18 UTC (rev 245381)
@@ -1,5 +1,56 @@
2019-05-15 Kocsen Chung <[email protected]>
+ Cherry-pick r245317. rdar://problem/50291989
+
+ Missing cursor/caret showing in search field on google.com
+ https://bugs.webkit.org/show_bug.cgi?id=197862
+ <rdar://problem/50291989>
+
+ Reviewed by Simon Fraser.
+
+ Source/WebCore:
+
+ In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
+ hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
+ position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
+ the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
+ RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
+ completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
+ clipped.
+
+ To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
+ the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
+ and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
+ layer, and then walk up to the parent frame and repeat if necessary.
+
+ Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):
+
+ LayoutTests:
+
+ Add a new layout test that represents a reduced test case version of google.com's search field.
+
+ * editing/selection/ios/do-not-hide-selection-in-visible-field.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-05-14 Wenson Hsieh <[email protected]>
+
+ Missing cursor/caret showing in search field on google.com
+ https://bugs.webkit.org/show_bug.cgi?id=197862
+ <rdar://problem/50291989>
+
+ Reviewed by Simon Fraser.
+
+ Add a new layout test that represents a reduced test case version of google.com's search field.
+
+ * editing/selection/ios/do-not-hide-selection-in-visible-field.html: Added.
+
+2019-05-15 Kocsen Chung <[email protected]>
+
Cherry-pick r245286. rdar://problem/50187657
[Pointer Events] The pointerenter and pointerleave events target the wrong element on iOS
Added: branches/safari-608.1.24-branch/LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-field-expected.txt (0 => 245381)
--- branches/safari-608.1.24-branch/LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-field-expected.txt (rev 0)
+++ branches/safari-608.1.24-branch/LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-field-expected.txt 2019-05-16 05:43:18 UTC (rev 245381)
@@ -0,0 +1,15 @@
+
+Click me
+This test verifies platform selection UI is not incorrectly suppressed when the editable element is visible. To manually run the test, tap the button to focus the search field, and confirm that the caret view appears in the field.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS caretRect.top is 7
+PASS caretRect.left is 11
+PASS caretRect.width is 2
+PASS caretRect.height is 25
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-608.1.24-branch/LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-field.html (0 => 245381)
--- branches/safari-608.1.24-branch/LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-field.html (rev 0)
+++ branches/safari-608.1.24-branch/LayoutTests/editing/selection/ios/do-not-hide-selection-in-visible-field.html 2019-05-16 05:43:18 UTC (rev 245381)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <script src=""
+ <script src=""
+ <style>
+ html, body {
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ }
+
+ form {
+ overflow: hidden;
+ }
+
+ input, p {
+ font-size: 20px;
+ width: 300px;
+ }
+
+ .fixed {
+ position: fixed;
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ overflow: auto;
+ }
+
+ button {
+ position: absolute;
+ top: 40px;
+ }
+ </style>
+</head>
+<body>
+ <form>
+ <div class="fixed">
+ <input type="search" />
+ </div>
+ </form>
+ <button>Click me</button>
+ <p id="description"></p>
+ <p id="console"></p>
+</body>
+<script>
+ jsTestIsAsync = true;
+
+ description("This test verifies platform selection UI is not incorrectly suppressed when the editable element is visible. To manually run the test, tap the button to focus the search field, and confirm that the caret view appears in the field.");
+
+ const button = document.querySelector("button");
+ button.addEventListener("click", () => document.querySelector("input").focus());
+
+ addEventListener("load", async () => {
+ if (!window.testRunner)
+ return;
+
+ await UIHelper.activateElementAndWaitForInputSession(button);
+
+ caretRect = null;
+ while (!caretRect || !caretRect.width || !caretRect.height)
+ caretRect = await UIHelper.getUICaretViewRect();
+
+ shouldBe("caretRect.top", "7");
+ shouldBe("caretRect.left", "11");
+ shouldBe("caretRect.width", "2");
+ shouldBe("caretRect.height", "25");
+ finishJSTest();
+ });
+</script>
+</html>
\ No newline at end of file
Modified: branches/safari-608.1.24-branch/Source/WebCore/ChangeLog (245380 => 245381)
--- branches/safari-608.1.24-branch/Source/WebCore/ChangeLog 2019-05-16 05:43:14 UTC (rev 245380)
+++ branches/safari-608.1.24-branch/Source/WebCore/ChangeLog 2019-05-16 05:43:18 UTC (rev 245381)
@@ -1,5 +1,70 @@
2019-05-15 Kocsen Chung <[email protected]>
+ Cherry-pick r245317. rdar://problem/50291989
+
+ Missing cursor/caret showing in search field on google.com
+ https://bugs.webkit.org/show_bug.cgi?id=197862
+ <rdar://problem/50291989>
+
+ Reviewed by Simon Fraser.
+
+ Source/WebCore:
+
+ In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
+ hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
+ position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
+ the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
+ RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
+ completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
+ clipped.
+
+ To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
+ the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
+ and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
+ layer, and then walk up to the parent frame and repeat if necessary.
+
+ Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):
+
+ LayoutTests:
+
+ Add a new layout test that represents a reduced test case version of google.com's search field.
+
+ * editing/selection/ios/do-not-hide-selection-in-visible-field.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-05-14 Wenson Hsieh <[email protected]>
+
+ Missing cursor/caret showing in search field on google.com
+ https://bugs.webkit.org/show_bug.cgi?id=197862
+ <rdar://problem/50291989>
+
+ Reviewed by Simon Fraser.
+
+ In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
+ hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
+ position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
+ the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
+ RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
+ completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
+ clipped.
+
+ To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
+ the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
+ and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
+ layer, and then walk up to the parent frame and repeat if necessary.
+
+ Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):
+
+2019-05-15 Kocsen Chung <[email protected]>
+
Cherry-pick r245286. rdar://problem/50187657
[Pointer Events] The pointerenter and pointerleave events target the wrong element on iOS
Modified: branches/safari-608.1.24-branch/Source/WebCore/rendering/RenderLayer.cpp (245380 => 245381)
--- branches/safari-608.1.24-branch/Source/WebCore/rendering/RenderLayer.cpp 2019-05-16 05:43:14 UTC (rev 245380)
+++ branches/safari-608.1.24-branch/Source/WebCore/rendering/RenderLayer.cpp 2019-05-16 05:43:18 UTC (rev 245381)
@@ -6696,17 +6696,28 @@
return true;
}
- RenderLayer* enclosingClipLayer = nullptr;
- for (auto* layer = this; layer; layer = enclosingClipLayer ? enclosingClipLayer->parent() : enclosingFrameRenderLayer(*layer)) {
- enclosingClipLayer = layer->enclosingOverflowClipLayer(IncludeSelfOrNot::IncludeSelf);
- if (!enclosingClipLayer)
- continue;
+ auto hasEmptyClipRect = [] (const RenderLayer& layer) -> bool {
+ auto* frameView = layer.renderer().document().view();
+ if (!frameView)
+ return false;
+ auto* renderView = frameView->renderView();
+ if (!renderView)
+ return false;
+
+ auto* renderViewLayer = renderView->layer();
+ if (!renderViewLayer)
+ return false;
+
LayoutRect layerBounds;
ClipRect backgroundRect;
ClipRect foregroundRect;
- layer->calculateRects({ enclosingClipLayer, TemporaryClipRects }, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, layer->offsetFromAncestor(enclosingClipLayer));
- if (backgroundRect.isEmpty())
+ layer.calculateRects({ renderViewLayer, TemporaryClipRects }, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, layer.offsetFromAncestor(renderViewLayer));
+ return backgroundRect.isEmpty();
+ };
+
+ for (auto* layer = this; layer; layer = enclosingFrameRenderLayer(*layer)) {
+ if (hasEmptyClipRect(*layer))
return true;
}