WebKit Bugzilla
Attachment 348843 Details for
Bug 189271
: [LFC][BFC] Merge computeInFlowWidth(Height)AndMargin and computeFloatingWidth(Height)AndMargin.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189271-20180904132636.patch (text/plain), 9.17 KB, created by
zalan
on 2018-09-04 13:26:39 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-09-04 13:26:39 PDT
Size:
9.17 KB
patch
obsolete
>Subversion Revision: 235589 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fff37193dfdfd65651632ba6602b7546c4bb2018..15698f1f834a4fcdcfcf57a7c0ed735bde9cc92c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-09-04 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC] Merge computeInFlowWidth(Height)AndMargin and computeFloatingWidth(Height)AndMargin. >+ https://bugs.webkit.org/show_bug.cgi?id=189271 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is in preparation for adding min/max-widht(height). >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): Deleted. >+ (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const): Deleted. >+ * layout/FormattingContext.h: >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): >+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): >+ (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): Deleted. >+ (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const): Deleted. >+ * layout/blockformatting/BlockFormattingContext.h: >+ > 2018-09-01 Simon Fraser <simon.fraser@apple.com> > > Rename FilterEffectRenderer to CSSFilter >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 6f2c5c771294f3733904986f84fd76f61e8f733c..ba820ce957f1a4393b876d4c0307919a384d5391 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -51,25 +51,6 @@ FormattingContext::~FormattingContext() > { > } > >-void FormattingContext::computeFloatingHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >-{ >- auto heightAndMargin = Geometry::floatingHeightAndMargin(layoutContext, layoutBox); >- displayBox.setContentBoxHeight(heightAndMargin.height); >- displayBox.moveVertically(heightAndMargin.margin.top); >- ASSERT(!heightAndMargin.collapsedMargin); >- displayBox.setVerticalMargin(heightAndMargin.margin); >- displayBox.setVerticalNonCollapsedMargin(heightAndMargin.margin); >-} >- >-void FormattingContext::computeFloatingWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >-{ >- auto widthAndMargin = Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox); >- displayBox.setContentBoxWidth(widthAndMargin.width); >- displayBox.moveHorizontally(widthAndMargin.margin.left); >- displayBox.setHorizontalMargin(widthAndMargin.margin); >- displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin); >-} >- > void FormattingContext::computeOutOfFlowHorizontalGeometry(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { > auto horizontalGeometry = Geometry::outOfFlowHorizontalGeometry(layoutContext, *this, layoutBox); >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index aeb0e2f9a3a0770d0e7643228e2ef10913ea1218..2d652063ef21a6dcb6247f7788447dd8fe75f746 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -75,9 +75,6 @@ protected: > virtual void computeStaticPosition(LayoutContext&, const Box&, Display::Box&) const = 0; > virtual void computeInFlowPositionedPosition(LayoutContext&, const Box&, Display::Box&) const = 0; > >- void computeFloatingHeightAndMargin(LayoutContext&, const Box&, Display::Box&) const; >- void computeFloatingWidthAndMargin(LayoutContext&, const Box&, Display::Box&) const; >- > void computeBorderAndPadding(LayoutContext&, const Box&, Display::Box&) const; > > void placeInFlowPositionedChildren(LayoutContext&, const Container&) const; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 1118421a3d8a4d4ffaab4728e3e2aa1fcf8db0b0..a9cfca91da86ee0295188f21d20d81938939cd97 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -244,46 +244,45 @@ void BlockFormattingContext::computeInFlowPositionedPosition(LayoutContext& layo > > void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (layoutBox.isInFlow()) >- return computeInFlowWidthAndMargin(layoutContext, layoutBox, displayBox); >+ WidthAndMargin widthAndMargin; > >- if (layoutBox.isFloatingPositioned()) >- return computeFloatingWidthAndMargin(layoutContext, layoutBox, displayBox); >+ if (layoutBox.isInFlow()) >+ widthAndMargin = Geometry::inFlowWidthAndMargin(layoutContext, layoutBox); >+ else if (layoutBox.isFloatingPositioned()) >+ widthAndMargin = FormattingContext::Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox); >+ else >+ ASSERT_NOT_REACHED(); > >- ASSERT_NOT_REACHED(); >+ displayBox.setContentBoxWidth(widthAndMargin.width); >+ displayBox.moveHorizontally(widthAndMargin.margin.left); >+ displayBox.setHorizontalMargin(widthAndMargin.margin); >+ displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin); > } > > void BlockFormattingContext::computeHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (layoutBox.isInFlow()) >- return computeInFlowHeightAndMargin(layoutContext, layoutBox, displayBox); >+ HeightAndMargin heightAndMargin; >+ std::optional<LayoutUnit> marginTopOffset; > >- if (layoutBox.isFloatingPositioned()) >- return computeFloatingHeightAndMargin(layoutContext, layoutBox, displayBox); >+ if (layoutBox.isInFlow()) { >+ heightAndMargin = Geometry::inFlowHeightAndMargin(layoutContext, layoutBox); > >- ASSERT_NOT_REACHED(); >-} >+ // If this box has already been moved by the estimated vertical margin, no need to move it again. >+ if (!displayBox.estimatedMarginTop()) >+ marginTopOffset = heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin).top; >+ } else if (layoutBox.isFloatingPositioned()) { >+ heightAndMargin = FormattingContext::Geometry::floatingHeightAndMargin(layoutContext, layoutBox); >+ ASSERT(!heightAndMargin.collapsedMargin); >+ >+ marginTopOffset = heightAndMargin.margin.top; >+ } else >+ ASSERT_NOT_REACHED(); > >-void BlockFormattingContext::computeInFlowHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >-{ >- auto heightAndMargin = Geometry::inFlowHeightAndMargin(layoutContext, layoutBox); > displayBox.setContentBoxHeight(heightAndMargin.height); >- auto marginValue = heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin); >- displayBox.setVerticalMargin(marginValue); > displayBox.setVerticalNonCollapsedMargin(heightAndMargin.margin); >- >- // This box has already been moved by the estimated vertical margin. No need to move it again. >- if (!displayBox.estimatedMarginTop()) >- displayBox.moveVertically(marginValue.top); >-} >- >-void BlockFormattingContext::computeInFlowWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >-{ >- auto widthAndMargin = Geometry::inFlowWidthAndMargin(layoutContext, layoutBox); >- displayBox.setContentBoxWidth(widthAndMargin.width); >- displayBox.moveHorizontally(widthAndMargin.margin.left); >- displayBox.setHorizontalMargin(widthAndMargin.margin); >- displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin); >+ displayBox.setVerticalMargin(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin)); >+ if (marginTopOffset) >+ displayBox.moveVertically(*marginTopOffset); > } > > FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsicWidthConstraints(LayoutContext& layoutContext, const Box& layoutBox) const >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 7d601a153eb7fb8f0ca433cdc7acea394da78648..8fcbb91e28b5f51acafba323e0ca56f49d8174af 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -59,9 +59,8 @@ private: > void computeFloatingPosition(LayoutContext&, FloatingContext&, const Box&, Display::Box&) const; > void computePositionToAvoidFloats(LayoutContext&, FloatingContext&, const Box&, Display::Box&) const; > void computeVerticalPositionForFloatClear(LayoutContext&, const FloatingContext&, const Box&, Display::Box&) const; >+ > void computeInFlowPositionedPosition(LayoutContext&, const Box&, Display::Box&) const override; >- void computeInFlowWidthAndMargin(LayoutContext&, const Box&, Display::Box&) const; >- void computeInFlowHeightAndMargin(LayoutContext&, const Box&, Display::Box&) const; > void computeEstimatedMarginTop(LayoutContext&, const Box&, Display::Box&) const; > void computeEstimatedMarginTopForAncestors(LayoutContext&, const Box&) const; >
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 189271
: 348843