Title: [258864] trunk/Source/WebCore

Diff

Modified: trunk/Source/WebCore/ChangeLog (258863 => 258864)


--- trunk/Source/WebCore/ChangeLog	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/ChangeLog	2020-03-23 18:49:09 UTC (rev 258864)
@@ -1,3 +1,16 @@
+2020-03-23  Truitt Savell  <[email protected]>
+
+        Unreviewed, reverting r258847.
+
+        Broke testing on Mac Debug with an Assert
+
+        Reverted changeset:
+
+        "[LFC] Layout::Box::initialContainingBlock() should return
+        const InitialContainingBlock&"
+        https://bugs.webkit.org/show_bug.cgi?id=209406
+        https://trac.webkit.org/changeset/258847
+
 2020-03-23  Kate Cheney  <[email protected]>
 
         Add checks for app-bound navigations when evaluating user style sheets

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -35,7 +35,6 @@
 #include "LayoutContainerBox.h"
 #include "LayoutContext.h"
 #include "LayoutDescendantIterator.h"
-#include "LayoutInitialContainingBlock.h"
 #include "LayoutReplacedBox.h"
 #include "LayoutState.h"
 #include "Logging.h"
@@ -193,7 +192,7 @@
     UNUSED_PARAM(escapeReason);
 #if ASSERT_ENABLED
     auto isOkToAccessDisplayBox = [&] {
-        if (!is<InitialContainingBlock>(layoutBox) && &layoutBox.formattingContextRoot() == &root()) {
+        if (!layoutBox.isInitialContainingBlock() && &layoutBox.formattingContextRoot() == &root()) {
             // This is the non-escape case of accessing a box's geometry information within the same formatting context.
             return true;
         }
@@ -205,17 +204,17 @@
 
         if (*escapeReason == EscapeReason::DocumentBoxStrechesToViewportQuirk) {
             ASSERT(layoutState().inQuirksMode());
-            return is<InitialContainingBlock>(layoutBox);
+            return layoutBox.isInitialContainingBlock();
         }
 
         if (*escapeReason == EscapeReason::BodyStrechesToViewportQuirk) {
             ASSERT(layoutState().inQuirksMode());
-            return is<InitialContainingBlock>(layoutBox) || layoutBox.isDocumentBox();
+            return layoutBox.isInitialContainingBlock() || layoutBox.isDocumentBox();
 
         }
 
         if (*escapeReason == EscapeReason::StrokeOverflowNeedsViewportGeometry)
-            return is<InitialContainingBlock>(layoutBox);
+            return layoutBox.isInitialContainingBlock();
 
         if (*escapeReason == EscapeReason::NeedsGeometryFromEstablishedFormattingContext) {
             // This is the case when a formatting root collects geometry information from the established
@@ -244,7 +243,7 @@
             ASSERT(layoutState().inQuirksMode());
             // Find the first containing block with fixed height quirk. See Quirks::heightValueOfNearestContainingBlockWithFixedHeight.
             // This is only to check if the targetFormattingRoot is an ancestor formatting root.
-            if (is<InitialContainingBlock>(layoutBox))
+            if (layoutBox.isInitialContainingBlock())
                 return true;
             auto& targetFormattingRoot = layoutBox.formattingContextRoot();
             auto* ancestorFormattingContextRoot = &root().formattingContextRoot();
@@ -252,7 +251,7 @@
                 if (&targetFormattingRoot == ancestorFormattingContextRoot)
                     return true;
                 ancestorFormattingContextRoot = &ancestorFormattingContextRoot->formattingContextRoot();
-                if (is<InitialContainingBlock>(*ancestorFormattingContextRoot))
+                if (ancestorFormattingContextRoot->isInitialContainingBlock())
                     return true;
             }
             return false;
@@ -281,7 +280,7 @@
     auto& root = this->root();
     if (!root.hasChild())
         return;
-    if (!root.isPositioned() && !is<InitialContainingBlock>(root))
+    if (!root.isPositioned() && !root.isInitialContainingBlock())
         return;
     // Collect the out-of-flow descendants at the formatting root level (as opposed to at the containing block level, though they might be the same).
     // FIXME: Turn this into a register-self as boxes are being inserted.

Modified: trunk/Source/WebCore/layout/FormattingContextQuirks.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/FormattingContextQuirks.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/FormattingContextQuirks.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -30,7 +30,6 @@
 
 #include "DisplayBox.h"
 #include "LayoutBox.h"
-#include "LayoutInitialContainingBlock.h"
 
 namespace WebCore {
 namespace Layout {
@@ -60,7 +59,7 @@
             bodyAndDocumentVerticalMarginPaddingAndBorder += verticalMargin.before.valueOr(0) + verticalMargin.after.valueOr(0) + verticalPadding + verticalBorder;
         }
 
-        if (is<InitialContainingBlock>(*containingBlock))
+        if (containingBlock->isInitialContainingBlock())
             break;
         containingBlock = &containingBlock->containingBlock();
     }

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -32,7 +32,6 @@
 #include "DisplayBox.h"
 #include "LayoutBox.h"
 #include "LayoutContainerBox.h"
-#include "LayoutInitialContainingBlock.h"
 #include "LayoutState.h"
 
 namespace WebCore {

Modified: trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -36,7 +36,6 @@
 #include "InlineTextItem.h"
 #include "IntRect.h"
 #include "LayoutContainerBox.h"
-#include "LayoutInitialContainingBlock.h"
 #include "LayoutState.h"
 #include "RenderStyle.h"
 #include "TextRun.h"
@@ -146,11 +145,11 @@
     // Should never really happen but table code is way too incomplete.
     if (!layoutState.hasDisplayBox(layoutBox))
         return { };
-    if (is<Layout::InitialContainingBlock>(layoutBox))
+    if (layoutBox.isInitialContainingBlock())
         return layoutState.displayBoxForLayoutBox(layoutBox);
 
     auto absoluteBox = Box { layoutState.displayBoxForLayoutBox(layoutBox) };
-    for (auto* containingBlock = &layoutBox.containingBlock(); !is<Layout::InitialContainingBlock>(*containingBlock); containingBlock = &containingBlock->containingBlock())
+    for (auto* containingBlock = &layoutBox.containingBlock(); !containingBlock->isInitialContainingBlock(); containingBlock = &containingBlock->containingBlock())
         absoluteBox.moveBy(layoutState.displayBoxForLayoutBox(*containingBlock).topLeft());
     return absoluteBox;
 }

Modified: trunk/Source/WebCore/layout/invalidation/InvalidationState.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/invalidation/InvalidationState.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/invalidation/InvalidationState.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -42,7 +42,7 @@
 void InvalidationState::markNeedsUpdate(const Box& layoutBox)
 {
     // We never lay out the initial containing block. It always has pre-determined geometry.
-    ASSERT(!is<InitialContainingBlock>(layoutBox));
+    ASSERT(!layoutBox.isInitialContainingBlock());
     // FIXME: This is just a placeholder implementation.
     m_formattingContextRoots.add(&layoutBox.formattingContextRoot());
 }

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -30,7 +30,6 @@
 
 #include "DisplayBox.h"
 #include "LayoutContainerBox.h"
-#include "LayoutInitialContainingBlock.h"
 #include "LayoutPhase.h"
 #include "LayoutState.h"
 #include "RenderStyle.h"
@@ -71,7 +70,7 @@
 bool Box::establishesBlockFormattingContext() const
 {
     // ICB always creates a new (inital) block formatting context.
-    if (is<ContainerBox>(*this))
+    if (isInitialContainingBlock())
         return true;
 
     if (isTableWrapperBox())
@@ -184,7 +183,7 @@
     // Finding the containing block by traversing the tree during tree construction could provide incorrect result.
     ASSERT(!Phase::isInTreeBuilding());
     // If we ever end up here with the ICB, we must be doing something not-so-great.
-    RELEASE_ASSERT(!is<InitialContainingBlock>(*this));
+    RELEASE_ASSERT(!isInitialContainingBlock());
     // The containing block in which the root element lives is a rectangle called the initial containing block.
     // For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the
     // content edge of the nearest block container ancestor box or which establishes a formatting context.
@@ -193,7 +192,7 @@
     // 'position' of 'absolute', 'relative' or 'fixed'.
     if (!isPositioned() || isInFlowPositioned()) {
         auto* ancestor = parent();
-        for (; !is<InitialContainingBlock>(*ancestor); ancestor = ancestor->parent()) {
+        for (; !ancestor->isInitialContainingBlock(); ancestor = ancestor->parent()) {
             if (ancestor->isBlockContainerBox() || ancestor->establishesFormattingContext())
                 return *ancestor;
         }
@@ -202,7 +201,7 @@
 
     if (isFixedPositioned()) {
         auto* ancestor = parent();
-        for (; !is<InitialContainingBlock>(*ancestor); ancestor = ancestor->parent()) {
+        for (; !ancestor->isInitialContainingBlock(); ancestor = ancestor->parent()) {
             if (ancestor->style().hasTransform())
                 return *ancestor;
         }
@@ -211,7 +210,7 @@
 
     if (isOutOfFlowPositioned()) {
         auto* ancestor = parent();
-        for (; !is<InitialContainingBlock>(*ancestor); ancestor = ancestor->parent()) {
+        for (; !ancestor->isInitialContainingBlock(); ancestor = ancestor->parent()) {
             if (ancestor->isPositioned() || ancestor->style().hasTransform())
                 return *ancestor;
         }
@@ -227,7 +226,7 @@
     // Finding the context root by traversing the tree during tree construction could provide incorrect result.
     ASSERT(!Phase::isInTreeBuilding());
     // We should never need to ask this question on the ICB.
-    ASSERT(!is<InitialContainingBlock>(*this));
+    ASSERT(!isInitialContainingBlock());
     // A box lives in the same formatting context as its containing block unless the containing block establishes a formatting context.
     // However relatively positioned (inflow) inline container lives in the formatting context where its parent lives unless
     // the parent establishes a formatting context.
@@ -241,26 +240,26 @@
     return ancestor.formattingContextRoot();
 }
 
-const InitialContainingBlock& Box::initialContainingBlock() const
+const ContainerBox& Box::initialContainingBlock() const
 {
-    if (is<InitialContainingBlock>(*this))
-        return downcast<InitialContainingBlock>(*this);
+    if (isInitialContainingBlock())
+        return downcast<ContainerBox>(*this);
 
     auto* ancestor = parent();
     for (; ancestor->parent(); ancestor = ancestor->parent()) { }
 
-    return downcast<InitialContainingBlock>(*ancestor);
+    return *ancestor;
 }
 
 bool Box::isInFormattingContextOf(const ContainerBox& formattingContextRoot) const
 { 
     ASSERT(formattingContextRoot.establishesFormattingContext());
-    ASSERT(!is<InitialContainingBlock>(*this));
+    ASSERT(!isInitialContainingBlock());
     auto* ancestor = &containingBlock();
     while (ancestor) {
         if (ancestor == &formattingContextRoot)
             return true;
-        if (is<InitialContainingBlock>(*ancestor))
+        if (ancestor->isInitialContainingBlock())
             return false;
         ancestor = &ancestor->containingBlock();
     }
@@ -361,7 +360,7 @@
             return isOverflowVisible;
         return true;
     }
-    if (is<InitialContainingBlock>(*this)) {
+    if (isInitialContainingBlock()) {
         auto* documentBox = downcast<ContainerBox>(*this).firstChild();
         if (!documentBox || !documentBox->isDocumentBox() || !is<ContainerBox>(documentBox))
             return isOverflowVisible;

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2020-03-23 18:49:09 UTC (rev 258864)
@@ -40,7 +40,6 @@
 namespace Layout {
 
 class ContainerBox;
-class InitialContainingBlock;
 class LayoutState;
 class TreeBuilder;
 
@@ -62,12 +61,12 @@
     };
 
     enum BaseTypeFlag {
-        BoxFlag                    = 1 << 0,
-        InlineTextBoxFlag          = 1 << 1,
-        LineBreakBoxFlag           = 1 << 2,
-        ReplacedBoxFlag            = 1 << 3,
-        InitialContainingBlockFlag = 1 << 4,
-        ContainerBoxFlag           = 1 << 5
+        BoxFlag                = 1 << 0,
+        InlineTextBox          = 1 << 1,
+        LineBreakBox           = 1 << 2,
+        ReplacedBox            = 1 << 3,
+        InitialContainingBlock = 1 << 4,
+        ContainerBoxFlag       = 1 << 5
     };
     typedef unsigned BaseTypeFlags;
 
@@ -97,7 +96,7 @@
 
     const ContainerBox& containingBlock() const;
     const ContainerBox& formattingContextRoot() const;
-    const InitialContainingBlock& initialContainingBlock() const;
+    const ContainerBox& initialContainingBlock() const;
 
     bool isInFormattingContextOf(const ContainerBox&) const;
 
@@ -110,7 +109,7 @@
     bool isInlineBlockBox() const;
     bool isInlineTableBox() const;
     bool isBlockContainerBox() const;
-    bool isInitialContainingBlock() const { return m_baseTypeFlags & InitialContainingBlockFlag; }
+    bool isInitialContainingBlock() const { return m_baseTypeFlags & InitialContainingBlock; }
 
     bool isDocumentBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Document; }
     bool isBodyBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Body; }
@@ -139,9 +138,9 @@
     Box* nextSibling() { return m_nextSibling; }
 
     bool isContainerBox() const { return m_baseTypeFlags & ContainerBoxFlag; }
-    bool isInlineTextBox() const { return m_baseTypeFlags & InlineTextBoxFlag; }
-    bool isLineBreakBox() const { return m_baseTypeFlags & LineBreakBoxFlag; }
-    bool isReplacedBox() const { return m_baseTypeFlags & ReplacedBoxFlag; }
+    bool isInlineTextBox() const { return m_baseTypeFlags & InlineTextBox; }
+    bool isLineBreakBox() const { return m_baseTypeFlags & LineBreakBox; }
+    bool isReplacedBox() const { return m_baseTypeFlags & ReplacedBox; }
 
     bool isPaddingApplicable() const;
     bool isOverflowVisible() const;

Modified: trunk/Source/WebCore/layout/layouttree/LayoutInitialContainingBlock.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutInitialContainingBlock.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutInitialContainingBlock.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -37,7 +37,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(InitialContainingBlock);
 
 InitialContainingBlock::InitialContainingBlock(RenderStyle&& style)
-    : ContainerBox({ }, WTFMove(style), Box::InitialContainingBlockFlag)
+    : ContainerBox({ }, WTFMove(style), Box::InitialContainingBlock)
 {
 }
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -37,7 +37,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineTextBox);
 
 InlineTextBox::InlineTextBox(String content, bool canUseSimplifiedContentMeasuring, RenderStyle&& style)
-    : Box({ }, WTFMove(style), Box::InlineTextBoxFlag)
+    : Box({ }, WTFMove(style), Box::InlineTextBox)
     , m_content(content)
     , m_canUseSimplifiedContentMeasuring(canUseSimplifiedContentMeasuring)
 {

Modified: trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -37,7 +37,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(LineBreakBox);
 
 LineBreakBox::LineBreakBox(bool isOptional, RenderStyle&& style)
-    : Box({ }, WTFMove(style), Box::LineBreakBoxFlag)
+    : Box({ }, WTFMove(style), Box::LineBreakBox)
     , m_isOptional(isOptional)
 {
 }

Modified: trunk/Source/WebCore/layout/layouttree/LayoutReplacedBox.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutReplacedBox.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutReplacedBox.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -37,7 +37,7 @@
 WTF_MAKE_ISO_ALLOCATED_IMPL(ReplacedBox);
 
 ReplacedBox::ReplacedBox(RenderStyle&& style)
-    : Box({ }, WTFMove(style), Box::ReplacedBoxFlag)
+    : Box({ }, WTFMove(style), Box::ReplacedBox)
 {
 }
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (258863 => 258864)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-03-23 18:47:48 UTC (rev 258863)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-03-23 18:49:09 UTC (rev 258864)
@@ -394,7 +394,7 @@
     if (layoutBox.isFloatingPositioned())
         stream << "[float] ";
 
-    if (is<InitialContainingBlock>(layoutBox))
+    if (layoutBox.isInitialContainingBlock())
         stream << "Initial containing block";
     else if (layoutBox.isDocumentBox())
         stream << "HTML";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to