Title: [292691] trunk/Source/WebCore
Revision
292691
Author
za...@apple.com
Date
2022-04-10 16:52:37 -0700 (Sun, 10 Apr 2022)

Log Message

[Line clamp] Move line clamp only code from RenderBlockFlow to RenderDeprecatedFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=239041

Reviewed by Antti Koivisto.

* rendering/RenderBlockFlow.cpp:
(WebCore::shouldIncludeLinesForParentLineCount): Deleted.
(WebCore::RenderBlockFlow::clearTruncation): Deleted.
* rendering/RenderBlockFlow.h:
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::shouldIncludeLinesForParentLineCount):
(WebCore::clearTruncation):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292690 => 292691)


--- trunk/Source/WebCore/ChangeLog	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/ChangeLog	2022-04-10 23:52:37 UTC (rev 292691)
@@ -1,3 +1,20 @@
+2022-04-10  Alan Bujtas  <za...@apple.com>
+
+        [Line clamp] Move line clamp only code from RenderBlockFlow to RenderDeprecatedFlexibleBox
+        https://bugs.webkit.org/show_bug.cgi?id=239041
+
+        Reviewed by Antti Koivisto.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::shouldIncludeLinesForParentLineCount): Deleted.
+        (WebCore::RenderBlockFlow::clearTruncation): Deleted.
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::shouldIncludeLinesForParentLineCount):
+        (WebCore::clearTruncation):
+        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+        (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
+
 2022-04-10  Nikolas Zimmermann  <nzimmerm...@igalia.com>
 
         [LBSE] Activate SVG transform support through layers

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (292690 => 292691)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 23:52:37 UTC (rev 292691)
@@ -3224,12 +3224,6 @@
     rareBlockFlowData()->m_multiColumnFlow.clear();
 }
 
-bool shouldIncludeLinesForParentLineCount(const RenderBlockFlow& blockFlow)
-{
-    // FIXME: This test does not make much sense.
-    return !blockFlow.isFloatingOrOutOfFlowPositioned() && blockFlow.style().height().isAuto();
-}
-
 int RenderBlockFlow::lineCount() const
 {
     if (!childrenInline()) {
@@ -3246,24 +3240,6 @@
     return 0;
 }
 
-void RenderBlockFlow::clearTruncation()
-{
-    if (style().visibility() != Visibility::Visible)
-        return;
-
-    if (childrenInline() && hasMarkupTruncation()) {
-        setHasMarkupTruncation(false);
-        for (auto* box = firstRootBox(); box; box = box->nextRootBox())
-            box->clearTruncation();
-        return;
-    }
-
-    for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) {
-        if (shouldIncludeLinesForParentLineCount(blockFlow))
-            blockFlow.clearTruncation();
-    }
-}
-
 bool RenderBlockFlow::containsNonZeroBidiLevel() const
 {
     for (auto lineBox = InlineIterator::firstLineBoxFor(*this); lineBox; lineBox.traverseNext()) {

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (292690 => 292691)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2022-04-10 23:52:37 UTC (rev 292691)
@@ -342,7 +342,6 @@
     void setLineLayoutPath(LineLayoutPath path) { setRenderBlockFlowLineLayoutPath(path); }
 
     int lineCount() const;
-    void clearTruncation();
 
     void setHasMarkupTruncation(bool b) { setRenderBlockFlowHasMarkupTruncation(b); }
     bool hasMarkupTruncation() const { return renderBlockFlowHasMarkupTruncation(); }
@@ -616,8 +615,6 @@
     return { };
 }
 
-bool shouldIncludeLinesForParentLineCount(const RenderBlockFlow&);
-
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBlockFlow, isRenderBlockFlow())

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (292690 => 292691)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-10 23:52:37 UTC (rev 292691)
@@ -937,6 +937,29 @@
         setHeight(oldHeight);
 }
 
+static bool shouldIncludeLinesForParentLineCount(const RenderBlockFlow& blockFlow)
+{
+    return !blockFlow.isFloatingOrOutOfFlowPositioned() && blockFlow.style().height().isAuto();
+}
+
+static void clearTruncation(RenderBlockFlow& blockFlow)
+{
+    if (blockFlow.style().visibility() != Visibility::Visible)
+        return;
+
+    if (blockFlow.childrenInline() && blockFlow.hasMarkupTruncation()) {
+        blockFlow.setHasMarkupTruncation(false);
+        for (auto* box = blockFlow.firstRootBox(); box; box = box->nextRootBox())
+            box->clearTruncation();
+        return;
+    }
+
+    for (auto& child : childrenOfType<RenderBlockFlow>(blockFlow)) {
+        if (shouldIncludeLinesForParentLineCount(child))
+            clearTruncation(child);
+    }
+}
+
 static LegacyRootInlineBox* lineAtIndex(const RenderBlockFlow& flow, int i)
 {
     ASSERT(i >= 0);
@@ -1027,7 +1050,7 @@
             // Dirty all the positioned objects.
             if (is<RenderBlockFlow>(*child)) {
                 downcast<RenderBlockFlow>(*child).markPositionedObjectsForLayout();
-                downcast<RenderBlockFlow>(*child).clearTruncation();
+                clearTruncation(downcast<RenderBlockFlow>(*child));
             }
         }
         child->layoutIfNeeded();
@@ -1127,7 +1150,7 @@
 
             if (is<RenderBlockFlow>(*child)) {
                 downcast<RenderBlockFlow>(*child).markPositionedObjectsForLayout();
-                downcast<RenderBlockFlow>(*child).clearTruncation();
+                clearTruncation(downcast<RenderBlockFlow>(*child));
             }
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to