WebKit Bugzilla
Attachment 342515 Details for
Bug 186469
: [LFC] Add vertical margin computation for inflow non-replaced box and for the (10.6.6) complicated cases.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186469-20180611214302.patch (text/plain), 8.42 KB, created by
zalan
on 2018-06-11 21:43:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-11 21:43:03 PDT
Size:
8.42 KB
patch
obsolete
>Subversion Revision: 232716 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ae7f01ab2c0ea1a967b698863295f1096c504d3d..e7e9b38c4171e82935db334f043a6c5b4619da96 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-11 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add vertical margin computation for inflow non-replaced box and for the (10.6.6) complicated cases. >+ https://bugs.webkit.org/show_bug.cgi?id=186469 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ > 2018-06-11 Zalan Bujtas <zalan@apple.com> > > [LFC] Remove redundant position functions for out-of-flow elements >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index d54518e95c2fd72f5994090c9ca3dcc5f360fc61..083c1b4cae8af6792c90604f38db9a7088ba62ce 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -107,7 +107,7 @@ FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOf > > auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); > auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); >- auto height = computedValueIfNotAuto(style.logicalHeight(), containingBlockWidth); >+ auto height = computedValueIfNotAuto(style.logicalHeight(), containingBlockHeight); > auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth); > auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth); > auto paddingTop = displayBox.paddingTop(); >@@ -490,23 +490,44 @@ FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::out > FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::floatingNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced()); >+ > // 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). >+ // 'Inline-block', non-replaced elements. > // Floating, non-replaced elements. > // >- // If 'height' is 'auto', the height depends on the element's descendants per 10.6.7. >- auto height = layoutBox.style().logicalHeight(); >- auto computedHeightValue = height.isAuto() ? contentHeightForFormattingContextRoot(layoutContext, layoutBox) : LayoutUnit { height.value() }; >- return FormattingContext::Geometry::HeightAndMargin { computedHeightValue, { } }; >+ // 1. If 'margin-top', or 'margin-bottom' are 'auto', their used value is 0. >+ // 2. If 'height' is 'auto', the height depends on the element's descendants per 10.6.7. >+ >+ auto& style = layoutBox.style(); >+ auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& containingBlock = *layoutBox.containingBlock(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->width(); >+ auto containingBlockHeight = layoutContext.displayBoxForLayoutBox(containingBlock)->height(); >+ >+ auto height = computedValueIfNotAuto(style.logicalHeight(), containingBlockHeight); >+ auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth); >+ auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth); >+ >+ // #1 >+ marginTop = marginTop.value_or(0); >+ marginBottom = marginBottom.value_or(0); >+ // #2 >+ if (!height) >+ height = contentHeightForFormattingContextRoot(layoutContext, layoutBox); >+ return FormattingContext::Geometry::HeightAndMargin { height, { marginTop, marginBottom } }; > } > > FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced()); >+ > // 10.3.5 Floating, non-replaced elements > // > // 1. If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'. > // 2. If 'width' is computed as 'auto', the used value is the "shrink-to-fit" width. >+ > auto& style = layoutBox.style(); > auto width = style.logicalWidth(); > // #1 >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index a83fe8c225efe48e676bb43cb1846251ee412689..77d4e7a45580676172eb66942d613b69ad211e42 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -59,7 +59,9 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > ASSERT(layoutBox.isInFlow() && !layoutBox.replaced()); > > auto compute = [&]() -> LayoutUnit { >- // https://www.w3.org/TR/CSS22/visudet.html >+ // 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. > // If 'height' is 'auto', the height depends on whether the element has any block-level children and whether it has padding or borders: > // The element's height is the distance from its top content edge to the first applicable of the following: > // 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines >@@ -86,7 +88,7 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin... > auto* lastInFlowChild = downcast<Container>(layoutBox).lastInFlowChild(); > ASSERT(lastInFlowChild); >- if (!BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(*lastInFlowChild)) { >+ if (!MarginCollapse::isMarginBottomCollapsedWithParent(*lastInFlowChild)) { > auto* lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild); > ASSERT(lastInFlowDisplayBox); > return lastInFlowDisplayBox->bottom() + lastInFlowDisplayBox->marginBottom(); >@@ -94,7 +96,7 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > > // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin > auto* inFlowChild = lastInFlowChild; >- while (inFlowChild && BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(*inFlowChild)) >+ while (inFlowChild && MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(*inFlowChild)) > inFlowChild = inFlowChild->previousInFlowSibling(); > if (inFlowChild) { > auto* inFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*inFlowChild); >@@ -106,11 +108,14 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > return 0; > }; > >- auto computedHeight = compute(); >+ auto height = compute(); >+ auto marginTop = MarginCollapse::marginTop(layoutContext, layoutBox); >+ auto marginBottom = MarginCollapse::marginBottom(layoutContext, layoutBox); >+ > if (!isStretchedToViewport(layoutContext, layoutBox)) >- return { computedHeight, { } }; >+ return { height, { marginTop, marginBottom } }; > auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBox().height(); >- return { std::max(computedHeight, initialContainingBlockHeight), { } }; >+ return { std::max(height, initialContainingBlockHeight), { marginTop, marginBottom } }; > } > > 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 186469
:
342378
| 342515 |
342521