WebKit Bugzilla
Attachment 362206 Details for
Bug 194739
: [LFC] Apply min/max width constraints to preferred width computation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194739-20190215212326.patch (text/plain), 8.51 KB, created by
zalan
on 2019-02-15 21:23:27 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-02-15 21:23:27 PST
Size:
8.51 KB
patch
obsolete
>Subversion Revision: 241559 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index eb4df96545bb7c3ac3511a052e2bce6b064a2d8c..04d09f98feacfab6f1ad3706b81e717836e0916a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-02-15 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Apply min/max width constraints to preferred width computation >+ https://bugs.webkit.org/show_bug.cgi?id=194739 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Ensure that both min-height and max-height are taken into account while computing the preferred width. >+ >+ Test: fast/block/block-only/min-max-and-preferred-width-simple.html >+ >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): >+ > 2019-02-14 Ross Kirsling <ross.kirsling@sony.com> > > [WTF] Add environment variable helpers >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 649d5c469becee441f0a1324b01e827ea9c646e5..256269708afd304c37f2157b427d070ef47a07a4 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -290,39 +290,41 @@ bool BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidt > > FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::intrinsicWidthConstraints(const LayoutState& layoutState, const Box& layoutBox) > { >- auto& style = layoutBox.style(); >- if (auto width = fixedValue(style.logicalWidth())) >- return { *width, *width }; >- >- // Minimum/maximum width can't be depending on the containing block's width. >- if (!style.logicalWidth().isAuto()) >- return { }; >- >- if (!is<Container>(layoutBox)) >- return { }; >- >- auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; >- for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) { >- if (child.isOutOfFlowPositioned()) >- continue; >- auto& formattingState = layoutState.formattingStateForBox(child); >- ASSERT(formattingState.isBlockFormattingState()); >- auto childIntrinsicWidthConstraints = formattingState.intrinsicWidthConstraints(child); >- ASSERT(childIntrinsicWidthConstraints); >- >- auto& style = child.style(); >- auto horizontalMarginBorderAndPadding = fixedValue(style.marginStart()).valueOr(0) >- + LayoutUnit { style.borderLeftWidth() } >- + fixedValue(style.paddingLeft()).valueOr(0) >- + fixedValue(style.paddingRight()).valueOr(0) >- + LayoutUnit { style.borderRightWidth() } >- + fixedValue(style.marginEnd()).valueOr(0); >- >- intrinsicWidthConstraints.minimum = std::max(intrinsicWidthConstraints.minimum, childIntrinsicWidthConstraints->minimum + horizontalMarginBorderAndPadding); >- intrinsicWidthConstraints.maximum = std::max(intrinsicWidthConstraints.maximum, childIntrinsicWidthConstraints->maximum + horizontalMarginBorderAndPadding); >- } >+ auto computedIntrinsicWidthConstraints = [&]() -> IntrinsicWidthConstraints { >+ auto& style = layoutBox.style(); >+ if (auto width = fixedValue(style.logicalWidth())) >+ return { *width, *width }; >+ >+ // Minimum/maximum width can't be depending on the containing block's width. >+ if (!style.logicalWidth().isAuto()) >+ return { }; >+ >+ if (!is<Container>(layoutBox)) >+ return { }; >+ >+ auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; >+ for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) { >+ if (child.isOutOfFlowPositioned()) >+ continue; >+ auto& formattingState = layoutState.formattingStateForBox(child); >+ ASSERT(formattingState.isBlockFormattingState()); >+ auto childIntrinsicWidthConstraints = formattingState.intrinsicWidthConstraints(child); >+ ASSERT(childIntrinsicWidthConstraints); >+ >+ auto& childStyle = child.style(); >+ auto marginBorderAndPadding = fixedValue(childStyle.marginStart()).valueOr(0) >+ + LayoutUnit { childStyle.borderLeftWidth() } >+ + fixedValue(childStyle.paddingLeft()).valueOr(0) >+ + fixedValue(childStyle.paddingRight()).valueOr(0) >+ + LayoutUnit { childStyle.borderRightWidth() } >+ + fixedValue(childStyle.marginEnd()).valueOr(0); >+ intrinsicWidthConstraints.minimum = std::max(intrinsicWidthConstraints.minimum, childIntrinsicWidthConstraints->minimum + marginBorderAndPadding); >+ intrinsicWidthConstraints.maximum = std::max(intrinsicWidthConstraints.maximum, childIntrinsicWidthConstraints->maximum + marginBorderAndPadding); >+ } >+ return intrinsicWidthConstraints; >+ }; > >- return constrainByMinMaxWidth(layoutBox, intrinsicWidthConstraints); >+ return constrainByMinMaxWidth(layoutBox, computedIntrinsicWidthConstraints()); > } > > } >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 673899dcfba80f8be455b1ac1505cef1fee82816..7c114d2052d02d7fb9f7ea9e8fa02b81b09cfa23 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,12 @@ >+2019-02-15 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Apply min/max width constraints to preferred width computation >+ https://bugs.webkit.org/show_bug.cgi?id=194739 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * LayoutReloaded/misc/LFC-passing-tests.txt: >+ > 2019-02-14 Ross Kirsling <ross.kirsling@sony.com> > > [WTF] Add environment variable helpers >diff --git a/Tools/LayoutReloaded/misc/LFC-passing-tests.txt b/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >index 996dd331e12c1ae63646cd25e856376854efd5f9..97885cfcea69e12b8a04e0739c63ef022690119f 100644 >--- a/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >+++ b/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >@@ -97,6 +97,7 @@ fast/block/block-only/margin-left-right-sizing.html > fast/block/block-only/margin-propagation-simple-content-height.html > fast/block/block-only/margin-sibling-collapse-propagated.html > fast/block/block-only/margin-simple.html >+fast/block/block-only/min-max-and-preferred-width-simple.html > fast/block/block-only/min-max-height-percentage.html > fast/block/block-only/negative-margin-simple.html > fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 32bd451e1ce8ad432dea54bd49ed6d80cc7d6550..f9334cc598d60913504e5a23e9ef72ddad3063a1 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2019-02-15 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Apply min/max width constraints to preferred width computation >+ https://bugs.webkit.org/show_bug.cgi?id=194739 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/block/block-only/min-max-and-preferred-width-simple-expected.html: Added. >+ * fast/block/block-only/min-max-and-preferred-width-simple.html: Added. >+ > 2019-02-14 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins >diff --git a/LayoutTests/fast/block/block-only/min-max-and-preferred-width-simple-expected.html b/LayoutTests/fast/block/block-only/min-max-and-preferred-width-simple-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8b10f3f4f0e4744f8cda291b6dc53673e8d262a4 >--- /dev/null >+++ b/LayoutTests/fast/block/block-only/min-max-and-preferred-width-simple-expected.html >@@ -0,0 +1,14 @@ >+<style> >+.first { >+ width: 70px; >+ height: 30px; >+ background-color: red; >+} >+ >+.second { >+ width: 70px; >+ height: 70px; >+ background-color: green; >+} >+</style> >+<div class=first></div><div class=second></div> >\ No newline at end of file >diff --git a/LayoutTests/fast/block/block-only/min-max-and-preferred-width-simple.html b/LayoutTests/fast/block/block-only/min-max-and-preferred-width-simple.html >new file mode 100644 >index 0000000000000000000000000000000000000000..86a6f000ec8372985abb7cc5bd4081af7afdd7b1 >--- /dev/null >+++ b/LayoutTests/fast/block/block-only/min-max-and-preferred-width-simple.html >@@ -0,0 +1,18 @@ >+<style> >+.outer { >+ float: left; >+ width: auto; >+ height: 100px; >+ background-color: green; >+} >+ >+.inner { >+ width: 100px; >+ height: 10px; >+ background-color: red; >+ padding: 10px; >+ max-width: 50px; >+ min-width: 30px; >+} >+</style> >+<div class=outer><div class=inner></div></div> >\ No newline at end of file
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:
simon.fraser
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194739
: 362206