Changeset 263260 in webkit
- Timestamp:
- Jun 19, 2020, 5:43:03 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/layoutformattingcontext/float-avoider-available-horizontal-space2-expected.html (added)
-
LayoutTests/fast/layoutformattingcontext/float-avoider-available-horizontal-space2.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (modified) (1 diff)
-
Source/WebCore/layout/blockformatting/BlockFormattingContext.h (modified) (1 diff)
-
Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (modified) (3 diffs)
-
Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r263255 r263260 1 2020-06-19 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][BFC] Min/max-width should always be resolved against the containing block width 4 https://bugs.webkit.org/show_bug.cgi?id=213365 5 6 Reviewed by Antti Koivisto. 7 8 * fast/layoutformattingcontext/float-avoider-available-horizontal-space2-expected.html: Added. 9 * fast/layoutformattingcontext/float-avoider-available-horizontal-space2.html: Added. 10 1 11 2020-06-19 Myles C. Maxfield <mmaxfield@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r263256 r263260 1 2020-06-19 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][BFC] Min/max-width should always be resolved against the containing block width 4 https://bugs.webkit.org/show_bug.cgi?id=213365 5 6 Reviewed by Antti Koivisto. 7 8 Even when neighboring floats shrink the available horizontal space, the min/max(normal) widths should 9 be resolved against the containing block's logical width. 10 11 Test: fast/layoutformattingcontext/float-avoider-available-horizontal-space2.html 12 13 * layout/blockformatting/BlockFormattingContext.cpp: 14 (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): 15 * layout/blockformatting/BlockFormattingContext.h: 16 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 17 (WebCore::Layout::BlockFormattingContext::Geometry::computedWidthAndMargin): 18 * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: 19 (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): 20 1 21 2020-06-10 Sergio Villar Senin <svillar@igalia.com> 2 22 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r263221 r263260 315 315 void BlockFormattingContext::computeWidthAndMargin(const FloatingContext& floatingContext, const Box& layoutBox, const ConstraintsPair& constraintsPair) 316 316 { 317 auto a djustedConstraints = constraintsPair;318 if (layoutBox.isFloatAvoider() && layoutBox.style().logicalWidth().isAuto()) {317 auto availableWidthFloatAvoider = Optional<LayoutUnit> { }; 318 if (layoutBox.isFloatAvoider()) { 319 319 // Float avoiders' available width might be shrunk by existing floats in the context. 320 if (auto availableWidthForFloatAvoider = usedAvailableWidthForFloatAvoider(floatingContext, layoutBox, constraintsPair)) 321 adjustedConstraints.containingBlock.horizontal.logicalWidth = *availableWidthForFloatAvoider; 322 } 323 324 auto contentWidthAndMargin = geometry().computedWidthAndMargin(layoutBox, adjustedConstraints); 320 availableWidthFloatAvoider = usedAvailableWidthForFloatAvoider(floatingContext, layoutBox, constraintsPair); 321 } 322 auto contentWidthAndMargin = geometry().computedWidthAndMargin(layoutBox, constraintsPair.containingBlock.horizontal, availableWidthFloatAvoider); 325 323 auto& displayBox = formattingState().displayBox(layoutBox); 326 324 displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth); -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r263155 r263260 86 86 IntrinsicWidthConstraints intrinsicWidthConstraints(const Box&); 87 87 88 ContentWidthAndMargin computedWidthAndMargin(const Box&, const ConstraintsPair&);88 ContentWidthAndMargin computedWidthAndMargin(const Box&, const HorizontalConstraints&, Optional<LayoutUnit> availableWidthFloatAvoider); 89 89 90 90 private: -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r262951 r263260 284 284 } 285 285 286 ContentWidthAndMargin BlockFormattingContext::Geometry::computedWidthAndMargin(const Box& layoutBox, const ConstraintsPair& constraintsPair) 287 { 288 auto& horizontalConstraints = constraintsPair.containingBlock.horizontal; 289 auto compute = [&](Optional<LayoutUnit> usedWidth) { 286 ContentWidthAndMargin BlockFormattingContext::Geometry::computedWidthAndMargin(const Box& layoutBox, const HorizontalConstraints& horizontalConstraints, Optional<LayoutUnit> availableWidthFloatAvoider) 287 { 288 auto compute = [&] (auto constraintsForWidth, Optional<LayoutUnit> usedWidth) { 290 289 if (layoutBox.isFloatingPositioned()) 291 return floatingWidthAndMargin(layoutBox, horizontalConstraints, { usedWidth, { } });290 return floatingWidthAndMargin(layoutBox, constraintsForWidth, { usedWidth, { } }); 292 291 293 292 if (layoutBox.isInFlow()) 294 return inFlowWidthAndMargin(layoutBox, horizontalConstraints, { usedWidth, { } });293 return inFlowWidthAndMargin(layoutBox, constraintsForWidth, { usedWidth, { } }); 295 294 296 295 ASSERT_NOT_REACHED(); … … 298 297 }; 299 298 300 auto contentWidthAndMargin = compute({ }); 301 299 auto horizontalConstraintsForWidth = horizontalConstraints; 300 if (layoutBox.style().logicalWidth().isAuto() && availableWidthFloatAvoider) { 301 // While the non-auto width values should all be resolved against the containing block's width, when 302 // the width is auto the available horizontal space is shrunk by neighboring floats. 303 horizontalConstraintsForWidth.logicalWidth = *availableWidthFloatAvoider; 304 } 305 auto contentWidthAndMargin = compute(horizontalConstraintsForWidth, { }); 302 306 auto availableWidth = horizontalConstraints.logicalWidth; 303 307 if (auto maxWidth = computedMaxWidth(layoutBox, availableWidth)) { 304 auto maxWidthAndMargin = compute( maxWidth);308 auto maxWidthAndMargin = compute(horizontalConstraints, maxWidth); 305 309 if (contentWidthAndMargin.contentWidth > maxWidthAndMargin.contentWidth) 306 310 contentWidthAndMargin = maxWidthAndMargin; … … 308 312 309 313 auto minWidth = computedMinWidth(layoutBox, availableWidth).valueOr(0); 310 auto minWidthAndMargin = compute( minWidth);314 auto minWidthAndMargin = compute(horizontalConstraints, minWidth); 311 315 if (contentWidthAndMargin.contentWidth < minWidthAndMargin.contentWidth) 312 316 contentWidthAndMargin = minWidthAndMargin; -
trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp
r262951 r263260 146 146 ASSERT(tableBox.isTableBox()); 147 147 if (!tableBox.hasChild()) { 148 auto constraintsPair = ConstraintsPair { { horizontalConstraints, { } }, { horizontalConstraints, { } } }; 149 auto computedWidthAndMargin = geometry().computedWidthAndMargin(tableBox, constraintsPair); 148 auto computedWidthAndMargin = geometry().computedWidthAndMargin(tableBox, horizontalConstraints, { }); 150 149 auto& displayBox = formattingState().displayBox(tableBox); 151 150 displayBox.setContentBoxWidth(computedWidthAndMargin.contentWidth);
Note:
See TracChangeset
for help on using the changeset viewer.