Title: [250056] trunk/Source/WebCore
Revision
250056
Author
[email protected]
Date
2019-09-18 14:48:03 -0700 (Wed, 18 Sep 2019)

Log Message

[LFC] Introduce UsedVerticalValues::Constraints
https://bugs.webkit.org/show_bug.cgi?id=201933
<rdar://problem/55487485>

Reviewed by Antti Koivisto.

UsedVerticalValues::Constraints holds the constraint values ((optional)containing block height and contentbox top) for a particular box geometry computation.
This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
See webkit.org/b/201795

* layout/FormattingContext.cpp:
(WebCore::Layout::outOfFlowHorizontalConstraints):
(WebCore::Layout::outOfFlowVerticalConstraints):
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
(WebCore::Layout::outOfFlowConstraints): Deleted.
* layout/FormattingContext.h:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
* layout/LayoutUnits.cpp:
(WebCore::Layout::UsedVerticalValues::Constraints::Constraints):
* layout/LayoutUnits.h:
(WebCore::Layout::UsedVerticalValues::Constraints::Constraints):
(WebCore::Layout::UsedVerticalValues::UsedVerticalValues):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::staticVerticalPosition const):
(WebCore::Layout::BlockFormattingContext::Geometry::staticPosition const):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250055 => 250056)


--- trunk/Source/WebCore/ChangeLog	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/ChangeLog	2019-09-18 21:48:03 UTC (rev 250056)
@@ -1,3 +1,46 @@
+2019-09-18  Zalan Bujtas  <[email protected]>
+
+        [LFC] Introduce UsedVerticalValues::Constraints
+        https://bugs.webkit.org/show_bug.cgi?id=201933
+        <rdar://problem/55487485>
+
+        Reviewed by Antti Koivisto.
+
+        UsedVerticalValues::Constraints holds the constraint values ((optional)containing block height and contentbox top) for a particular box geometry computation. 
+        This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
+        See webkit.org/b/201795
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::outOfFlowHorizontalConstraints):
+        (WebCore::Layout::outOfFlowVerticalConstraints):
+        (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
+        (WebCore::Layout::outOfFlowConstraints): Deleted.
+        * layout/FormattingContext.h:
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
+        * layout/LayoutUnits.cpp:
+        (WebCore::Layout::UsedVerticalValues::Constraints::Constraints):
+        * layout/LayoutUnits.h:
+        (WebCore::Layout::UsedVerticalValues::Constraints::Constraints):
+        (WebCore::Layout::UsedVerticalValues::UsedVerticalValues):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition):
+        (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::staticVerticalPosition const):
+        (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition const):
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin const):
+
 2019-09-18  Chris Dumez  <[email protected]>
 
         Unreviewed, WinCairo build fix after r250045.

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -43,11 +43,16 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingContext);
 
-static UsedHorizontalValues::Constraints outOfFlowConstraints(const Display::Box& containingBlockGeometry)
+static UsedHorizontalValues::Constraints outOfFlowHorizontalConstraints(const Display::Box& containingBlockGeometry)
 {
     return UsedHorizontalValues::Constraints { containingBlockGeometry.paddingBoxLeft(), containingBlockGeometry.paddingBoxWidth() };
 }
 
+static UsedVerticalValues::Constraints outOfFlowVerticalConstraints(const Display::Box& containingBlockGeometry)
+{
+    return UsedVerticalValues::Constraints { containingBlockGeometry.paddingBoxTop(), containingBlockGeometry.paddingBoxHeight() };
+}
+
 FormattingContext::FormattingContext(const Container& formattingContextRoot, FormattingState& formattingState)
     : m_root(makeWeakPtr(formattingContextRoot))
     , m_formattingState(formattingState)
@@ -73,11 +78,10 @@
 {
     auto& containingBlockGeometry = geometryForBox(*layoutBox.containingBlock());
     auto containingBlockWidth = containingBlockGeometry.paddingBoxWidth();
-    auto containingBlockHeight = containingBlockGeometry.paddingBoxHeight();
 
     auto compute = [&](Optional<LayoutUnit> usedWidth) {
-        auto usedHorizontalValues = UsedHorizontalValues { outOfFlowConstraints(containingBlockGeometry), usedWidth, { } };
-        auto usedVerticalValues = UsedVerticalValues { containingBlockHeight, { } };
+        auto usedHorizontalValues = UsedHorizontalValues { outOfFlowHorizontalConstraints(containingBlockGeometry), usedWidth, { } };
+        auto usedVerticalValues = UsedVerticalValues { outOfFlowVerticalConstraints(containingBlockGeometry), { } };
         return geometry().outOfFlowHorizontalGeometry(layoutBox, usedHorizontalValues, usedVerticalValues);
     };
 
@@ -109,12 +113,12 @@
     auto& containingBlockGeometry = geometryForBox(*layoutBox.containingBlock());
     auto containingBlockHeight = containingBlockGeometry.paddingBoxHeight();
 
-    auto usedVerticalValuesForHeight = UsedVerticalValues { containingBlockHeight, { } };
-    auto usedHorizontalValues = UsedHorizontalValues { outOfFlowConstraints(containingBlockGeometry) };
+    auto usedVerticalValuesForHeight = UsedVerticalValues { outOfFlowVerticalConstraints(containingBlockGeometry), { } };
+    auto usedHorizontalValues = UsedHorizontalValues { outOfFlowHorizontalConstraints(containingBlockGeometry) };
 
     auto verticalGeometry = compute(usedHorizontalValues, usedVerticalValuesForHeight);
     if (auto maxHeight = geometry().computedMaxHeight(layoutBox, containingBlockHeight)) {
-        auto usedValuesForMaxHeight = UsedVerticalValues { containingBlockHeight, maxHeight };
+        auto usedValuesForMaxHeight = UsedVerticalValues { outOfFlowVerticalConstraints(containingBlockGeometry), maxHeight };
         auto maxVerticalGeometry = compute(usedHorizontalValues, usedValuesForMaxHeight);
         if (verticalGeometry.heightAndMargin.height > maxVerticalGeometry.heightAndMargin.height)
             verticalGeometry = maxVerticalGeometry;
@@ -121,7 +125,7 @@
     }
 
     if (auto minHeight = geometry().computedMinHeight(layoutBox, containingBlockHeight)) {
-        auto usedValuesForMinHeight = UsedVerticalValues { containingBlockHeight, minHeight };
+        auto usedValuesForMinHeight = UsedVerticalValues { outOfFlowVerticalConstraints(containingBlockGeometry), minHeight };
         auto minVerticalGeometry = compute(usedHorizontalValues, usedValuesForMinHeight);
         if (verticalGeometry.heightAndMargin.height < minVerticalGeometry.heightAndMargin.height)
             verticalGeometry = minVerticalGeometry;

Modified: trunk/Source/WebCore/layout/FormattingContext.h (250055 => 250056)


--- trunk/Source/WebCore/layout/FormattingContext.h	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2019-09-18 21:48:03 UTC (rev 250056)
@@ -146,7 +146,7 @@
 
         WidthAndMargin floatingNonReplacedWidthAndMargin(const Box&, UsedHorizontalValues);
 
-        LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const Box&) const;
+        LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const Box&, UsedVerticalValues) const;
         LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const Box&, UsedHorizontalValues) const;
 
         const FormattingContext& m_formattingContext;

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -182,7 +182,7 @@
     return { LayoutUnit { } };
 }
 
-LayoutUnit FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned(const Box& layoutBox) const
+LayoutUnit FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned(const Box& layoutBox, UsedVerticalValues usedVerticalValues) const
 {
     ASSERT(layoutBox.isOutOfFlowPositioned());
 
@@ -214,8 +214,7 @@
         ASSERT(!container->isPositioned() || layoutBox.isFixedPositioned());
     }
     // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes.
-    auto paddingBoxTop = formattingContext.geometryForBox(containingBlock).paddingBoxTop();
-    return top - paddingBoxTop;
+    return top - usedVerticalValues.constraints.contentBoxTop;
 }
 
 LayoutUnit FormattingContext::Geometry::staticHorizontalPositionForOutOfFlowPositioned(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
@@ -269,7 +268,7 @@
 VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues, UsedVerticalValues usedVerticalValues) const
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
-    ASSERT(usedVerticalValues.containingBlockHeight);
+    ASSERT(usedVerticalValues.constraints.height);
 
     // 10.6.4 Absolutely positioned, non-replaced elements
     //
@@ -298,7 +297,7 @@
     auto& formattingContext = this->formattingContext();
     auto& style = layoutBox.style();
     auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
-    auto containingBlockHeight = *usedVerticalValues.containingBlockHeight;
+    auto containingBlockHeight = *usedVerticalValues.constraints.height;
     auto containingBlockWidth = usedHorizontalValues.constraints.width;
 
     auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
@@ -316,7 +315,7 @@
     };
 
     if (!top && !height && !bottom)
-        top = staticVerticalPositionForOutOfFlowPositioned(layoutBox);
+        top = staticVerticalPositionForOutOfFlowPositioned(layoutBox, usedVerticalValues);
 
     if (top && height && bottom) {
         if (!computedVerticalMargin.before && !computedVerticalMargin.after) {
@@ -345,7 +344,7 @@
 
     if (!top && !bottom && height) {
         // #2
-        top = staticVerticalPositionForOutOfFlowPositioned(layoutBox);
+        top = staticVerticalPositionForOutOfFlowPositioned(layoutBox, usedVerticalValues);
         usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
         bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + contentHeight() + paddingBottom + borderBottom + usedVerticalMargin.after);
     }
@@ -381,7 +380,7 @@
 
     // For out-of-flow elements the containing block is formed by the padding edge of the ancestor.
     // At this point the positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system.
-    auto containingBlockPaddingVerticalEdge = formattingContext.geometryForBox(*layoutBox.containingBlock()).paddingBoxTop();
+    auto containingBlockPaddingVerticalEdge = usedVerticalValues.constraints.contentBoxTop;
     *top += containingBlockPaddingVerticalEdge;
     *bottom += containingBlockPaddingVerticalEdge;
 
@@ -540,7 +539,7 @@
 VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues, UsedVerticalValues usedVerticalValues) const
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
-    ASSERT(usedVerticalValues.containingBlockHeight);
+    ASSERT(usedVerticalValues.constraints.height);
 
     // 10.6.5 Absolutely positioned, replaced elements
     //
@@ -555,7 +554,7 @@
     auto& formattingContext = this->formattingContext();
     auto& style = layoutBox.style();
     auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
-    auto containingBlockHeight = *usedVerticalValues.containingBlockHeight;
+    auto containingBlockHeight = *usedVerticalValues.constraints.height;
     auto containingBlockWidth = usedHorizontalValues.constraints.width;
 
     auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
@@ -571,7 +570,7 @@
 
     if (!top && !bottom) {
         // #1
-        top = staticVerticalPositionForOutOfFlowPositioned(layoutBox);
+        top = staticVerticalPositionForOutOfFlowPositioned(layoutBox, usedVerticalValues);
     }
 
     if (!bottom) {
@@ -607,7 +606,7 @@
 
     // For out-of-flow elements the containing block is formed by the padding edge of the ancestor.
     // At this point the positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system.
-    auto containingBlockPaddingVerticalEdge = formattingContext.geometryForBox(*layoutBox.containingBlock()).paddingBoxTop();
+    auto containingBlockPaddingVerticalEdge = usedVerticalValues.constraints.contentBoxTop;
     *top += containingBlockPaddingVerticalEdge;
     *bottom += containingBlockPaddingVerticalEdge;
 
@@ -858,7 +857,7 @@
     auto& style = layoutBox.style();
     auto replaced = layoutBox.replaced();
 
-    auto height = usedVerticalValues.height ? usedVerticalValues.height.value() : computedHeightValue(layoutBox, HeightType::Normal, usedVerticalValues.containingBlockHeight);
+    auto height = usedVerticalValues.height ? usedVerticalValues.height.value() : computedHeightValue(layoutBox, HeightType::Normal, usedVerticalValues.constraints.height);
     auto heightIsAuto = !usedVerticalValues.height && isHeightAuto(layoutBox);
     auto widthIsAuto = style.logicalWidth().isAuto();
 
@@ -927,7 +926,7 @@
 
     auto width = computedValueIfNotAuto(usedHorizontalValues.width ? Length { usedHorizontalValues.width.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
     auto heightIsAuto = isHeightAuto(layoutBox);
-    auto height = computedHeightValue(layoutBox, HeightType::Normal, usedVerticalValues ? usedVerticalValues->containingBlockHeight : WTF::nullopt);
+    auto height = computedHeightValue(layoutBox, HeightType::Normal, usedVerticalValues ? usedVerticalValues->constraints.height : WTF::nullopt);
 
     if (!width && heightIsAuto && replaced->hasIntrinsicWidth()) {
         // #1

Modified: trunk/Source/WebCore/layout/LayoutUnits.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/LayoutUnits.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/LayoutUnits.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -39,6 +39,11 @@
 {
 }
 
+UsedVerticalValues::Constraints::Constraints(const Display::Box& containingBlockGeometry)
+    : contentBoxTop(containingBlockGeometry.contentBoxTop())
+{
 }
+
 }
+}
 #endif

Modified: trunk/Source/WebCore/layout/LayoutUnits.h (250055 => 250056)


--- trunk/Source/WebCore/layout/LayoutUnits.h	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/LayoutUnits.h	2019-09-18 21:48:03 UTC (rev 250056)
@@ -173,7 +173,25 @@
 };
 
 struct UsedVerticalValues {
-    Optional<LayoutUnit> containingBlockHeight;
+    struct Constraints {
+        explicit Constraints(const Display::Box& containingBlockGeometry);
+        explicit Constraints(LayoutUnit contentBoxTop, Optional<LayoutUnit> verticalConstraint = WTF::nullopt)
+            : contentBoxTop(contentBoxTop)
+            , height(verticalConstraint)
+        {
+        }
+
+        LayoutUnit contentBoxTop;
+        Optional<LayoutUnit> height;
+    };
+
+    explicit UsedVerticalValues(Constraints constraints, Optional<LayoutUnit> height = { })
+        : constraints(constraints)
+        , height(height)
+    {
+    }
+
+    Constraints constraints;
     Optional<LayoutUnit> height;
 };
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -212,7 +212,8 @@
 
 void BlockFormattingContext::computeStaticVerticalPosition(const FloatingContext& floatingContext, const Box& layoutBox)
 {
-    formattingState().displayBox(layoutBox).setTop(geometry().staticVerticalPosition(layoutBox));
+    auto usedVerticalValues = UsedVerticalValues { UsedVerticalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
+    formattingState().displayBox(layoutBox).setTop(geometry().staticVerticalPosition(layoutBox, usedVerticalValues));
     if (layoutBox.hasFloatClear())
         computeEstimatedVerticalPositionForFloatClear(floatingContext, layoutBox);
     else if (layoutBox.establishesFormattingContext())
@@ -392,9 +393,10 @@
 
 void BlockFormattingContext::computeHeightAndMargin(const Box& layoutBox)
 {
+    auto& containingBlockGeometry = geometryForBox(*layoutBox.containingBlock());
     auto compute = [&](auto usedVerticalValues) -> HeightAndMargin {
 
-        auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
+        auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { containingBlockGeometry } };
         if (layoutBox.isInFlow())
             return geometry().inFlowHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
 
@@ -405,10 +407,11 @@
         return { };
     };
 
-    auto heightAndMargin = compute(UsedVerticalValues { });
+    auto verticalConstraints = UsedVerticalValues::Constraints { containingBlockGeometry };
+    auto heightAndMargin = compute(UsedVerticalValues { verticalConstraints });
     if (auto maxHeight = geometry().computedMaxHeight(layoutBox)) {
         if (heightAndMargin.height > *maxHeight) {
-            auto maxHeightAndMargin = compute(UsedVerticalValues { { }, *maxHeight });
+            auto maxHeightAndMargin = compute(UsedVerticalValues { verticalConstraints, maxHeight });
             // Used height should remain the same.
             ASSERT((layoutState().inQuirksMode() && (layoutBox.isBodyBox() || layoutBox.isDocumentBox())) || maxHeightAndMargin.height == *maxHeight);
             heightAndMargin = { *maxHeight, maxHeightAndMargin.nonCollapsedMargin };
@@ -417,7 +420,7 @@
 
     if (auto minHeight = geometry().computedMinHeight(layoutBox)) {
         if (heightAndMargin.height < *minHeight) {
-            auto minHeightAndMargin = compute(UsedVerticalValues { { }, *minHeight });
+            auto minHeightAndMargin = compute(UsedVerticalValues { verticalConstraints, minHeight });
             // Used height should remain the same.
             ASSERT((layoutState().inQuirksMode() && (layoutBox.isBodyBox() || layoutBox.isDocumentBox())) || minHeightAndMargin.height == *minHeight);
             heightAndMargin = { *minHeight, minHeightAndMargin.nonCollapsedMargin };

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (250055 => 250056)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2019-09-18 21:48:03 UTC (rev 250056)
@@ -78,8 +78,8 @@
         HeightAndMargin inFlowHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues);
         WidthAndMargin inFlowWidthAndMargin(const Box&, UsedHorizontalValues);
 
-        Point staticPosition(const Box&, UsedHorizontalValues) const;
-        LayoutUnit staticVerticalPosition(const Box&) const;
+        Point staticPosition(const Box&, UsedHorizontalValues, UsedVerticalValues) const;
+        LayoutUnit staticVerticalPosition(const Box&, UsedVerticalValues) const;
         LayoutUnit staticHorizontalPosition(const Box&, UsedHorizontalValues) const;
 
         IntrinsicWidthConstraints intrinsicWidthConstraints(const Box&);

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -221,7 +221,7 @@
     return { *usedValues.width, nonReplacedWidthAndMargin.usedMargin, nonReplacedWidthAndMargin.computedMargin };
 }
 
-LayoutUnit BlockFormattingContext::Geometry::staticVerticalPosition(const Box& layoutBox) const
+LayoutUnit BlockFormattingContext::Geometry::staticVerticalPosition(const Box& layoutBox, UsedVerticalValues usedVerticalValues) const
 {
     // https://www.w3.org/TR/CSS22/visuren.html#block-formatting
     // In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
@@ -231,7 +231,7 @@
         auto& previousInFlowBoxGeometry = formattingContext().geometryForBox(*previousInFlowSibling);
         return previousInFlowBoxGeometry.bottom() + previousInFlowBoxGeometry.marginAfter();
     }
-    return formattingContext().geometryForBox(*layoutBox.containingBlock()).contentBoxTop();
+    return usedVerticalValues.constraints.contentBoxTop;
 }
 
 LayoutUnit BlockFormattingContext::Geometry::staticHorizontalPosition(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
@@ -241,9 +241,9 @@
     return usedHorizontalValues.constraints.contentBoxLeft + formattingContext().geometryForBox(layoutBox).marginStart();
 }
 
-Point BlockFormattingContext::Geometry::staticPosition(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
+Point BlockFormattingContext::Geometry::staticPosition(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues, UsedVerticalValues usedVerticalValues) const
 {
-    return { staticHorizontalPosition(layoutBox, usedHorizontalValues), staticVerticalPosition(layoutBox) };
+    return { staticHorizontalPosition(layoutBox, usedHorizontalValues), staticVerticalPosition(layoutBox, usedVerticalValues) };
 }
 
 HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues, UsedVerticalValues usedVerticalValues)

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -210,13 +210,15 @@
 void InlineFormattingContext::computeHeightAndMargin(const Box& layoutBox)
 {
     HeightAndMargin heightAndMargin;
-    auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
+    auto& containingBlockGeometry = geometryForBox(*layoutBox.containingBlock());
+    auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { containingBlockGeometry } };
+    auto usedVerticalValues = UsedVerticalValues { UsedVerticalValues::Constraints { containingBlockGeometry } };
     if (layoutBox.isFloatingPositioned())
-        heightAndMargin = geometry().floatingHeightAndMargin(layoutBox, usedHorizontalValues, { });
+        heightAndMargin = geometry().floatingHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
     else if (layoutBox.isInlineBlockBox())
-        heightAndMargin = geometry().inlineBlockHeightAndMargin(layoutBox, usedHorizontalValues);
+        heightAndMargin = geometry().inlineBlockHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
     else if (layoutBox.replaced())
-        heightAndMargin = geometry().inlineReplacedHeightAndMargin(layoutBox, usedHorizontalValues, { });
+        heightAndMargin = geometry().inlineReplacedHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
     else
         ASSERT_NOT_REACHED();
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (250055 => 250056)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2019-09-18 21:48:03 UTC (rev 250056)
@@ -85,7 +85,7 @@
 
     class Geometry : public FormattingContext::Geometry {
     public:
-        HeightAndMargin inlineBlockHeightAndMargin(const Box&, UsedHorizontalValues) const;
+        HeightAndMargin inlineBlockHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues) const;
         WidthAndMargin inlineBlockWidthAndMargin(const Box&, UsedHorizontalValues);
 
     private:

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (250055 => 250056)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2019-09-18 21:35:08 UTC (rev 250055)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2019-09-18 21:48:03 UTC (rev 250056)
@@ -63,17 +63,17 @@
     return WidthAndMargin { *width, { computedHorizontalMargin.start.valueOr(0_lu), computedHorizontalMargin.end.valueOr(0_lu) }, computedHorizontalMargin };
 }
 
-HeightAndMargin InlineFormattingContext::Geometry::inlineBlockHeightAndMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
+HeightAndMargin InlineFormattingContext::Geometry::inlineBlockHeightAndMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues, UsedVerticalValues usedVerticalValues) const
 {
     ASSERT(layoutBox.isInFlow());
 
     // 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' replaced elements in normal flow and floating replaced elements
     if (layoutBox.replaced())
-        return inlineReplacedHeightAndMargin(layoutBox, usedHorizontalValues, { });
+        return inlineReplacedHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
 
     // 10.6.6 Complicated cases
     // - 'Inline-block', non-replaced elements.
-    return complicatedCases(layoutBox, usedHorizontalValues, { });
+    return complicatedCases(layoutBox, usedHorizontalValues, usedVerticalValues);
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to