Changeset 241646 in webkit
- Timestamp:
- Feb 16, 2019 4:54:01 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241633 r241646 1 2019-02-16 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Apply min/max width constraints to preferred width computation 4 https://bugs.webkit.org/show_bug.cgi?id=194739 5 6 Reviewed by Simon Fraser. 7 8 * fast/block/block-only/min-max-and-preferred-width-simple-expected.html: Added. 9 * fast/block/block-only/min-max-and-preferred-width-simple.html: Added. 10 1 11 2019-02-15 Dean Jackson <dino@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r241637 r241646 1 2019-02-16 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Apply min/max width constraints to preferred width computation 4 https://bugs.webkit.org/show_bug.cgi?id=194739 5 6 Reviewed by Simon Fraser. 7 8 Ensure that both min-height and max-height are taken into account while computing the preferred width. 9 10 Test: fast/block/block-only/min-max-and-preferred-width-simple.html 11 12 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 13 (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 14 1 15 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r241545 r241646 291 291 FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::intrinsicWidthConstraints(const LayoutState& layoutState, const Box& layoutBox) 292 292 { 293 auto& style = layoutBox.style(); 294 if (auto width = fixedValue(style.logicalWidth())) 295 return { *width, *width }; 296 297 // Minimum/maximum width can't be depending on the containing block's width. 298 if (!style.logicalWidth().isAuto()) 299 return { }; 300 301 if (!is<Container>(layoutBox)) 302 return { }; 303 304 auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; 305 for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) { 306 if (child.isOutOfFlowPositioned()) 307 continue; 308 auto& formattingState = layoutState.formattingStateForBox(child); 309 ASSERT(formattingState.isBlockFormattingState()); 310 auto childIntrinsicWidthConstraints = formattingState.intrinsicWidthConstraints(child); 311 ASSERT(childIntrinsicWidthConstraints); 312 313 auto& style = child.style(); 314 auto horizontalMarginBorderAndPadding = fixedValue(style.marginStart()).valueOr(0) 315 + LayoutUnit { style.borderLeftWidth() } 316 + fixedValue(style.paddingLeft()).valueOr(0) 317 + fixedValue(style.paddingRight()).valueOr(0) 318 + LayoutUnit { style.borderRightWidth() } 319 + fixedValue(style.marginEnd()).valueOr(0); 320 321 intrinsicWidthConstraints.minimum = std::max(intrinsicWidthConstraints.minimum, childIntrinsicWidthConstraints->minimum + horizontalMarginBorderAndPadding); 322 intrinsicWidthConstraints.maximum = std::max(intrinsicWidthConstraints.maximum, childIntrinsicWidthConstraints->maximum + horizontalMarginBorderAndPadding); 323 } 324 325 return constrainByMinMaxWidth(layoutBox, intrinsicWidthConstraints); 293 auto computedIntrinsicWidthConstraints = [&]() -> IntrinsicWidthConstraints { 294 auto& style = layoutBox.style(); 295 if (auto width = fixedValue(style.logicalWidth())) 296 return { *width, *width }; 297 298 // Minimum/maximum width can't be depending on the containing block's width. 299 if (!style.logicalWidth().isAuto()) 300 return { }; 301 302 if (!is<Container>(layoutBox)) 303 return { }; 304 305 auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; 306 for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) { 307 if (child.isOutOfFlowPositioned()) 308 continue; 309 const auto& formattingState = layoutState.formattingStateForBox(child); 310 ASSERT(formattingState.isBlockFormattingState()); 311 auto childIntrinsicWidthConstraints = formattingState.intrinsicWidthConstraints(child); 312 ASSERT(childIntrinsicWidthConstraints); 313 314 auto& childStyle = child.style(); 315 auto marginBorderAndPadding = fixedValue(childStyle.marginStart()).valueOr(0) 316 + LayoutUnit { childStyle.borderLeftWidth() } 317 + fixedValue(childStyle.paddingLeft()).valueOr(0) 318 + fixedValue(childStyle.paddingRight()).valueOr(0) 319 + LayoutUnit { childStyle.borderRightWidth() } 320 + fixedValue(childStyle.marginEnd()).valueOr(0); 321 intrinsicWidthConstraints.minimum = std::max(intrinsicWidthConstraints.minimum, childIntrinsicWidthConstraints->minimum + marginBorderAndPadding); 322 intrinsicWidthConstraints.maximum = std::max(intrinsicWidthConstraints.maximum, childIntrinsicWidthConstraints->maximum + marginBorderAndPadding); 323 } 324 return intrinsicWidthConstraints; 325 }; 326 327 return constrainByMinMaxWidth(layoutBox, computedIntrinsicWidthConstraints()); 326 328 } 327 329 -
trunk/Tools/ChangeLog
r241620 r241646 1 2019-02-16 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Apply min/max width constraints to preferred width computation 4 https://bugs.webkit.org/show_bug.cgi?id=194739 5 6 Reviewed by Simon Fraser. 7 8 * LayoutReloaded/misc/LFC-passing-tests.txt: 9 1 10 2019-02-15 Ross Kirsling <ross.kirsling@sony.com> 2 11 -
trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt
r241591 r241646 98 98 fast/block/block-only/margin-sibling-collapse-propagated.html 99 99 fast/block/block-only/margin-simple.html 100 fast/block/block-only/min-max-and-preferred-width-simple.html 100 101 fast/block/block-only/min-max-height-percentage.html 101 102 fast/block/block-only/negative-margin-simple.html
Note: See TracChangeset
for help on using the changeset viewer.