Changeset 277435 in webkit
- Timestamp:
- May 13, 2021 8:00:12 AM (14 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/flexbox/flex-column-with-percent-height-descendants-crash-expected.txt (added)
-
LayoutTests/fast/flexbox/flex-column-with-percent-height-descendants-crash.html (added)
-
LayoutTests/fast/flexbox/flex-column-with-percent-height-descendants-expected.html (added)
-
LayoutTests/fast/flexbox/flex-column-with-percent-height-descendants.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderFlexibleBox.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r277434 r277435 1 2021-05-13 Zalan Bujtas <zalan@apple.com> 2 3 [css-flexbox] Flex item construction may affect sibling flex item height computation 4 https://bugs.webkit.org/show_bug.cgi?id=225489 5 6 Reviewed by Sergio Villar Senin. 7 8 * fast/flexbox/flex-column-with-percent-height-descendants-expected.html: Added. 9 * fast/flexbox/flex-column-with-percent-height-descendants.html: Added. 10 1 11 2021-05-13 Chris Fleizach <cfleizach@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r277434 r277435 1 2021-05-13 Zalan Bujtas <zalan@apple.com> 2 3 [css-flexbox] Flex item construction may affect sibling flex item height computation 4 https://bugs.webkit.org/show_bug.cgi?id=225489 5 6 Reviewed by Sergio Villar Senin. 7 8 Flex item construction triggers layout both on the flex item and on its descendants (see constructFlexItem). 9 During this layout a percent height descendant may indirectly set an incorrect value on the flex container's 10 m_hasDefiniteHeight (this is due to the odd way we choose to resolve percent height values on the ancestor chain, 11 see setOverridingContainingBlockContentLogicalHeight(WTF::nullopt)). 12 Now this incorrect m_hasDefiniteHeight value (Indefinite) causes the next sibling's (also) percent height 13 resolve fail as it tells the flex item that the flex container can't help with resolving the percent height value. 14 As the result we end up with an incorrect, 0px height value for this sibling. 15 e.g. 16 <div style="height: 100px; display: flex; flex-direction: column;"> 17 <div id=flexItemA style="height: 50px;"><div style="height: 100%;"></div></div> 18 <div id=flexItemB style="height: 50%;"></div> 19 </div> 20 By the time we get to the construction of flexItemB, the RenderFlexibleBox's (flex container) m_hasDefiniteHeight 21 is already (and incorrectly) set to Indefinite as the result of us trying to resolve flexItemA's descendant height percentage. 22 This Indefinite value makes the flexItemB's height resolution fail as we believe that the flex container has indefinite height 23 e.g "height: auto", while it is clearly resolvable (50% of 100px). 24 Now if we flip the order and flexItemB comes first, the test case passes fine. 25 It is very unfortunate that some descendant height resolving process can trigger a state change on the ancestor RenderFlexibleBox, but 26 fixing it would certainly require some substantial architectural change. 27 In this patch, we just reset the m_hasDefiniteHeight flag inside the loop to ensure that each flex item 28 starts with a fresh height percent resolve state. 29 30 Test: fast/flexbox/flex-column-with-percent-height-descendants.html 31 32 * rendering/RenderFlexibleBox.cpp: 33 (WebCore::RenderFlexibleBox::layoutFlexItems): 34 1 35 2021-05-13 Chris Fleizach <cfleizach@apple.com> 2 36 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r277371 r277435 994 994 } 995 995 allItems.append(constructFlexItem(*child, relayoutChildren)); 996 } 997 998 // constructFlexItem() might set the override containing block height so any value cached for definiteness might be incorrect. 999 m_hasDefiniteHeight = SizeDefiniteness::Unknown; 996 // constructFlexItem() might set the override containing block height so any value cached for definiteness might be incorrect. 997 m_hasDefiniteHeight = SizeDefiniteness::Unknown; 998 } 1000 999 1001 1000 const LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max());
Note: See TracChangeset
for help on using the changeset viewer.