Title: [237729] trunk/Source/WebCore
Revision
237729
Author
za...@apple.com
Date
2018-11-02 06:41:05 -0700 (Fri, 02 Nov 2018)

Log Message

[LFC] Align shrink-to-fit width computation with the layout implementation.
https://bugs.webkit.org/show_bug.cgi?id=191179

Reviewed by Antti Koivisto.

There are many similarities between layout and shrink-to-fit.
They both operate on formatting roots only (shrink-to-fit -> float, out-of-flow, inline-block) and in both cases
the algoritm depends on what type of formatting context the element establishes.

This patch is in preparation for transforming the "shrink-to-fit" width computation to make it behave more like layout.
With this change the instrinsicWidthConstraints() computation happens in the formatting context that the element establishes (similar to layout).

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
* layout/FormattingContext.h:
(WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
(WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
(WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237728 => 237729)


--- trunk/Source/WebCore/ChangeLog	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/ChangeLog	2018-11-02 13:41:05 UTC (rev 237729)
@@ -1,3 +1,41 @@
+2018-11-02  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] Align shrink-to-fit width computation with the layout implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=191179
+
+        Reviewed by Antti Koivisto.
+
+        There are many similarities between layout and shrink-to-fit.
+        They both operate on formatting roots only (shrink-to-fit -> float, out-of-flow, inline-block) and in both cases
+        the algoritm depends on what type of formatting context the element establishes.
+
+        This patch is in preparation for transforming the "shrink-to-fit" width computation to make it behave more like layout.
+        With this change the instrinsicWidthConstraints() computation happens in the formatting context that the element establishes (similar to layout).
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
+        * layout/FormattingContext.h:
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
+        (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
+        (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
+
 2018-11-01  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Make document.getAnimations() return declarative animations in the correct order

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (237728 => 237729)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2018-11-02 13:41:05 UTC (rev 237729)
@@ -68,7 +68,7 @@
     auto& layoutState = this->layoutState();
 
     auto compute = [&](std::optional<LayoutUnit> usedWidth) {
-        return Geometry::outOfFlowHorizontalGeometry(layoutState, *this, layoutBox, usedWidth);
+        return Geometry::outOfFlowHorizontalGeometry(layoutState, layoutBox, usedWidth);
     };
 
     auto horizontalGeometry = compute({ });

Modified: trunk/Source/WebCore/layout/FormattingContext.h (237728 => 237729)


--- trunk/Source/WebCore/layout/FormattingContext.h	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2018-11-02 13:41:05 UTC (rev 237729)
@@ -56,7 +56,7 @@
         LayoutUnit minimum;
         LayoutUnit maximum;
     };
-    virtual InstrinsicWidthConstraints instrinsicWidthConstraints(const Box&) const = 0;
+    virtual InstrinsicWidthConstraints instrinsicWidthConstraints() const = 0;
 
     static Display::Box mapBoxToAncestor(const LayoutState&, const Box&, const Container& ancestor);
     static Position mapTopLeftToAncestor(const LayoutState&, const Box&, const Container& ancestor);
@@ -84,10 +84,10 @@
     class Geometry {
     public:
         static VerticalGeometry outOfFlowVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
         static HeightAndMargin floatingHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static WidthAndMargin floatingWidthAndMargin(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static WidthAndMargin floatingWidthAndMargin(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
         static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
         static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }, 
@@ -94,7 +94,7 @@
             std::optional<LayoutUnit> precomputedMarginLeft = { }, std::optional<LayoutUnit> precomputedMarginRight = { });
 
         static HeightAndMargin complicatedCases(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static LayoutUnit shrinkToFitWidth(const LayoutState&, const FormattingContext&, const Box&);
+        static LayoutUnit shrinkToFitWidth(LayoutState&, const Box&);
 
         static Edges computedBorder(const LayoutState&, const Box&);
         static std::optional<Edges> computedPadding(const LayoutState&, const Box&);
@@ -113,12 +113,12 @@
         static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
         static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
         static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
         static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
     };
 
 private:

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (237728 => 237729)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-11-02 13:41:05 UTC (rev 237729)
@@ -208,9 +208,11 @@
     return left;
 }
 
-LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(const LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox)
+LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutState& layoutState, const Box& formattingRoot)
 {
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width] -> shrink to fit -> unsupported -> width(" << LayoutUnit { } << "px) layoutBox: " << &layoutBox << ")");
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width] -> shrink to fit -> unsupported -> width(" << LayoutUnit { } << "px) layoutBox: " << &formattingRoot << ")");
+    ASSERT(formattingRoot.establishesFormattingContext());
+
     // Calculation of the shrink-to-fit width is similar to calculating the width of a table cell using the automatic table layout algorithm.
     // Roughly: calculate the preferred width by formatting the content without breaking lines other than where explicit line breaks occur,
     // and also calculate the preferred minimum width, e.g., by trying all possible line breaks. CSS 2.2 does not define the exact algorithm.
@@ -218,8 +220,9 @@
     // 'padding-left', 'padding-right', 'border-right-width', 'margin-right', and the widths of any relevant scroll bars.
 
     // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width).
-    auto availableWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).width();
-    auto instrinsicWidthConstraints = formattingContext.instrinsicWidthConstraints(layoutBox);
+    auto availableWidth = layoutState.displayBoxForLayoutBox(*formattingRoot.containingBlock()).width();
+    auto& formattingState = layoutState.createFormattingStateForFormattingRootIfNeeded(formattingRoot);
+    auto instrinsicWidthConstraints = formattingState.formattingContext(formattingRoot)->instrinsicWidthConstraints();
     return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum);
 }
 
@@ -339,7 +342,7 @@
     return { *top, *bottom, { *height, { *marginTop, *marginBottom }, { } } };
 }
 
-HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
     
@@ -448,7 +451,7 @@
 
     if (!left && !width && right) {
         // #1
-        width = shrinkToFitWidth(layoutState, formattingContext, layoutBox);
+        width = shrinkToFitWidth(layoutState, layoutBox);
         left = containingBlockWidth - (*marginLeft + borderLeft + paddingLeft + *width + paddingRight  + borderRight + *marginRight + *right);
     } else if (!left && !right && width) {
         // #2
@@ -462,7 +465,7 @@
         }
     } else if (!width && !right && left) {
         // #3
-        width = shrinkToFitWidth(layoutState, formattingContext, layoutBox);
+        width = shrinkToFitWidth(layoutState, layoutBox);
         right = containingBlockWidth - (*left + *marginLeft + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginRight);
     } else if (!left && width && right) {
         // #4
@@ -695,7 +698,7 @@
     return HeightAndMargin { *height, { *marginTop, *marginBottom }, { } };
 }
 
-WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
 
@@ -712,7 +715,7 @@
     // #2
     auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : layoutBox.style().logicalWidth(), containingBlockWidth);
     if (!width)
-        width = shrinkToFitWidth(layoutState, formattingContext, layoutBox);
+        width = shrinkToFitWidth(layoutState, layoutBox);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> floating non-replaced -> width(" << *width << "px) margin(" << margin.left << "px, " << margin.right << "px) -> layoutBox(" << &layoutBox << ")");
     return WidthAndMargin { *width, margin, margin };
@@ -751,12 +754,12 @@
     return outOfFlowReplacedVerticalGeometry(layoutState, layoutBox, usedHeight);
 }
 
-HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned());
 
     if (!layoutBox.replaced())
-        return outOfFlowNonReplacedHorizontalGeometry(layoutState, formattingContext, layoutBox, usedWidth);
+        return outOfFlowNonReplacedHorizontalGeometry(layoutState, layoutBox, usedWidth);
     return outOfFlowReplacedHorizontalGeometry(layoutState, layoutBox, usedWidth);
 }
 
@@ -769,12 +772,12 @@
     return floatingReplacedHeightAndMargin(layoutState, layoutBox, usedHeight);
 }
 
-WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isFloatingPositioned());
 
     if (!layoutBox.replaced())
-        return floatingNonReplacedWidthAndMargin(layoutState, formattingContext, layoutBox, usedWidth);
+        return floatingNonReplacedWidthAndMargin(layoutState, layoutBox, usedWidth);
     return floatingReplacedWidthAndMargin(layoutState, layoutBox, usedWidth);
 }
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (237728 => 237729)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2018-11-02 13:41:05 UTC (rev 237729)
@@ -290,7 +290,7 @@
             return Geometry::inFlowWidthAndMargin(layoutState, layoutBox, usedWidth);
 
         if (layoutBox.isFloatingPositioned())
-            return Geometry::floatingWidthAndMargin(layoutState, *this, layoutBox, usedWidth);
+            return Geometry::floatingWidthAndMargin(layoutState, layoutBox, usedWidth);
 
         ASSERT_NOT_REACHED();
         return { };
@@ -357,18 +357,18 @@
         displayBox.moveVertically(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin).top);
 }
 
-FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsicWidthConstraints(const Box& layoutBox) const
+FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsicWidthConstraints() const
 {
     auto& layoutState = this->layoutState();
-    auto& formattingState = layoutState.formattingStateForBox(layoutBox);
-    ASSERT(formattingState.isBlockFormattingState());
-    if (auto instrinsicWidthConstraints = formattingState.instrinsicWidthConstraints(layoutBox))
+    auto& formattingRoot = root();
+    auto& formattingStateForRoot = layoutState.formattingStateForBox(formattingRoot);
+    if (auto instrinsicWidthConstraints = formattingStateForRoot.instrinsicWidthConstraints(formattingRoot))
         return *instrinsicWidthConstraints;
 
     // Can we just compute them without checking the children?
-    if (!Geometry::instrinsicWidthConstraintsNeedChildrenWidth(layoutBox)) {
-        auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, layoutBox);
-        formattingState.setInstrinsicWidthConstraints(layoutBox, instrinsicWidthConstraints);
+    if (!Geometry::instrinsicWidthConstraintsNeedChildrenWidth(formattingRoot)) {
+        auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, formattingRoot);
+        formattingStateForRoot.setInstrinsicWidthConstraints(formattingRoot, instrinsicWidthConstraints);
         return instrinsicWidthConstraints;
     }
 
@@ -379,25 +379,25 @@
     // (Any subtrees with new formatting contexts need to layout synchronously)
     Vector<const Box*> queue;
     // Non-containers early return.
-    ASSERT(is<Container>(layoutBox));
-    if (auto* firstChild = downcast<Container>(layoutBox).firstInFlowOrFloatingChild())
+    ASSERT(is<Container>(formattingRoot));
+    if (auto* firstChild = downcast<Container>(formattingRoot).firstInFlowOrFloatingChild())
         queue.append(firstChild);
 
-    auto& formattingStateForChildren = layoutBox.establishesFormattingContext() ? layoutState.createFormattingStateForFormattingRootIfNeeded(layoutBox) : formattingState;
+    auto& formattingState = this->formattingState();
     while (!queue.isEmpty()) {
         while (true) {
             auto& childBox = *queue.last(); 
             // Already computed?
-            auto instrinsicWidthConstraints = formattingStateForChildren.instrinsicWidthConstraints(childBox);
+            auto instrinsicWidthConstraints = formattingState.instrinsicWidthConstraints(childBox);
             // Can we just compute them without checking the children?
             if (!instrinsicWidthConstraints && !Geometry::instrinsicWidthConstraintsNeedChildrenWidth(childBox))
                 instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, childBox);
             // Is it a formatting context root?
             if (!instrinsicWidthConstraints && childBox.establishesFormattingContext())
-                instrinsicWidthConstraints = formattingStateForChildren.formattingContext(childBox)->instrinsicWidthConstraints(childBox);
+                instrinsicWidthConstraints = formattingState.formattingContext(childBox)->instrinsicWidthConstraints();
             // Go to the next sibling (and skip the descendants) if this box's min/max width is computed.
             if (instrinsicWidthConstraints) {
-                formattingStateForChildren.setInstrinsicWidthConstraints(childBox, *instrinsicWidthConstraints); 
+                formattingState.setInstrinsicWidthConstraints(childBox, *instrinsicWidthConstraints); 
                 queue.removeLast();
                 if (!childBox.nextInFlowOrFloatingSibling())
                     break;
@@ -414,7 +414,7 @@
         // Compute min/max intrinsic width bottom up.
         while (!queue.isEmpty()) {
             auto& childBox = *queue.takeLast();
-            formattingStateForChildren.setInstrinsicWidthConstraints(childBox, Geometry::instrinsicWidthConstraints(layoutState, childBox)); 
+            formattingState.setInstrinsicWidthConstraints(childBox, Geometry::instrinsicWidthConstraints(layoutState, childBox)); 
             // Move over to the next sibling or take the next box in the queue.
             if (!is<Container>(childBox) || !downcast<Container>(childBox).nextInFlowOrFloatingSibling())
                 continue;
@@ -422,8 +422,8 @@
         }
     }
 
-    auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, layoutBox);
-    formattingState.setInstrinsicWidthConstraints(layoutBox, instrinsicWidthConstraints); 
+    auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, formattingRoot);
+    formattingStateForRoot.setInstrinsicWidthConstraints(formattingRoot, instrinsicWidthConstraints); 
     return instrinsicWidthConstraints;
 }
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (237728 => 237729)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2018-11-02 13:41:05 UTC (rev 237729)
@@ -66,7 +66,7 @@
 
     void precomputeVerticalPositionForFormattingRootIfNeeded(const Box&) const;
 
-    InstrinsicWidthConstraints instrinsicWidthConstraints(const Box&) const override;
+    InstrinsicWidthConstraints instrinsicWidthConstraints() const override;
 
     // This class implements positioning and sizing for boxes participating in a block formatting context.
     class Geometry : public FormattingContext::Geometry {

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (237728 => 237729)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-02 13:41:05 UTC (rev 237729)
@@ -215,7 +215,7 @@
         WidthAndMargin widthAndMargin;
 
         if (layoutBox.isFloatingPositioned())
-            widthAndMargin = Geometry::floatingWidthAndMargin(layoutState, *this, layoutBox);
+            widthAndMargin = Geometry::floatingWidthAndMargin(layoutState, layoutBox);
         else if (layoutBox.isInlineBlockBox())
             widthAndMargin = Geometry::inlineBlockWidthAndMargin(layoutState, layoutBox);
         else
@@ -301,7 +301,7 @@
 {
 }
 
-FormattingContext::InstrinsicWidthConstraints InlineFormattingContext::instrinsicWidthConstraints(const Box&) const
+FormattingContext::InstrinsicWidthConstraints InlineFormattingContext::instrinsicWidthConstraints() const
 {
     return { };
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (237728 => 237729)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2018-11-02 13:41:05 UTC (rev 237729)
@@ -99,7 +99,7 @@
     class Geometry : public FormattingContext::Geometry {
     public:
         static HeightAndMargin inlineBlockHeightAndMargin(const LayoutState&, const Box&);
-        static WidthAndMargin inlineBlockWidthAndMargin(const LayoutState&, const Box&);
+        static WidthAndMargin inlineBlockWidthAndMargin(LayoutState&, const Box&);
     };
 
     void layoutInlineContent(const InlineRunProvider&) const;
@@ -111,7 +111,7 @@
     void computeStaticPosition(const Box&) const override;
     void computeInFlowPositionedPosition(const Box&) const override;
 
-    InstrinsicWidthConstraints instrinsicWidthConstraints(const Box&) const override;
+    InstrinsicWidthConstraints instrinsicWidthConstraints() const override;
 };
 
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (237728 => 237729)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2018-11-02 10:46:34 UTC (rev 237728)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2018-11-02 13:41:05 UTC (rev 237729)
@@ -37,7 +37,7 @@
 namespace WebCore {
 namespace Layout {
 
-WidthAndMargin InlineFormattingContext::Geometry::inlineBlockWidthAndMargin(const LayoutState& layoutState, const Box& formattingContextRoot)
+WidthAndMargin InlineFormattingContext::Geometry::inlineBlockWidthAndMargin(LayoutState& layoutState, const Box& formattingContextRoot)
 {
     ASSERT(formattingContextRoot.isInFlow());
 
@@ -55,10 +55,8 @@
     auto containingBlockWidth = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
     // #1
     auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), containingBlockWidth);
-    if (!width) {
-        auto formattingContext = layoutState.establishedFormattingState(formattingContextRoot).formattingContext(formattingContextRoot);
-        width = shrinkToFitWidth(layoutState, *formattingContext, formattingContextRoot);
-    }
+    if (!width)
+        width = shrinkToFitWidth(layoutState, formattingContextRoot);
 
     // #2
     auto margin = computedNonCollapsedHorizontalMarginValue(layoutState, formattingContextRoot);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to