Changeset 292689 in webkit
- Timestamp:
- Apr 10, 2022 2:56:21 PM (2 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r292686 r292689 1 2022-04-10 Alan Bujtas <zalan@apple.com> 2 3 Line clamp specific line-count code should be in RenderDeprecatedFlexibleBox 4 https://bugs.webkit.org/show_bug.cgi?id=239029 5 6 Reviewed by Antti Koivisto. 7 8 Moving the line-clamp specific code to RenderDeprecatedFlexibleBox enables us to 9 make RenderBlockFlow::lineCount "children inline" only. 10 11 * rendering/RenderDeprecatedFlexibleBox.cpp: 12 (WebCore::lineCountFor): 13 (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): 14 1 15 2022-04-10 Tyler Wilcock <tyler_w@apple.com> 2 16 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r292685 r292689 3233 3233 int RenderBlockFlow::lineCount() const 3234 3234 { 3235 // FIXME: This should be tested by clients.3236 if (style().visibility() != Visibility::Visible)3235 if (!childrenInline()) { 3236 ASSERT_NOT_REACHED(); 3237 3237 return 0; 3238 3239 if (childrenInline()) { 3238 } 3240 3239 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 3241 3242 3240 if (modernLineLayout()) 3241 return modernLineLayout()->lineCount(); 3243 3242 #endif 3244 if (legacyLineLayout()) 3245 return legacyLineLayout()->lineCount(); 3246 3247 return 0; 3248 } 3249 3250 int count = 0; 3251 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 3252 if (!shouldIncludeLinesForParentLineCount(blockFlow)) 3253 continue; 3254 count += blockFlow.lineCount(); 3255 } 3256 3257 return count; 3243 if (legacyLineLayout()) 3244 return legacyLineLayout()->lineCount(); 3245 3246 return 0; 3258 3247 } 3259 3248 … … 3551 3540 bool RenderBlockFlow::hasLines() const 3552 3541 { 3553 if (!childrenInline()) 3554 return false; 3555 3556 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 3557 if (modernLineLayout()) 3558 return modernLineLayout()->lineCount(); 3559 #endif 3560 3561 return legacyLineLayout() && legacyLineLayout()->lineBoxes().firstLineBox(); 3542 return childrenInline() ? lineCount() : false; 3562 3543 } 3563 3544 … … 3813 3794 else { 3814 3795 for (auto& listItem : childrenOfType<RenderListItem>(*this)) { 3796 if (!listItem.childrenInline() || listItem.style().visibility() != Visibility::Visible) 3797 continue; 3815 3798 lineCountInBlock += listItem.lineCount(); 3816 3799 if (lineCountInBlock > 1) -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r291992 r292689 996 996 } 997 997 998 static size_t lineCountFor(const RenderBlockFlow& blockFlow) 999 { 1000 if (blockFlow.style().visibility() != Visibility::Visible) 1001 return 0; 1002 1003 if (blockFlow.childrenInline()) 1004 return blockFlow.lineCount(); 1005 1006 size_t count = 0; 1007 for (auto& child : childrenOfType<RenderBlockFlow>(blockFlow)) { 1008 if (blockFlow.isFloatingOrOutOfFlowPositioned() || !blockFlow.style().height().isAuto()) 1009 continue; 1010 count += lineCountFor(child); 1011 } 1012 return count; 1013 } 1014 998 1015 void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren) 999 1016 { … … 1016 1033 child->layoutIfNeeded(); 1017 1034 if (child->style().height().isAuto() && is<RenderBlockFlow>(*child)) 1018 maxLineCount = std::max (maxLineCount, downcast<RenderBlockFlow>(*child).lineCount());1035 maxLineCount = std::max<int>(maxLineCount, lineCountFor(downcast<RenderBlockFlow>(*child))); 1019 1036 } 1020 1037 … … 1031 1048 1032 1049 RenderBlockFlow& blockChild = downcast<RenderBlockFlow>(*child); 1033 int lineCount = blockChild.lineCount();1050 int lineCount = lineCountFor(blockChild); 1034 1051 if (lineCount <= numVisibleLines) 1035 1052 continue;
Note: See TracChangeset
for help on using the changeset viewer.