Title: [270198] trunk/Source/WebCore
Revision
270198
Author
[email protected]
Date
2020-11-27 09:45:58 -0800 (Fri, 27 Nov 2020)

Log Message

[LFC Display] A ContainerBox can establish an inline formatting context and have box children
https://bugs.webkit.org/show_bug.cgi?id=218736

Reviewed by Zalan Bujtas.

If a layout box establishes an inline formatting context, then the only descendant container
boxes that we should make display boxes for while traversing non-inline descendants
are those which are out of flow.

* display/DisplayTreeBuilder.cpp:
(WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270197 => 270198)


--- trunk/Source/WebCore/ChangeLog	2020-11-27 17:26:03 UTC (rev 270197)
+++ trunk/Source/WebCore/ChangeLog	2020-11-27 17:45:58 UTC (rev 270198)
@@ -1,3 +1,17 @@
+2020-11-27  Simon Fraser  <[email protected]>
+
+        [LFC Display] A ContainerBox can establish an inline formatting context and have box children
+        https://bugs.webkit.org/show_bug.cgi?id=218736
+
+        Reviewed by Zalan Bujtas.
+
+        If a layout box establishes an inline formatting context, then the only descendant container
+        boxes that we should make display boxes for while traversing non-inline descendants
+        are those which are out of flow.
+
+        * display/DisplayTreeBuilder.cpp:
+        (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const):
+
 2020-11-27  Adrian Perez de Castro  <[email protected]>
 
         Non-unified build fixes, late November 2020 edition

Modified: trunk/Source/WebCore/display/DisplayTreeBuilder.cpp (270197 => 270198)


--- trunk/Source/WebCore/display/DisplayTreeBuilder.cpp	2020-11-27 17:26:03 UTC (rev 270197)
+++ trunk/Source/WebCore/display/DisplayTreeBuilder.cpp	2020-11-27 17:45:58 UTC (rev 270198)
@@ -141,14 +141,25 @@
     offsetFromRoot += toLayoutSize(borderBoxRect.location());
 
     auto positionForChildren = InsertionPosition { downcast<ContainerBox>(*insertionPosition.currentChild) };
-    
+
+    enum class DescendantBoxInclusion { AllBoxes, OutOfFlowOnly };
+    auto boxInclusion = DescendantBoxInclusion::AllBoxes;
+
     if (layoutContainerBox.establishesInlineFormattingContext()) {
         buildInlineDisplayTree(layoutState, offsetFromRoot, downcast<Layout::ContainerBox>(layoutContainerBox), positionForChildren);
-        return;
+        boxInclusion = DescendantBoxInclusion::OutOfFlowOnly;
     }
 
+    auto includeBox = [](DescendantBoxInclusion boxInclusion, const Layout::Box& box) {
+        switch (boxInclusion) {
+        case DescendantBoxInclusion::AllBoxes: return true;
+        case DescendantBoxInclusion::OutOfFlowOnly: return !box.isInFlow();
+        }
+        return false;
+    };
+
     for (auto& child : Layout::childrenOfType<Layout::Box>(layoutContainerBox)) {
-        if (layoutState.hasBoxGeometry(child))
+        if (includeBox(boxInclusion, child) && layoutState.hasBoxGeometry(child))
             recursiveBuildDisplayTree(layoutState, offsetFromRoot, child, positionForChildren);
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to