WebKit Bugzilla
Attachment 348889 Details for
Bug 189294
: [LFC] Make BlockFormattingContext::Geometry a subclass of FormattingContext::Geometry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189294-20180904210930.patch (text/plain), 12.20 KB, created by
zalan
on 2018-09-04 21:09:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-09-04 21:09:34 PDT
Size:
12.20 KB
patch
obsolete
>Subversion Revision: 235643 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 71e2dd02febec124b57fcb1c875d1cf1c671486c..ecb3bb0d01b9a0e6c542134e267b0229a4362940 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-09-04 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Make BlockFormattingContext::Geometry a subclass of FormattingContext::Geometry >+ https://bugs.webkit.org/show_bug.cgi?id=189294 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This simplifies some of the call sites. >+ >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): >+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): >+ > 2018-09-04 Zalan Bujtas <zalan@apple.com> > > [LFC] Rename LayoutPair to BoxPair >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 0f120cd1d322c010a07307871ca495d453237145..172145b149ff8c9f06a86095cbb367c4e87450b9 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -249,7 +249,7 @@ void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext, > if (layoutBox.isInFlow()) > widthAndMargin = Geometry::inFlowWidthAndMargin(layoutContext, layoutBox); > else if (layoutBox.isFloatingPositioned()) >- widthAndMargin = FormattingContext::Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox); >+ widthAndMargin = Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox); > else > ASSERT_NOT_REACHED(); > >@@ -271,7 +271,7 @@ void BlockFormattingContext::computeHeightAndMargin(LayoutContext& layoutContext > if (!displayBox.estimatedMarginTop()) > marginTopOffset = heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin).top; > } else if (layoutBox.isFloatingPositioned()) { >- heightAndMargin = FormattingContext::Geometry::floatingHeightAndMargin(layoutContext, layoutBox); >+ heightAndMargin = Geometry::floatingHeightAndMargin(layoutContext, layoutBox); > ASSERT(!heightAndMargin.collapsedMargin); > > marginTopOffset = heightAndMargin.margin.top; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 8fcbb91e28b5f51acafba323e0ca56f49d8174af..2f42060981fadff992f4bbb8dbb58424dc94621e 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -64,10 +64,10 @@ private: > void computeEstimatedMarginTop(LayoutContext&, const Box&, Display::Box&) const; > void computeEstimatedMarginTopForAncestors(LayoutContext&, const Box&) const; > >- FormattingContext::InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&) const override; >+ InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&) const override; > > // This class implements positioning and sizing for boxes participating in a block formatting context. >- class Geometry { >+ class Geometry : public FormattingContext::Geometry { > public: > static HeightAndMargin inFlowHeightAndMargin(LayoutContext&, const Box&); > static WidthAndMargin inFlowWidthAndMargin(LayoutContext&, const Box&); >@@ -76,7 +76,7 @@ private: > static Position inFlowPositionedPosition(LayoutContext&, const Box&); > > static bool instrinsicWidthConstraintsNeedChildrenWidth(const Box&); >- static FormattingContext::InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&); >+ static InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&); > > private: > static HeightAndMargin inFlowNonReplacedHeightAndMargin(LayoutContext&, const Box&); >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 4b96789e34c75cb4652856f3bccdbeb74b1cfcc9..433734241f8e52f6f7121f6128593ee893a841fa 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -101,8 +101,8 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth(); > auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); > >- VerticalEdges nonCollapsedMargin = { FormattingContext::Geometry::computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0), >- FormattingContext::Geometry::computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0) }; >+ VerticalEdges nonCollapsedMargin = { computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0), >+ computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0) }; > VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutContext, layoutBox), MarginCollapse::marginBottom(layoutContext, layoutBox) }; > auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop().value_or(0); > >@@ -186,9 +186,9 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*containingBlock)->contentBoxWidth(); > auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); > >- auto width = FormattingContext::Geometry::computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth); >- auto marginLeft = FormattingContext::Geometry::computedValueIfNotAuto(style.marginLeft(), containingBlockWidth); >- auto marginRight = FormattingContext::Geometry::computedValueIfNotAuto(style.marginRight(), containingBlockWidth); >+ auto width = computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth); >+ auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth); >+ auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth); > auto nonComputedMarginLeft = marginLeft.value_or(0); > auto nonComputedMarginRight = marginRight.value_or(0); > auto borderLeft = displayBox.borderLeft(); >@@ -264,7 +264,7 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(La > // 2. Then the rules for non-replaced block-level elements are applied to determine the margins. > > // #1 >- auto width = FormattingContext::Geometry::inlineReplacedWidthAndMargin(layoutContext, layoutBox).width; >+ auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox).width; > // #2 > auto nonReplacedWidthAndMargin = inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, width); > >@@ -311,8 +311,8 @@ Position BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContex > auto& containingBlock = *layoutBox.containingBlock(); > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->contentBoxWidth(); > >- auto top = FormattingContext::Geometry::computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); >- auto bottom = FormattingContext::Geometry::computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); >+ auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); >+ auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); > > if (!top && !bottom) { > // #1 >@@ -339,8 +339,8 @@ Position BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContex > // If the 'direction' property of the containing block is 'ltr', the value of 'left' wins and 'right' becomes -'left'. > // If 'direction' of the containing block is 'rtl', 'right' wins and 'left' is ignored. > >- auto left = FormattingContext::Geometry::computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); >- auto right = FormattingContext::Geometry::computedValueIfNotAuto(style.logicalRight(), containingBlockWidth); >+ auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); >+ auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth); > > if (!left && !right) { > // #1 >@@ -377,7 +377,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutCo > // 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 FormattingContext::Geometry::inlineReplacedHeightAndMargin(layoutContext, layoutBox); >+ return inlineReplacedHeightAndMargin(layoutContext, layoutBox); > > HeightAndMargin heightAndMargin; > // TODO: Figure out the case for the document element. Let's just complicated-case it for now. >@@ -386,7 +386,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutCo > else { > // 10.6.6 Complicated cases > // Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport). >- heightAndMargin = FormattingContext::Geometry::complicatedCases(layoutContext, layoutBox); >+ heightAndMargin = complicatedCases(layoutContext, layoutBox); > } > > if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox)) >@@ -418,7 +418,7 @@ bool BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWid > FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry::instrinsicWidthConstraints(LayoutContext& layoutContext, const Box& layoutBox) > { > auto& style = layoutBox.style(); >- if (auto width = FormattingContext::Geometry::fixedValue(style.logicalWidth())) >+ if (auto width = fixedValue(style.logicalWidth())) > return { *width, *width }; > > // Minimum/maximum width can't be depending on the containing block's width. >@@ -440,12 +440,12 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry:: > ASSERT(childInstrinsicWidthConstraints); > > auto& style = child.style(); >- auto horizontalMarginBorderAndPadding = FormattingContext::Geometry::fixedValue(style.marginLeft()).value_or(0) >+ auto horizontalMarginBorderAndPadding = fixedValue(style.marginLeft()).value_or(0) > + LayoutUnit { style.borderLeftWidth() } >- + FormattingContext::Geometry::fixedValue(style.paddingLeft()).value_or(0) >- + FormattingContext::Geometry::fixedValue(style.paddingRight()).value_or(0) >+ + fixedValue(style.paddingLeft()).value_or(0) >+ + fixedValue(style.paddingRight()).value_or(0) > + LayoutUnit { style.borderRightWidth() } >- + FormattingContext::Geometry::fixedValue(style.marginRight()).value_or(0); >+ + fixedValue(style.marginRight()).value_or(0); > > minimumIntrinsicWidth = std::max(minimumIntrinsicWidth, childInstrinsicWidthConstraints->minimum + horizontalMarginBorderAndPadding); > maximumIntrinsicWidth = std::max(maximumIntrinsicWidth, childInstrinsicWidthConstraints->maximum + horizontalMarginBorderAndPadding);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189294
: 348889