Title: [289527] trunk
- Revision
- 289527
- Author
- [email protected]
- Date
- 2022-02-10 05:02:05 -0800 (Thu, 10 Feb 2022)
Log Message
Incorrect abspos layout when toggling contain
https://bugs.webkit.org/show_bug.cgi?id=236261
Patch by Rob Buis <[email protected]> on 2022-02-10
Reviewed by Simon Fraser.
LayoutTests/imported/w3c:
* web-platform-tests/css/css-contain/contain-layout-020-expected.html: Added.
* web-platform-tests/css/css-contain/contain-layout-020.html: Added.
Source/WebCore:
A change in layout containment for a container means either the container becomes
a absolute positioning containing block or ceases to be one. The method
removePositionedObjectsIfNeeded handles this, update it to take layout containment
changes into account.
Test: imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removePositionedObjectsIfNeeded):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289526 => 289527)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-10 11:10:45 UTC (rev 289526)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-10 13:02:05 UTC (rev 289527)
@@ -1,3 +1,13 @@
+2022-02-10 Rob Buis <[email protected]>
+
+ Incorrect abspos layout when toggling contain
+ https://bugs.webkit.org/show_bug.cgi?id=236261
+
+ Reviewed by Simon Fraser.
+
+ * web-platform-tests/css/css-contain/contain-layout-020-expected.html: Added.
+ * web-platform-tests/css/css-contain/contain-layout-020.html: Added.
+
2022-02-10 Antti Koivisto <[email protected]>
[:has() pseudo-class] Nullptr crash with non-function :has
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-layout-020-expected.html (0 => 289527)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-layout-020-expected.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-layout-020-expected.html 2022-02-10 13:02:05 UTC (rev 289527)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>CSS Containment Test: Removing layout containment and contained positioned elements</title>
+
+<style>
+.container {
+ width: 300px;
+ height: 300px;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+.fixed {
+ position: fixed;
+ top: 0;
+ left: 0;
+}
+.abspos {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+</style>
+
+<div class="container">
+ <div class="fixed box"></div>
+ <div class="abspos box"></div>
+</div>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html (0 => 289527)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html 2022-02-10 13:02:05 UTC (rev 289527)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset=utf-8>
+<title>CSS Containment Test: Removing layout containment and contained positioned elements</title>
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name=assert content="Removing layout containment relayouts contained positioned elements correctly.">
+
+<style>
+#container {
+ width: 300px;
+ height: 300px;
+ contain: layout;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+.fixed {
+ position: fixed;
+ top: 0;
+ left: 0;
+}
+.abspos {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+</style>
+
+<div id="container">
+ <div class="fixed box"></div>
+ <div class="abspos box"></div>
+</div>
+
+<script>
+ requestAnimationFrame(() => {
+ container.style.contain = "none";
+ document.documentElement.removeAttribute("class");
+ });
+</script>
+
Modified: trunk/Source/WebCore/ChangeLog (289526 => 289527)
--- trunk/Source/WebCore/ChangeLog 2022-02-10 11:10:45 UTC (rev 289526)
+++ trunk/Source/WebCore/ChangeLog 2022-02-10 13:02:05 UTC (rev 289527)
@@ -1,3 +1,20 @@
+2022-02-10 Rob Buis <[email protected]>
+
+ Incorrect abspos layout when toggling contain
+ https://bugs.webkit.org/show_bug.cgi?id=236261
+
+ Reviewed by Simon Fraser.
+
+ A change in layout containment for a container means either the container becomes
+ a absolute positioning containing block or ceases to be one. The method
+ removePositionedObjectsIfNeeded handles this, update it to take layout containment
+ changes into account.
+
+ Test: imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::removePositionedObjectsIfNeeded):
+
2022-02-10 Antti Koivisto <[email protected]>
[:has() pseudo-class] Nullptr crash with non-function :has
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (289526 => 289527)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2022-02-10 11:10:45 UTC (rev 289526)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2022-02-10 13:02:05 UTC (rev 289527)
@@ -376,11 +376,15 @@
{
bool hadTransform = oldStyle.hasTransformRelatedProperty();
bool willHaveTransform = newStyle.hasTransformRelatedProperty();
- if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform)
+ bool hadLayoutContainment = oldStyle.containsLayout();
+ bool willHaveLayoutContainment = newStyle.containsLayout();
+ if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform && hadLayoutContainment == willHaveLayoutContainment)
return;
// We are no longer the containing block for out-of-flow descendants.
bool outOfFlowDescendantsHaveNewContainingBlock = (hadTransform && !willHaveTransform) || (newStyle.position() == PositionType::Static && !willHaveTransform);
+ if (hadLayoutContainment != willHaveLayoutContainment)
+ outOfFlowDescendantsHaveNewContainingBlock = hadLayoutContainment && !willHaveLayoutContainment;
if (outOfFlowDescendantsHaveNewContainingBlock) {
// Our out-of-flow descendants will be inserted into a new containing block's positioned objects list during the next layout.
removePositionedObjects(nullptr, NewContainingBlock);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes