Changeset 250050 in webkit


Ignore:
Timestamp:
Sep 18, 2019 12:56:14 PM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC] Introduce UsedHorizontalValues::Constraints
https://bugs.webkit.org/show_bug.cgi?id=201919
<rdar://problem/55481927>

Reviewed by Antti Koivisto.

UsedHorizontalValues::Constraints holds the constraint values for a particular box geometry computation (currently it only has the horizontal width constraint)

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • layout/FormattingContext.cpp:

(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
(WebCore::Layout::FormattingContext::computeBorderAndPadding):

  • layout/FormattingContextGeometry.cpp:

(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
(WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
(WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
(WebCore::Layout::FormattingContext::Geometry::computedPadding const):
(WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin const):
(WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin const):

  • layout/FormattingContextQuirks.cpp:

(WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):

  • layout/LayoutUnits.h:

(WebCore::Layout::UsedHorizontalValues::Constraints::Constraints):
(WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):

  • layout/blockformatting/BlockFormattingContext.cpp:

(WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
(WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition):
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):

  • layout/blockformatting/BlockFormattingContextGeometry.cpp:

(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):

  • layout/blockformatting/BlockFormattingContextQuirks.cpp:

(WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):

  • layout/blockformatting/BlockMarginCollapse.cpp:

(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):

  • layout/floats/FloatingContext.h:
  • layout/inlineformatting/InlineFormattingContext.cpp:

(WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
(WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):

  • layout/inlineformatting/InlineFormattingContextGeometry.cpp:

(WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):

  • layout/inlineformatting/InlineFormattingContextLineLayout.cpp:

(WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):

  • layout/tableformatting/TableFormattingContext.cpp:

(WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):

Location:
trunk/Source/WebCore
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r250048 r250050  
     12019-09-18  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Introduce UsedHorizontalValues::Constraints
     4        https://bugs.webkit.org/show_bug.cgi?id=201919
     5        <rdar://problem/55481927>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        UsedHorizontalValues::Constraints holds the constraint values for a particular box geometry computation (currently it only has the horizontal width constraint)
     10
     11        * Sources.txt:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * layout/FormattingContext.cpp:
     14        (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
     15        (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
     16        (WebCore::Layout::FormattingContext::computeBorderAndPadding):
     17        * layout/FormattingContextGeometry.cpp:
     18        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
     19        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
     20        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
     21        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
     22        (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
     23        (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const):
     24        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
     25        (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
     26        (WebCore::Layout::FormattingContext::Geometry::computedPadding const):
     27        (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin const):
     28        (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin const):
     29        * layout/FormattingContextQuirks.cpp:
     30        (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
     31        * layout/LayoutUnits.h:
     32        (WebCore::Layout::UsedHorizontalValues::Constraints::Constraints):
     33        (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
     34        * layout/blockformatting/BlockFormattingContext.cpp:
     35        (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
     36        (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition):
     37        (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
     38        (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
     39        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
     40        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
     41        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
     42        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
     43        (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
     44        * layout/blockformatting/BlockMarginCollapse.cpp:
     45        (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
     46        * layout/floats/FloatingContext.h:
     47        * layout/inlineformatting/InlineFormattingContext.cpp:
     48        (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
     49        (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
     50        (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
     51        (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
     52        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
     53        (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
     54        * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
     55        (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
     56        * layout/tableformatting/TableFormattingContext.cpp:
     57        (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
     58
    1592019-09-18  Andy Estes  <aestes@apple.com>
    260
  • trunk/Source/WebCore/Sources.txt

    r250040 r250050  
    13971397layout/LayoutPhase.cpp
    13981398layout/LayoutState.cpp
     1399layout/LayoutUnits.cpp
    13991400layout/Verification.cpp
    14001401layout/blockformatting/BlockFormattingContext.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r250048 r250050  
    58145814                113D0B4F1F9FDD2B00F611BB /* FrameViewLayoutContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FrameViewLayoutContext.cpp; sourceTree = "<group>"; };
    58155815                113D0B501F9FDD2B00F611BB /* FrameViewLayoutContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameViewLayoutContext.h; sourceTree = "<group>"; };
     5816                115CA83023328B1E00FD3B08 /* LayoutUnits.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnits.cpp; sourceTree = "<group>"; };
    58165817                115CFA68208AF7D0001E6991 /* FormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormattingContext.h; sourceTree = "<group>"; };
    58175818                115CFA69208AF7D0001E6991 /* FormattingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContext.cpp; sourceTree = "<group>"; };
     
    1641016411                                6F7CA3C5208C2956002F29AB /* LayoutState.cpp */,
    1641116412                                6F7CA3C4208C2956002F29AB /* LayoutState.h */,
     16413                                115CA83023328B1E00FD3B08 /* LayoutUnits.cpp */,
    1641216414                                6F73918C2106CEDD006AF262 /* LayoutUnits.h */,
    1641316415                                6FE7AA2621C37B6300296DCD /* MarginTypes.h */,
  • trunk/Source/WebCore/layout/FormattingContext.cpp

    r250035 r250050  
    7171
    7272    auto compute = [&](Optional<LayoutUnit> usedWidth) {
    73         auto usedHorizontalValues = UsedHorizontalValues { containingBlockWidth, usedWidth, { } };
     73        auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { containingBlockWidth }, usedWidth, { } };
    7474        auto usedVerticalValues = UsedVerticalValues { containingBlockHeight, { } };
    7575        return geometry().outOfFlowHorizontalGeometry(layoutBox, usedHorizontalValues, usedVerticalValues);
     
    106106
    107107    auto usedVerticalValuesForHeight = UsedVerticalValues { containingBlockHeight, { } };
    108     auto usedHorizontalValues = UsedHorizontalValues { containingBlockWidth };
     108    auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { containingBlockWidth } };
    109109
    110110    auto verticalGeometry = compute(usedHorizontalValues, usedVerticalValuesForHeight);
     
    134134{
    135135    if (!usedHorizontalValues)
    136         usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
     136        usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
    137137    auto& displayBox = formattingState().displayBox(layoutBox);
    138138    displayBox.setBorder(geometry().computedBorder(layoutBox));
  • trunk/Source/WebCore/layout/FormattingContextGeometry.cpp

    r250035 r250050  
    301301    auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
    302302    auto containingBlockHeight = *usedVerticalValues.containingBlockHeight;
    303     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     303    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    304304
    305305    auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
     
    424424    auto& style = layoutBox.style();
    425425    auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
    426     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     426    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    427427    auto isLeftToRightDirection = layoutBox.containingBlock()->style().isLeftToRightDirection();
    428428   
     
    558558    auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
    559559    auto containingBlockHeight = *usedVerticalValues.containingBlockHeight;
    560     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     560    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    561561
    562562    auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
     
    642642    auto& style = layoutBox.style();
    643643    auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
    644     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     644    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    645645    auto isLeftToRightDirection = layoutBox.containingBlock()->style().isLeftToRightDirection();
    646646
     
    770770    auto usedHorizontallMargin = UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
    771771    // #2
    772     auto width = computedValueIfNotAuto(usedHorizontalValues.width ? Length { usedHorizontalValues.width.value(), Fixed } : layoutBox.style().logicalWidth(), usedHorizontalValues.containingBlockWidth);
     772    auto width = computedValueIfNotAuto(usedHorizontalValues.width ? Length { usedHorizontalValues.width.value(), Fixed } : layoutBox.style().logicalWidth(), usedHorizontalValues.constraints.width);
    773773    if (!width)
    774         width = shrinkToFitWidth(layoutBox, usedHorizontalValues.containingBlockWidth);
     774        width = shrinkToFitWidth(layoutBox, usedHorizontalValues.constraints.width);
    775775
    776776    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> floating non-replaced -> width(" << *width << "px) margin(" << usedHorizontallMargin.start << "px, " << usedHorizontallMargin.end << "px) -> layoutBox(" << &layoutBox << ")");
     
    799799
    800800    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
    801     return inlineReplacedWidthAndMargin(layoutBox, UsedHorizontalValues { usedHorizontalValues.containingBlockWidth,
    802         usedHorizontalValues.width, UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) } });
     801    usedHorizontalValues.margin = UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
     802    return inlineReplacedWidthAndMargin(layoutBox, usedHorizontalValues);
    803803}
    804804
     
    909909
    910910    auto& style = layoutBox.style();
    911     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     911    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    912912    auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedHorizontalValues);
    913913
     
    970970
    971971    auto& style = layoutBox.style();
    972     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     972    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    973973
    974974    auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
     
    10471047
    10481048    auto& style = layoutBox.style();
    1049     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     1049    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    10501050    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox);
    10511051    return Edges {
     
    10581058{
    10591059    auto& style = layoutBox.style();
    1060     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     1060    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    10611061    return { computedValueIfNotAuto(style.marginStart(), containingBlockWidth), computedValueIfNotAuto(style.marginEnd(), containingBlockWidth) };
    10621062}
     
    10651065{
    10661066    auto& style = layoutBox.style();
    1067     auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     1067    auto containingBlockWidth = usedHorizontalValues.constraints.width;
    10681068    return { computedValueIfNotAuto(style.marginBefore(), containingBlockWidth), computedValueIfNotAuto(style.marginAfter(), containingBlockWidth) };
    10691069}
  • trunk/Source/WebCore/layout/FormattingContextQuirks.cpp

    r249834 r250050  
    5353            auto& boxGeometry = formattingContext.geometryForBox(*containingBlock, FormattingContext::EscapeType::AccessAncestorFormattingContext);
    5454
    55             auto usedValues = UsedHorizontalValues { formattingContext.geometryForBox(*containingBlock->containingBlock(), FormattingContext::EscapeType::AccessAncestorFormattingContext).contentBoxWidth() };
     55            auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { formattingContext.geometryForBox(*containingBlock->containingBlock(), FormattingContext::EscapeType::AccessAncestorFormattingContext) } };
    5656            auto verticalMargin = formattingContext.geometry().computedVerticalMargin(*containingBlock, usedValues);
    5757            auto verticalPadding = boxGeometry.paddingTop().valueOr(0) + boxGeometry.paddingBottom().valueOr(0);
  • trunk/Source/WebCore/layout/LayoutUnits.h

    r249903 r250050  
    3535
    3636namespace WebCore {
     37
     38namespace Display {
     39class Box;
     40}
     41
    3742namespace Layout {
    3843
     
    139144
    140145struct UsedHorizontalValues {
    141     explicit UsedHorizontalValues(LayoutUnit containingBlockWidth)
    142         : containingBlockWidth(containingBlockWidth)
     146    struct Constraints {
     147        explicit Constraints(const Display::Box& containingBlockGeometry);
     148        explicit Constraints(LayoutUnit horizontalConstraint)
     149            : width(horizontalConstraint)
    143150        {
    144151        }
    145152
    146     explicit UsedHorizontalValues(LayoutUnit containingBlockWidth, Optional<LayoutUnit> width, Optional<UsedHorizontalMargin> margin)
    147         : containingBlockWidth(containingBlockWidth)
     153        LayoutUnit width;
     154    };
     155
     156    explicit UsedHorizontalValues(Constraints constraints)
     157        : constraints(constraints)
     158    {
     159    }
     160
     161    explicit UsedHorizontalValues(Constraints constraints, Optional<LayoutUnit> width, Optional<UsedHorizontalMargin> margin)
     162        : constraints(constraints)
    148163        , width(width)
    149164        , margin(margin)
    150         {
    151         }
     165    {
     166    }
    152167
    153     LayoutUnit containingBlockWidth;
     168    Constraints constraints;
    154169    Optional<LayoutUnit> width;
    155170    Optional<UsedHorizontalMargin> margin;
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp

    r249955 r250050  
    3434#include "FloatingState.h"
    3535#include "LayoutBox.h"
     36#include "LayoutChildIterator.h"
    3637#include "LayoutContainer.h"
    3738#include "LayoutState.h"
     
    194195
    195196        auto computeInFlowPositionedPosition = [&] {
    196             auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*childBox.containingBlock()).contentBoxWidth() };
     197            auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*childBox.containingBlock()) } };
    197198            auto positionOffset = geometry().inFlowPositionedPositionOffset(childBox, usedHorizontalValues);
    198199
     
    232233void BlockFormattingContext::computeEstimatedVerticalPosition(const Box& layoutBox)
    233234{
    234     auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
     235    auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
    235236    auto computedVerticalMargin = geometry().computedVerticalMargin(layoutBox, usedHorizontalValues);
    236237    auto usedNonCollapsedMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
     
    357358
    358359    auto compute = [&](Optional<LayoutUnit> usedWidth) -> WidthAndMargin {
    359         auto usedValues = UsedHorizontalValues { availableWidth, usedWidth, { } };
     360        auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { availableWidth }, usedWidth, { } };
    360361        if (layoutBox.isInFlow())
    361362            return geometry().inFlowWidthAndMargin(layoutBox, usedValues);
     
    391392    auto compute = [&](auto usedVerticalValues) -> HeightAndMargin {
    392393
    393         auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
     394        auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
    394395        if (layoutBox.isInFlow())
    395396            return geometry().inFlowHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp

    r250033 r250050  
    137137
    138138        auto& style = layoutBox.style();
    139         auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
     139        auto containingBlockWidth = usedHorizontalValues.constraints.width;
    140140        auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
    141141
     
    279279}
    280280
    281 WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const Box& layoutBox, UsedHorizontalValues usedValues)
     281WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues)
    282282{
    283283    ASSERT(layoutBox.isInFlow());
     
    287287            // This is a special table "fit-content size" behavior handling. Not in the spec though.
    288288            // Table returns its final width as min/max. Use this final width value to computed horizontal margins etc.
    289             usedValues.width = shrinkToFitWidth(layoutBox, usedValues.containingBlockWidth);
    290         }
    291         return inFlowNonReplacedWidthAndMargin(layoutBox, usedValues);
     289            usedHorizontalValues.width = shrinkToFitWidth(layoutBox, usedHorizontalValues.constraints.width);
     290        }
     291        return inFlowNonReplacedWidthAndMargin(layoutBox, usedHorizontalValues);
    292292    }
    293     return inFlowReplacedWidthAndMargin(layoutBox, usedValues);
     293    return inFlowReplacedWidthAndMargin(layoutBox, usedHorizontalValues);
    294294}
    295295
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp

    r249908 r250050  
    7070    auto& documentBoxGeometry = formattingContext.geometryForBox(documentBox);
    7171
    72     auto& initialContainingBlocGeometry = formattingContext.geometryForBox(initialContainingBlock(layoutBox));
    73     auto strechedHeight = initialContainingBlocGeometry.contentBoxHeight();
     72    auto& initialContainingBlockGeometry = formattingContext.geometryForBox(initialContainingBlock(layoutBox));
     73    auto strechedHeight = initialContainingBlockGeometry.contentBoxHeight();
    7474    strechedHeight -= documentBoxGeometry.verticalBorder() + documentBoxGeometry.verticalPadding().valueOr(0);
    7575
     
    8383        // Stretch the body using the initial containing block's height and shrink it with document box's margin/border/padding.
    8484        // This looks extremely odd when html has non-auto height.
    85         auto documentBoxVerticalMargin = formattingContext.geometry().computedVerticalMargin(documentBox, UsedHorizontalValues { initialContainingBlocGeometry.contentBoxWidth() });
     85        auto documentBoxVerticalMargin = formattingContext.geometry().computedVerticalMargin(documentBox, UsedHorizontalValues { UsedHorizontalValues::Constraints { initialContainingBlockGeometry } });
    8686        strechedHeight -= (documentBoxVerticalMargin.before.valueOr(0) + documentBoxVerticalMargin.after.valueOr(0));
    8787
  • trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp

    r249955 r250050  
    520520    }
    521521    // This is the estimate path. We don't yet have positive/negative margin computed.
    522     auto usedValues = UsedHorizontalValues { formattingContext().geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
     522    auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { formattingContext().geometryForBox(*layoutBox.containingBlock()) } };
    523523    auto computedVerticalMargin = formattingContext().geometry().computedVerticalMargin(layoutBox, usedValues);
    524524    auto nonCollapsedMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
  • trunk/Source/WebCore/layout/floats/FloatingContext.h

    r249849 r250050  
    3131#include "FormattingContext.h"
    3232#include "LayoutContainer.h"
    33 #include "LayoutUnits.h"
    3433#include <wtf/IsoMalloc.h>
    3534
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp

    r249903 r250050  
    6969
    7070    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> formatting root(" << &root() << ")");
    71     auto availableWidth = geometryForBox(root()).contentBoxWidth();
    72     auto usedValues = UsedHorizontalValues { availableWidth };
     71    auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(root()) } };
    7372    auto* layoutBox = root().firstInFlowOrFloatingChild();
    7473    // Compute width/height for non-text content and margin/border/padding for inline containers.
     
    9291
    9392    collectInlineContent();
    94     InlineLayout(*this).layout(formattingState().inlineItems(), availableWidth);
     93    InlineLayout(*this).layout(formattingState().inlineItems(), usedValues.constraints.width);
    9594    LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> formatting root(" << &root() << ")");
    9695}
     
    108107
    109108    Vector<const Box*> formattingContextRootList;
    110     auto usedValues = UsedHorizontalValues { LayoutUnit { } };
     109    auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { LayoutUnit { } } };
    111110    auto* layoutBox = root().firstInFlowOrFloatingChild();
    112111    while (layoutBox) {
     
    169168    ASSERT(formattingRoot.establishesFormattingContext());
    170169
    171     auto usedValues = UsedHorizontalValues { LayoutUnit { } };
     170    auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { LayoutUnit { } } };
    172171    computeBorderAndPadding(formattingRoot, usedValues);
    173172    computeHorizontalMargin(formattingRoot, usedValues);
     
    212211{
    213212    HeightAndMargin heightAndMargin;
    214     auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
     213    auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
    215214    if (layoutBox.isFloatingPositioned())
    216215        heightAndMargin = geometry().floatingHeightAndMargin(layoutBox, usedHorizontalValues, { });
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp

    r250033 r250050  
    5454    // A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'.
    5555    // #1
    56     auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), usedHorizontalValues.containingBlockWidth);
     56    auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), usedHorizontalValues.constraints.width);
    5757    if (!width)
    58         width = shrinkToFitWidth(formattingContextRoot, usedHorizontalValues.containingBlockWidth);
     58        width = shrinkToFitWidth(formattingContextRoot, usedHorizontalValues.constraints.width);
    5959
    6060    // #2
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp

    r249879 r250050  
    405405        }
    406406
     407        auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { formattingContext.geometryForBox(*layoutBox.containingBlock()) } };
    407408        // Inline level box (replaced or inline-block)
    408409        if (lineRun->isBox()) {
    409410            auto topLeft = logicalRect.topLeft();
    410411            if (layoutBox.isInFlowPositioned())
    411                 topLeft += geometry.inFlowPositionedPositionOffset(layoutBox, UsedHorizontalValues { formattingContext.geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() });
     412                topLeft += geometry.inFlowPositionedPositionOffset(layoutBox, usedHorizontalValues);
    412413            displayBox.setTopLeft(topLeft);
    413414            lineBoxRect.expandHorizontally(logicalRect.width());
     
    426427        if (lineRun->isContainerEnd()) {
    427428            if (layoutBox.isInFlowPositioned()) {
    428                 auto inflowOffset = geometry.inFlowPositionedPositionOffset(layoutBox, UsedHorizontalValues { formattingContext.geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() });
     429                auto inflowOffset = geometry.inFlowPositionedPositionOffset(layoutBox, usedHorizontalValues);
    429430                displayBox.moveHorizontally(inflowOffset.width());
    430431                displayBox.moveVertically(inflowOffset.height());
  • trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp

    r249849 r250050  
    200200            intrinsicWidth = geometry().constrainByMinMaxWidth(tableCellBox, *intrinsicWidth);
    201201            auto border = geometry().computedBorder(tableCellBox);
    202             auto padding = *geometry().computedPadding(tableCellBox, UsedHorizontalValues({ }));
     202            auto padding = *geometry().computedPadding(tableCellBox, UsedHorizontalValues { UsedHorizontalValues::Constraints { LayoutUnit { } } });
    203203
    204204            intrinsicWidth->expand(border.horizontal.width() + padding.horizontal.width());
Note: See TracChangeset for help on using the changeset viewer.