[LFC][IFC] BlockContainer::establishesInlineFormattingContext should only check the...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2018 18:48:25 +0000 (18:48 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2018 18:48:25 +0000 (18:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187965

Reviewed by Antti Koivisto.

* layout/layouttree/LayoutBlockContainer.cpp:
(WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):

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

Source/WebCore/ChangeLog
Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp

index 6ee8945..5bcdb20 100644 (file)
@@ -1,3 +1,13 @@
+2018-07-24  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][IFC] BlockContainer::establishesInlineFormattingContext should only check the first inflow child.
+        https://bugs.webkit.org/show_bug.cgi?id=187965
+
+        Reviewed by Antti Koivisto.
+
+        * layout/layouttree/LayoutBlockContainer.cpp:
+        (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
+
 2018-07-24  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Cocoa] Stop crashing in lastResortFallbackFont()
index 90c5349..881aa2a 100644 (file)
@@ -45,11 +45,12 @@ bool BlockContainer::establishesInlineFormattingContext() const
 {
     // 9.4.2 Inline formatting contexts
     // An inline formatting context is established by a block container box that contains no block-level boxes.
-    for (auto* child = firstInFlowChild(); child; child = child->nextInFlowSibling()) {
-        if (child->isBlockLevelBox())
-            return false;
-    }
-    return hasInFlowOrFloatingChild();
+
+    // It's enough to check the first in-flow child since we can't have both block and inline level sibling boxes.
+    if (auto* firstInFlowChild = this->firstInFlowChild())
+        return firstInFlowChild->isInlineLevelBox();
+
+    return false;
 }
 
 }