Title: [257056] trunk
Revision
257056
Author
[email protected]
Date
2020-02-20 07:19:35 -0800 (Thu, 20 Feb 2020)

Log Message

[LFC][Out-of-flow] FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned should ignore inline boxes
https://bugs.webkit.org/show_bug.cgi?id=207994
<rdar://problem/59618280>

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html

https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height

"For the purposes of this section and the next, the term "static position" (of an element) refers, roughly,
to the position an element would have had in the normal flow."

This does not seem to be well-defined for sibling inline boxes. Let's just stick with block level boxes for now.

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):

LayoutTests:

* fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling-expected.html: Added.
* fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (257055 => 257056)


--- trunk/LayoutTests/ChangeLog	2020-02-20 15:00:29 UTC (rev 257055)
+++ trunk/LayoutTests/ChangeLog	2020-02-20 15:19:35 UTC (rev 257056)
@@ -1,3 +1,14 @@
+2020-02-20  Zalan Bujtas  <[email protected]>
+
+        [LFC][Out-of-flow] FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned should ignore inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=207994
+        <rdar://problem/59618280>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling-expected.html: Added.
+        * fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html: Added.
+
 2020-02-20  Carlos Alberto Lopez Perez  <[email protected]>
 
         [GTK] Gardening of Web inspector tests.

Added: trunk/LayoutTests/fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling-expected.html (0 => 257056)


--- trunk/LayoutTests/fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling-expected.html	2020-02-20 15:19:35 UTC (rev 257056)
@@ -0,0 +1,10 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    position: static;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+</style>
+<div></div>

Added: trunk/LayoutTests/fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html (0 => 257056)


--- trunk/LayoutTests/fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html	2020-02-20 15:19:35 UTC (rev 257056)
@@ -0,0 +1,16 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+.absolute {
+    position: absolute;
+    left: 8px;
+    top: 8px;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+
+div {
+    color: green;
+}
+</style>
+<div>text content<div class=absolute></div></div>

Modified: trunk/Source/WebCore/ChangeLog (257055 => 257056)


--- trunk/Source/WebCore/ChangeLog	2020-02-20 15:00:29 UTC (rev 257055)
+++ trunk/Source/WebCore/ChangeLog	2020-02-20 15:19:35 UTC (rev 257056)
@@ -1,3 +1,23 @@
+2020-02-20  Zalan Bujtas  <[email protected]>
+
+        [LFC][Out-of-flow] FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned should ignore inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=207994
+        <rdar://problem/59618280>
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html
+
+        https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height
+
+        "For the purposes of this section and the next, the term "static position" (of an element) refers, roughly,
+        to the position an element would have had in the normal flow."
+
+        This does not seem to be well-defined for sibling inline boxes. Let's just stick with block level boxes for now.
+
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
+
 2020-02-20  Don Olmstead  <[email protected]>
 
         [CMake] Add WebP targets

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (257055 => 257056)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2020-02-20 15:00:29 UTC (rev 257055)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2020-02-20 15:19:35 UTC (rev 257056)
@@ -227,9 +227,9 @@
     // Start with this box's border box offset from the parent's border box.
     auto& formattingContext = this->formattingContext();
     LayoutUnit top;
-    if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
+    if (layoutBox.previousInFlowSibling() && layoutBox.previousInFlowSibling()->isBlockLevelBox()) {
         // Add sibling offset
-        auto& previousInFlowBoxGeometry = formattingContext.geometryForBox(*previousInFlowSibling, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry);
+        auto& previousInFlowBoxGeometry = formattingContext.geometryForBox(*layoutBox.previousInFlowSibling(), EscapeReason::OutOfFlowBoxNeedsInFlowGeometry);
         top += previousInFlowBoxGeometry.bottom() + previousInFlowBoxGeometry.nonCollapsedMarginAfter();
     } else {
         ASSERT(layoutBox.parent());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to