Changeset 286593 in webkit
- Timestamp:
- Dec 7, 2021 2:20:24 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderFlexibleBox.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderTable.cpp (modified) (3 diffs)
-
Source/WebCore/rendering/RenderTable.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r286591 r286593 1 2021-12-03 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flexbox] Account for captions when flexing tables with specified sizes 4 https://bugs.webkit.org/show_bug.cgi?id=233814 5 6 Reviewed by Darin Adler. 7 8 * TestExpectations: Unskipped two tests that are now passing 9 1 10 2021-12-07 Martin Robinson <mrobinson@webkit.org> 2 11 -
trunk/LayoutTests/TestExpectations
r286591 r286593 4225 4225 4226 4226 # Tables as flex items. 4227 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-column-1.html [ ImageOnlyFailure ]4228 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-column-2.html [ ImageOnlyFailure ]4229 4227 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-min-height-1.html [ ImageOnlyFailure ] 4230 4228 -
trunk/Source/WebCore/ChangeLog
r286591 r286593 1 2021-12-03 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flexbox] Account for captions when flexing tables with specified sizes 4 https://bugs.webkit.org/show_bug.cgi?id=233814 5 6 Reviewed by Darin Adler. 7 8 Flexing tables is complex because of the specifics of the table layout algorithms. There are 9 two interrelated issues that were causing some failures in flexbox WPT tests. 10 11 The first one is that tables interpret overriding sizes (flexed sizes) as the sizes of rows + captions. 12 However the specified height of a table only accounts for the heights of the rows, not the captions. That's 13 why when setting the flexed height of a table we must add up the specified height of the table and the height 14 of the captions. The table algorithm will properly substract the captions' size in order to compute the 15 available height for rows. 16 17 The second issue is that the table layout algorithm adds the size of the bottom border at the very end 18 of its execution after performing all the computations and it does it unconditionally. The thing is that 19 the flexbox code already takes into account the borders and paddings so we basically have to substract that 20 border when setting the height of the table, because the table layout will add it later. 21 22 * rendering/RenderFlexibleBox.cpp: 23 (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild): 24 * rendering/RenderTable.cpp: 25 (WebCore::RenderTable::computeCaptionsLogicalHeight const): New method refactored from current code. 26 (WebCore::RenderTable::layout): 27 * rendering/RenderTable.h: Expose computeCaptionsLogicalHeight. 28 1 29 2021-12-07 Martin Robinson <mrobinson@webkit.org> 2 30 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r286421 r286593 41 41 #include "RenderReplaced.h" 42 42 #include "RenderStyleConstants.h" 43 #include "RenderTable.h" 43 44 #include "RenderView.h" 44 45 #include "WritingMode.h" … … 653 654 if (!height) 654 655 return height; 655 return height.value() + child.scrollbarLogicalHeight(); 656 // Tables interpret overriding sizes as the size of captions + rows. However the specified height of a table 657 // only includes the size of the rows. That's why we need to add the size of the captions here so that the table 658 // layout algorithm behaves appropiately. 659 LayoutUnit captionsHeight; 660 if (is<RenderTable>(child) && childMainSizeIsDefinite(child, size)) 661 captionsHeight = downcast<RenderTable>(child).sumCaptionsLogicalHeight(); 662 return *height + child.scrollbarLogicalHeight() + captionsHeight; 656 663 } 657 664 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r284093 r286593 420 420 } 421 421 422 LayoutUnit RenderTable::sumCaptionsLogicalHeight() const 423 { 424 LayoutUnit height; 425 for (auto& caption : m_captions) 426 height += caption->logicalHeight() + caption->marginBefore() + caption->marginAfter(); 427 return height; 428 } 429 422 430 void RenderTable::layout() 423 431 { … … 506 514 computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalHeightLength); 507 515 508 if (hasOverridingLogicalHeight()) { 509 LayoutUnit captionLogicalHeight; 510 for (auto& caption : m_captions) 511 captionLogicalHeight += caption->logicalHeight() + caption->marginBefore() + caption->marginAfter(); 512 computedLogicalHeight = std::max(computedLogicalHeight, overridingLogicalHeight() - captionLogicalHeight); 513 } 516 if (hasOverridingLogicalHeight()) 517 computedLogicalHeight = std::max(computedLogicalHeight, overridingLogicalHeight() - borderAndPaddingAfter - sumCaptionsLogicalHeight()); 514 518 515 519 Length logicalMaxHeightLength = style().logicalMaxHeight(); … … 534 538 // overriding or specified height in strict mode, but this value will not be cached. 535 539 shouldCacheIntrinsicContentLogicalHeightForFlexItem = false; 536 setLogicalHeight(hasOverridingLogicalHeight() ? overridingLogicalHeight() : logicalHeight() + computedLogicalHeight);540 setLogicalHeight(hasOverridingLogicalHeight() ? overridingLogicalHeight() - borderAndPaddingAfter : logicalHeight() + computedLogicalHeight); 537 541 } 538 542 -
trunk/Source/WebCore/rendering/RenderTable.h
r278253 r286593 272 272 void willInsertTableSection(RenderTableSection& child, RenderObject* beforeChild); 273 273 274 LayoutUnit sumCaptionsLogicalHeight() const; 275 274 276 protected: 275 277 void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
Note: See TracChangeset
for help on using the changeset viewer.