WebKit Bugzilla
Attachment 340540 Details for
Bug 185701
: [LFC] Implement width computation for replaced out if flow elements.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185701-20180516164456.patch (text/plain), 8.07 KB, created by
zalan
on 2018-05-16 16:44:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-16 16:44:57 PDT
Size:
8.07 KB
patch
obsolete
>Subversion Revision: 231854 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 051b6bc788a0e126cf71a04de8d7841aafbd5ba9..7775ad57b20e0b0b43f60fcf667ceea617b8a002 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-16 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Implement width computation for replaced out if flow elements. >+ https://bugs.webkit.org/show_bug.cgi?id=185701 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The used value of 'width' is determined as for inline replaced elements. >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): >+ (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): >+ (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const): >+ * layout/FormattingContext.h: >+ > 2018-05-14 Yusuke Suzuki <utatane.tea@gmail.com> > > [Win] Use C++17 in MSVC >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 8df9dff435225825983cd906239a56db6181fd1d..65f6369c6bcb5e5ae560f4ad521cedbe0b5b0988 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -93,7 +93,7 @@ void FormattingContext::computeFloatingWidth(LayoutContext& layoutContext, const > ASSERT_NOT_REACHED(); > return; > } >- computeInFlowReplacedWidth(layoutContext, layoutBox, displayBox); >+ computeReplacedWidth(layoutContext, layoutBox, displayBox); > } > > void FormattingContext::computeOutOfFlowHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >@@ -154,6 +154,10 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext) > > void FormattingContext::computeOutOfFlowNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >+ ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplaced()); >+ >+ // 10.6.4 Absolutely positioned, non-replaced elements >+ // > // For absolutely positioned elements, the used values of the vertical dimensions must satisfy this constraint: > // 'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' > // = height of containing block >@@ -208,10 +212,13 @@ void FormattingContext::computeOutOfFlowNonReplacedHeight(LayoutContext& layoutC > displayBox.setHeight(computedHeightValue); > } > >-void FormattingContext::computeInFlowReplacedWidth(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const >+void FormattingContext::computeReplacedWidth(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const > { >- // 10.3.4 Block-level, replaced elements in normal flow: The used value of 'width' is determined as for inline replaced elements >- // 10.3.6 Floating, replaced elements: The used value of 'width' is determined as for inline replaced elements. >+ ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.isReplaced()); >+ >+ // 10.3.4 Block-level, replaced elements in normal flow: The used value of 'width' is determined as for inline replaced elements. >+ // 10.3.6 Floating, replaced elements: The used value of 'width' is determined as for inline replaced elements. >+ // 10.3.8 Absolutely positioned, replaced elements: The used value of 'width' is determined as for inline replaced elements. > > // 10.3.2 Inline, replaced elements > // >@@ -260,6 +267,7 @@ void FormattingContext::computeInFlowReplacedWidth(LayoutContext&, const Box& la > LayoutUnit FormattingContext::contentHeightForFormattingContextRoot(LayoutContext& layoutContext, const Box& layoutBox) const > { > ASSERT(layoutBox.style().logicalHeight().isAuto()); >+ > if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) > return 0; > >@@ -287,6 +295,10 @@ LayoutUnit FormattingContext::contentHeightForFormattingContextRoot(LayoutContex > > void FormattingContext::computeOutOfFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >+ ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplaced()); >+ >+ // 10.3.7 Absolutely positioned, non-replaced elements >+ // > // 'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' > // = width of containing block > >@@ -335,6 +347,15 @@ void FormattingContext::computeOutOfFlowNonReplacedWidth(LayoutContext& layoutCo > displayBox.setWidth(computedWidthValue); > } > >+void FormattingContext::computeOutOfFlowReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >+{ >+ ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.isReplaced()); >+ // 10.3.8 Absolutely positioned, replaced elements >+ // >+ // The used value of 'width' is determined as for inline replaced elements. >+ computeReplacedWidth(layoutContext, layoutBox, displayBox); >+} >+ > LayoutUnit FormattingContext::shrinkToFitWidth(LayoutContext&, const Box&) const > { > return 0; >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 2fbff65f35e3e58e3b17bee870fae3293b9732b3..913dec9b6e9d9e52f002d826b1230b2570e031cd 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -87,11 +87,12 @@ protected: > void placeInFlowPositionedChildren(const Container&) const; > void layoutOutOfFlowDescendants(LayoutContext&s) const; > >- void computeInFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; >+ void computeReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; > > private: > void computeOutOfFlowNonReplacedHeight(LayoutContext&, const Box&, Display::Box&) const; > void computeOutOfFlowNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; >+ void computeOutOfFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; > > LayoutUnit contentHeightForFormattingContextRoot(LayoutContext&, const Box&) const; > LayoutUnit shrinkToFitWidth(LayoutContext&, const Box&) const; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index e78b592a8a180d1e6672a132f326d3dbeba449f0..3c6889a5450b6d0809335fae46f2dc7d487e4070 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -149,11 +149,13 @@ void BlockFormattingContext::computeInFlowWidth(LayoutContext& layoutContext, co > computeInFlowNonReplacedWidth(layoutContext, layoutBox, displayBox); > return; > } >- computeInFlowReplacedWidth(layoutContext, layoutBox, displayBox); >+ computeReplacedWidth(layoutContext, layoutBox, displayBox); > } > > void BlockFormattingContext::computeInFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >+ ASSERT(layoutBox.isInFlow() && !layoutBox.isReplaced()); >+ > // 10.3.3 Block-level, non-replaced elements in normal flow > // The following constraints must hold among the used values of the other properties: > // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block >@@ -202,6 +204,8 @@ LayoutUnit BlockFormattingContext::marginBottom(const Box& layoutBox) const > > void BlockFormattingContext::computeInFlowNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >+ ASSERT(layoutBox.isInFlow() && !layoutBox.isReplaced()); >+ > // https://www.w3.org/TR/CSS22/visudet.html > // 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:
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 185701
: 340540