Title: [282873] trunk/Source/WebCore
Revision
282873
Author
an...@apple.com
Date
2021-09-22 06:38:18 -0700 (Wed, 22 Sep 2021)

Log Message

[LFC][Integration] Remove ensureLineBoxes
https://bugs.webkit.org/show_bug.cgi?id=230597

Reviewed by Alan Bujtas.

We don't need to switch to legacy lineboxes dynamically for non-style reasons anymore.

* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForStyle):

Support -webkit-border-fit:lines.

* layout/integration/LayoutIntegrationCoverage.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustForBorderFit const):

Use iterator.

(WebCore::RenderBlockFlow::clearTruncation):

Remove an unnecessary ensureLineBoxes call.

(WebCore::RenderBlockFlow::ensureLineBoxes): Deleted.

Boom.

* rendering/RenderBlockFlow.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::nodeAtPoint):

This is not needed before we start supporting RenderInlines with layers on LFC path.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282872 => 282873)


--- trunk/Source/WebCore/ChangeLog	2021-09-22 13:25:48 UTC (rev 282872)
+++ trunk/Source/WebCore/ChangeLog	2021-09-22 13:38:18 UTC (rev 282873)
@@ -1,3 +1,38 @@
+2021-09-22  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Remove ensureLineBoxes
+        https://bugs.webkit.org/show_bug.cgi?id=230597
+
+        Reviewed by Alan Bujtas.
+
+        We don't need to switch to legacy lineboxes dynamically for non-style reasons anymore.
+
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::printReason):
+        (WebCore::LayoutIntegration::canUseForStyle):
+
+        Support -webkit-border-fit:lines.
+
+        * layout/integration/LayoutIntegrationCoverage.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::adjustForBorderFit const):
+
+        Use iterator.
+
+        (WebCore::RenderBlockFlow::clearTruncation):
+
+        Remove an unnecessary ensureLineBoxes call.
+
+        (WebCore::RenderBlockFlow::ensureLineBoxes): Deleted.
+
+        Boom.
+
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::nodeAtPoint):
+
+        This is not needed before we start supporting RenderInlines with layers on LFC path.
+
 2021-09-22  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Add fallback font support

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (282872 => 282873)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-09-22 13:25:48 UTC (rev 282872)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-09-22 13:38:18 UTC (rev 282873)
@@ -146,9 +146,6 @@
     case AvoidanceReason::FlowHasTextCombine:
         stream << "text combine";
         break;
-    case AvoidanceReason::FlowHasBorderFitLines:
-        stream << "-webkit-border-fit";
-        break;
     case AvoidanceReason::FlowHasAfterWhiteSpaceLineBreak:
         stream << "line-break is after-white-space";
         break;
@@ -476,8 +473,6 @@
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineAlignEdges, reasons, includeReasons);
     if (style.lineSnap() != LineSnap::None)
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineSnap, reasons, includeReasons);
-    if (style.borderFit() == BorderFit::Lines)
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasBorderFitLines, reasons, includeReasons);    
     return reasons;
 }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (282872 => 282873)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2021-09-22 13:25:48 UTC (rev 282872)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2021-09-22 13:38:18 UTC (rev 282873)
@@ -65,7 +65,7 @@
     FlowHasPseudoFirstLetter                     = 1LLU  << 25,
     FlowHasTextCombine                           = 1LLU  << 26,
     // Unused                                    = 1LLU  << 27,
-    FlowHasBorderFitLines                        = 1LLU  << 28,
+    // Unused                                    = 1LLU  << 28,
     FlowHasAfterWhiteSpaceLineBreak              = 1LLU  << 29,
     FlowHasTextSecurity                          = 1LLU  << 30,
     FlowHasSVGFont                               = 1LLU  << 31,

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (282872 => 282873)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-09-22 13:25:48 UTC (rev 282872)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-09-22 13:38:18 UTC (rev 282873)
@@ -3042,13 +3042,9 @@
     // We don't deal with relative positioning.  Our assumption is that you shrink to fit the lines without accounting
     // for either overflow or translations via relative positioning.
     if (childrenInline()) {
-        const_cast<RenderBlockFlow&>(*this).ensureLineBoxes();
-
-        for (auto* box = firstRootBox(); box; box = box->nextRootBox()) {
-            if (box->firstChild())
-                left = std::min(left, x + LayoutUnit(box->firstChild()->x()));
-            if (box->lastChild())
-                right = std::max(right, x + LayoutUnit(ceilf(box->lastChild()->logicalRight())));
+        for (auto line = LayoutIntegration::firstLineFor(*this); line; line.traverseNext()) {
+            left = std::min(left, x + LayoutUnit(line->contentLogicalLeft()));
+            right = std::max(right, x + LayoutUnit(ceilf(line->contentLogicalRight())));
         }
     } else {
         for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBox()) {
@@ -3437,8 +3433,6 @@
         return;
 
     if (childrenInline() && hasMarkupTruncation()) {
-        ensureLineBoxes();
-
         setHasMarkupTruncation(false);
         for (auto* box = firstRootBox(); box; box = box->nextRootBox())
             box->clearTruncation();
@@ -3835,79 +3829,6 @@
 }
 #endif
 
-void RenderBlockFlow::ensureLineBoxes()
-{
-    if (!childrenInline())
-        return;
-
-    setLineLayoutPath(ForceLineBoxesPath);
-
-    if (legacyLineLayout() || !hasLineLayout())
-        return;
-
-    bool needsToPaginateComplexLines = [&] {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-        if (modernLineLayout() && modernLineLayout()->isPaginated())
-            return true;
-#endif
-        return false;
-    }();
-
-    m_lineLayout = makeUnique<LegacyLineLayout>(*this);
-
-    auto& legacyLineLayout = *this->legacyLineLayout();
-
-#if ASSERT_ENABLED
-    LayoutUnit oldHeight = logicalHeight();
-#endif
-    bool didNeedLayout = needsLayout();
-
-    bool relayoutChildren = false;
-    LayoutUnit repaintLogicalTop;
-    LayoutUnit repaintLogicalBottom;
-    if (needsToPaginateComplexLines) {
-        PaginatedLayoutStateMaintainer state(*this);
-        legacyLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
-        // This matches relayoutToAvoidWidows.
-        if (shouldBreakAtLineToAvoidWidow())
-            legacyLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
-        // FIXME: This is needed as long as simple and normal line layout produce different line breakings.
-        repaint();
-    } else
-        legacyLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
-
-    {
-        struct DeprecatedBoxStrechingScope {
-            DeprecatedBoxStrechingScope(RenderElement& parent)
-            {
-                if (is<RenderDeprecatedFlexibleBox>(parent) && parent.style().boxAlign() == BoxAlignment::Stretch) {
-                    // While modern flex box's uses override height to stretch its children, deprecated flex box
-                    // uses a flag which is consulted at updateLogicalHeight().
-                    // This scope class ensures that we don't collapse flex items while swapping the line structures.
-                    // see RenderBox::computeLogicalHeight where isStretchingChildren() is consulted.
-                    strechingRenderer = makeWeakPtr(downcast<RenderDeprecatedFlexibleBox>(parent));
-                    strechingRenderer->setIsStretchingChildren(true);
-                }
-            }
-
-            ~DeprecatedBoxStrechingScope()
-            {
-                if (strechingRenderer)
-                    strechingRenderer->setIsStretchingChildren(false);
-            }
-
-            WeakPtr<RenderDeprecatedFlexibleBox> strechingRenderer;
-
-        };
-        auto deprecatedBoxStrechingScope = DeprecatedBoxStrechingScope(*parent());
-        updateLogicalHeight();
-    }
-    ASSERT(didNeedLayout || ceilf(logicalHeight()) == ceilf(oldHeight));
-
-    if (!didNeedLayout)
-        clearNeedsLayout();
-}
-
 #if ENABLE(TREE_DEBUGGING)
 void RenderBlockFlow::outputFloatingObjects(WTF::TextStream& stream, int depth) const
 {

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (282872 => 282873)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2021-09-22 13:25:48 UTC (rev 282872)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2021-09-22 13:38:18 UTC (rev 282873)
@@ -364,9 +364,6 @@
     LayoutIntegration::LineLayout* modernLineLayout();
 #endif
 
-    void ensureLineBoxes();
-    void generateLineBoxTree();
-
 #if ENABLE(TREE_DEBUGGING)
     void outputFloatingObjects(WTF::TextStream&, int depth) const;
     void outputLineTreeAndMark(WTF::TextStream&, const LegacyInlineBox* markedBox, int depth) const;

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (282872 => 282873)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2021-09-22 13:25:48 UTC (rev 282872)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2021-09-22 13:38:18 UTC (rev 282873)
@@ -416,9 +416,9 @@
 bool RenderInline::nodeAtPoint(const HitTestRequest& request, HitTestResult& result,
                                 const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
 {
+    ASSERT(layer());
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)))
-        lineLayout->flow().ensureLineBoxes();
+    ASSERT(!LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)));
 #endif
     return m_lineBoxes.hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to