WebKit Bugzilla
Attachment 343779 Details for
Bug 187126
: [LFC] Align inFlowNonReplacedHeightAndMargin() style with the rest of the compute functions.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187126-20180627181000.patch (text/plain), 7.44 KB, created by
zalan
on 2018-06-27 18:10:02 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-27 18:10:02 PDT
Size:
7.44 KB
patch
obsolete
>Subversion Revision: 233289 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1a2a9ec226371bf143a7f65aeb1409739d77a62b..8a2b1f08f76167259fe73cb96bfe2060778f8c9b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,13 @@ >+2018-06-27 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Align inFlowNonReplacedHeightAndMargin() style with the rest of the compute functions. >+ https://bugs.webkit.org/show_bug.cgi?id=187126 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ > 2018-06-27 Zalan Bujtas <zalan@apple.com> > > [LFC] Align inFlowNonReplacedWidthAndMargin() style with the rest of the compute functions. >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 442131aeba50f5e5626a0d3c90064f67d8cded0d..d27bdfccecac61a3dd54450d3956b6005bf1d0cc 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -60,7 +60,8 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > { > ASSERT(layoutBox.isInFlow() && !layoutBox.replaced()); > >- auto compute = [&]() -> LayoutUnit { >+ auto compute = [&]() -> FormattingContext::Geometry::HeightAndMargin { >+ > // 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible' > // > // If 'margin-top', or 'margin-bottom' are 'auto', their used value is 0. >@@ -74,21 +75,24 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > // Only children in the normal flow are taken into account (i.e., floating boxes and absolutely positioned boxes are ignored, > // and relatively positioned boxes are considered without their offset). Note that the child box may be an anonymous block box. > >- if (!layoutBox.style().logicalHeight().isAuto()) { >- // FIXME: Only fixed values yet. >- return layoutBox.style().logicalHeight().value(); >- } >- >- if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild()) >- return 0; >- >+ auto& style = layoutBox.style(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth(); > auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ >+ auto marginTop = FormattingContext::Geometry::computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0); >+ auto marginBottom = FormattingContext::Geometry::computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0); > auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop(); >+ >+ if (!style.logicalHeight().isAuto()) >+ return { style.logicalHeight().value(), { marginTop, marginBottom } }; >+ >+ if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild()) >+ return { 0, { marginTop, marginBottom } }; > > // 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines > if (layoutBox.establishesInlineFormattingContext()) { > // height = lastLineBox().bottom(); >- return 0; >+ return { 0, { marginTop, marginBottom } }; > } > > // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin... >@@ -97,7 +101,7 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > if (!MarginCollapse::isMarginBottomCollapsedWithParent(*lastInFlowChild)) { > auto* lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild); > ASSERT(lastInFlowDisplayBox); >- return lastInFlowDisplayBox->bottom() + lastInFlowDisplayBox->marginBottom() - borderAndPaddingTop; >+ return { lastInFlowDisplayBox->bottom() + lastInFlowDisplayBox->marginBottom() - borderAndPaddingTop, { marginTop, marginBottom } }; > } > > // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin >@@ -107,29 +111,29 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > if (inFlowChild) { > auto* inFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*inFlowChild); > ASSERT(inFlowDisplayBox); >- return inFlowDisplayBox->top() + inFlowDisplayBox->borderBox().height() - borderAndPaddingTop; >+ return { inFlowDisplayBox->top() + inFlowDisplayBox->borderBox().height() - borderAndPaddingTop, { marginTop, marginBottom } }; > } > > // 4. zero, otherwise >- return 0; >+ return { 0, { marginTop, marginBottom } }; > }; > >- auto height = compute(); >- auto marginTop = MarginCollapse::marginTop(layoutContext, layoutBox); >- auto marginBottom = MarginCollapse::marginBottom(layoutContext, layoutBox); >+ auto heightAndMargin = compute(); >+ auto collapsedMarginTop = MarginCollapse::marginTop(layoutContext, layoutBox); >+ auto collapsedMarginBottom = MarginCollapse::marginBottom(layoutContext, layoutBox); > > if (!isStretchedToViewport(layoutContext, layoutBox)) { >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> height(" << height << "px) margin(" << marginTop << "px, " << marginBottom << "px) -> layoutBox(" << &layoutBox << ")"); >- return { height, { marginTop, marginBottom } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> height(" << heightAndMargin.height << "px) margin(" << collapsedMarginTop << "px, " << collapsedMarginBottom << "px) -> layoutBox(" << &layoutBox << ")"); >+ return { heightAndMargin.height, { collapsedMarginTop, collapsedMarginBottom } }; > } > > auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBoxHeight(); > // Stretch but never overstretch with the margins. >- if (height + marginTop + marginBottom < initialContainingBlockHeight) >- height = initialContainingBlockHeight - marginTop - marginBottom; >+ if (heightAndMargin.height + collapsedMarginTop + collapsedMarginBottom < initialContainingBlockHeight) >+ heightAndMargin.height = initialContainingBlockHeight - collapsedMarginTop - collapsedMarginBottom; > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> streched to viewport -> height(" << height << "px) margin(" << marginTop << "px, " << marginBottom << "px) -> layoutBox(" << &layoutBox << ")"); >- return { height, { marginTop, marginBottom } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> streched to viewport -> height(" << heightAndMargin.height << "px) margin(" << collapsedMarginTop << "px, " << collapsedMarginBottom << "px) -> layoutBox(" << &layoutBox << ")"); >+ return { heightAndMargin.height, { collapsedMarginTop, collapsedMarginBottom } }; > } > > FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox,
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 187126
: 343779