Title: [295556] trunk
- Revision
- 295556
- Author
- za...@apple.com
- Date
- 2022-06-15 06:43:53 -0700 (Wed, 15 Jun 2022)
Log Message
REGRESSION (r289443): Page contents disappear after entering a letter in the username field of bmoharris.com
https://bugs.webkit.org/show_bug.cgi?id=241625
<rdar://93516876>
Reviewed by Simon Fraser.
overflow: clip forbids scrolling entirely, through any mechanism (https://drafts.csswg.org/css-overflow/#propdef-overflow)
* LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html: Added.
* LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html: Added.
* LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html: Added.
* LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html: Added.
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::allowsCurrentScroll const): Make sure the content is not scrollable when overflow: clip is set on the renderer.
Canonical link: https://commits.webkit.org/251561@main
Modified Paths
Added Paths
Diff
Added: trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html (0 => 295556)
--- trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html 2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,8 @@
+<style>
+div {
+ width: 100px;;
+ height: 100px;
+ background-color: green;
+}
+</style>
+<div></div>
Added: trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html (0 => 295556)
--- trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html 2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,27 @@
+<style>
+.container {
+ width: 100px;;
+ height: 100px;
+ background-color: green;
+ contain: paint;
+}
+
+.out-of-flow-child {
+ position: absolute;
+ top: -100px;
+ background-color: red;
+ width: 50px;
+ height: 50px;
+}
+.overflow {
+ width: 300px;
+ height: 10px;
+}
+</style>
+<!-- PASS if no red box. -->
+<div id=scrollThis class=container>
+ <div class=out-of-flow-child></div><div class=overflow></div>
+</div>
+<script>
+scrollThis.scrollIntoView();
+</script>
Added: trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html (0 => 295556)
--- trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html 2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,15 @@
+<style>
+.container {
+ width: 100px;;
+ height: 100px;
+ background-color: green;
+ overflow: hidden;
+}
+</style>
+<div class=container>
+ <input id=inputField>
+</div>
+<script>
+inputField.focus();
+inputField.value = "text";
+</script>
Added: trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html (0 => 295556)
--- trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html 2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,26 @@
+<style>
+.container {
+ width: 100px;;
+ height: 100px;
+ background-color: green;
+ overflow: clip;
+ transform: translateX(0px);
+}
+
+.out-of-flow-child {
+ position: absolute;
+ top: -100px;
+ background-color: red;
+ width: 50px;
+ height: 50px;
+}
+
+</style>
+<!-- PASS if no red box while typing in the input field. -->
+<div class=container>
+ <div class=out-of-flow-child></div><input id=inputField>
+</div>
+<script>
+inputField.focus();
+document.execCommand('insertText', false, "text");
+</script>
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (295555 => 295556)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-06-15 11:10:25 UTC (rev 295555)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-06-15 13:43:53 UTC (rev 295556)
@@ -2515,17 +2515,17 @@
if (renderer().parent() && !renderer().parent()->style().lineClamp().isNone())
return false;
- RenderBox* box = renderBox();
- ASSERT(box); // Only boxes can have overflowClip set.
+ // Only boxes can have overflowClip set.
+ auto& box = *renderBox();
- if (renderer().frame().eventHandler().autoscrollInProgress()) {
+ if (box.frame().eventHandler().autoscrollInProgress()) {
// The "programmatically" here is misleading; this asks whether the box has scrollable overflow,
// or is a special case like a form control.
- return box->canBeProgramaticallyScrolled();
+ return box.canBeProgramaticallyScrolled();
}
- // Programmatic scrolls can scroll overflow:hidden.
- return box->hasHorizontalOverflow() || box->hasVerticalOverflow();
+ // Programmatic scrolls can scroll overflow: hidden but not overflow: clip.
+ return box.hasPotentiallyScrollableOverflow() && (box.hasHorizontalOverflow() || box.hasVerticalOverflow());
}
void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions& options)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes