WebKit Bugzilla
Attachment 341906 Details for
Bug 186270
: [LFC] Merge width and margin computation for block-level, replaced elements in normal flow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186270-20180604090425.patch (text/plain), 4.82 KB, created by
zalan
on 2018-06-04 09:04:26 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-04 09:04:26 PDT
Size:
4.82 KB
patch
obsolete
>Subversion Revision: 232466 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c271927d47d5575f2756a881b28f8a0f64bd047f..3140c7d7997a27650d8d5481fd494d5ba4698601 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-06-04 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Merge width and margin computation for block-level, replaced elements in normal flow >+ https://bugs.webkit.org/show_bug.cgi?id=186270 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://www.w3.org/TR/CSS22/visudet.html#block-replaced-width >+ 10.3.4 Block-level, replaced elements in normal flow >+ >+ The used value of 'width' is determined as for inline replaced elements. >+ Then the rules for non-replaced block-level elements are applied to determine the margins. >+ >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): >+ > 2018-06-04 Zalan Bujtas <zalan@apple.com> > > [LFC] Merge width and margin computation for block-level, non-replaced and inline,replaced element in normal flow >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 9bbadcc3026250c4fee770c3b55651333a071df2..48a01a555bd9203f6690c16f5cf42028996d2ef1 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -70,7 +70,7 @@ private: > > private: > static LayoutUnit inFlowNonReplacedHeight(LayoutContext&, const Box&); >- static FormattingContext::Geometry::WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&); >+ static FormattingContext::Geometry::WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = std::nullopt); > }; > > // This class implements margin collapsing for block formatting context. >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 4b5ff2637c5a05a3aeefd5b3f035171b2ffdc26f..552829b664a5f9c75f5553555de85d0e98d71f40 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -113,7 +113,8 @@ LayoutUnit BlockFormattingContext::Geometry::inFlowNonReplacedHeight(LayoutConte > return std::max(computedHeight, initialContainingBlockHeight); > } > >-FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) >+FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox, >+ std::optional<LayoutUnit> precomputedWidth) > { > ASSERT(layoutBox.isInFlow() && !layoutBox.replaced()); > >@@ -139,7 +140,7 @@ FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::in > // edges of the containing block. > > auto& style = layoutBox.style(); >- auto width = style.logicalWidth(); >+ auto width = precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(); > auto* containingBlock = layoutBox.containingBlock(); > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*containingBlock)->width(); > auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >@@ -319,8 +320,16 @@ FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::in > if (!layoutBox.replaced()) > return inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox); > // 10.3.4 Block-level, replaced elements in normal flow >- // The used value of 'width' is determined as for inline replaced elements >- return FormattingContext::Geometry::inlineReplacedWidthAndMargin(layoutContext, layoutBox); >+ // >+ // 1. The used value of 'width' is determined as for inline replaced elements. >+ // 2. Then the rules for non-replaced block-level elements are applied to determine the margins. >+ >+ // #1 >+ auto inlineReplacedWidthAndMargin = FormattingContext::Geometry::inlineReplacedWidthAndMargin(layoutContext, layoutBox); >+ // #2 >+ auto inlineReplacedWidthAndBlockNonReplacedMargin = Geometry::inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, inlineReplacedWidthAndMargin.width); >+ ASSERT(inlineReplacedWidthAndMargin.width == inlineReplacedWidthAndBlockNonReplacedMargin.width); >+ return inlineReplacedWidthAndBlockNonReplacedMargin; > } > > }
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186270
: 341906