Line clamp specific line-count code should be in RenderDeprecatedFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=239029

Reviewed by Antti Koivisto.

Moving the line-clamp specific code to RenderDeprecatedFlexibleBox enables us to
make RenderBlockFlow::lineCount "children inline" only.

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::lineCountFor):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@292689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 6af8962..073d5aa8 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -3232,29 +3232,18 @@
 
 int RenderBlockFlow::lineCount() const
 {
-    // FIXME: This should be tested by clients.
-    if (style().visibility() != Visibility::Visible)
+    if (!childrenInline()) {
+        ASSERT_NOT_REACHED();
         return 0;
-
-    if (childrenInline()) {
+    }
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-        if (modernLineLayout())
-            return modernLineLayout()->lineCount();
+    if (modernLineLayout())
+        return modernLineLayout()->lineCount();
 #endif
-        if (legacyLineLayout())
-            return legacyLineLayout()->lineCount();
+    if (legacyLineLayout())
+        return legacyLineLayout()->lineCount();
 
-        return 0;
-    }
-
-    int count = 0;
-    for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) {
-        if (!shouldIncludeLinesForParentLineCount(blockFlow))
-            continue;
-        count += blockFlow.lineCount();
-    }
-
-    return count;
+    return 0;
 }
 
 void RenderBlockFlow::clearTruncation()
@@ -3550,15 +3539,7 @@
 
 bool RenderBlockFlow::hasLines() const
 {
-    if (!childrenInline())
-        return false;
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (modernLineLayout())
-        return modernLineLayout()->lineCount();
-#endif
-
-    return legacyLineLayout() && legacyLineLayout()->lineBoxes().firstLineBox();
+    return childrenInline() ? lineCount() : false;
 }
 
 void RenderBlockFlow::invalidateLineLayoutPath()
@@ -3812,6 +3793,8 @@
                 lineCountInBlock = this->lineCount();
             else {
                 for (auto& listItem : childrenOfType<RenderListItem>(*this)) {
+                    if (!listItem.childrenInline() || listItem.style().visibility() != Visibility::Visible)
+                        continue;
                     lineCountInBlock += listItem.lineCount();
                     if (lineCountInBlock > 1)
                         break;