[LFC] Do not skip the next inflow sibling after finishing a formatting context root...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2018 14:47:06 +0000 (14:47 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2018 14:47:06 +0000 (14:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187178

Reviewed by Antti Koivisto.

Since the block formatting layout is based on pre-order traversal, after finishing a formatting
context layout (which takes care of its entire subtre), we need to visit the next (in-flow)sibling.

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233356 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp

index 972ad9b..1c8d9cf 100644 (file)
@@ -1,5 +1,18 @@
 2018-06-29  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC] Do not skip the next inflow sibling after finishing a formatting context root layout.
+        https://bugs.webkit.org/show_bug.cgi?id=187178
+
+        Reviewed by Antti Koivisto.
+
+        Since the block formatting layout is based on pre-order traversal, after finishing a formatting
+        context layout (which takes care of its entire subtre), we need to visit the next (in-flow)sibling. 
+
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layout const):
+
+2018-06-29  Zalan Bujtas  <zalan@apple.com>
+
         [LFC] The static position for an out-of-flow box should include the previous sibling's collapsed margin
         https://bugs.webkit.org/show_bug.cgi?id=187169
 
index 2a057c6..b4692ae 100644 (file)
@@ -82,7 +82,12 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
                 layoutFormattingContextRoot(layoutContext, formattingState, layoutBox, displayBox);
                 layoutQueue.removeLast();
                 // Since this box is a formatting context root, it takes care of its entire subtree.
-                break;
+                // Continue with next sibling if exists.
+                if (!layoutBox.nextInFlowOrFloatingSibling())
+                    break;
+                auto* nextSibling = layoutBox.nextInFlowOrFloatingSibling();
+                layoutQueue.append(std::make_unique<LayoutPair>(LayoutPair {*nextSibling, layoutContext.createDisplayBox(*nextSibling)}));
+                continue;
             }
 
             LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")");