Title: [281280] trunk/Source/WebCore
Revision
281280
Author
[email protected]
Date
2021-08-19 16:21:48 -0700 (Thu, 19 Aug 2021)

Log Message

[LFC][IFC] Remove redundant LineBox functions
https://bugs.webkit.org/show_bug.cgi?id=228046

Reviewed by Sam Weinig.

The line box's contentLogicalWidth always matches the root inlinebox's logical width.

* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
* layout/formattingContexts/inline/InlineLineBox.cpp:
(WebCore::Layout::LineBox::LineBox):
* layout/formattingContexts/inline/InlineLineBox.h:
(WebCore::Layout::LineBox::logicalRect const):
(WebCore::Layout::LineBox::logicalWidth const): Deleted.
(WebCore::Layout::LineBox::logicalHeight const): Deleted.
(WebCore::Layout::LineBox::logicalTopLeft const): Deleted.
(WebCore::Layout::LineBox::logicalSize const): Deleted.
(WebCore::Layout::LineBox::contentLogicalWidth const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281279 => 281280)


--- trunk/Source/WebCore/ChangeLog	2021-08-19 23:17:35 UTC (rev 281279)
+++ trunk/Source/WebCore/ChangeLog	2021-08-19 23:21:48 UTC (rev 281280)
@@ -1,3 +1,27 @@
+2021-08-19  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Remove redundant LineBox functions
+        https://bugs.webkit.org/show_bug.cgi?id=228046
+
+        Reviewed by Sam Weinig.
+
+        The line box's contentLogicalWidth always matches the root inlinebox's logical width. 
+
+        * layout/formattingContexts/inline/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+        * layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
+        (WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
+        (WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
+        * layout/formattingContexts/inline/InlineLineBox.cpp:
+        (WebCore::Layout::LineBox::LineBox):
+        * layout/formattingContexts/inline/InlineLineBox.h:
+        (WebCore::Layout::LineBox::logicalRect const):
+        (WebCore::Layout::LineBox::logicalWidth const): Deleted.
+        (WebCore::Layout::LineBox::logicalHeight const): Deleted.
+        (WebCore::Layout::LineBox::logicalTopLeft const): Deleted.
+        (WebCore::Layout::LineBox::logicalSize const): Deleted.
+        (WebCore::Layout::LineBox::contentLogicalWidth const): Deleted.
+
 2021-08-19  Wenson Hsieh  <[email protected]>
 
         [iOS] Remove support for the meaningful tap heuristic

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (281279 => 281280)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2021-08-19 23:17:35 UTC (rev 281279)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2021-08-19 23:21:48 UTC (rev 281280)
@@ -474,7 +474,7 @@
     auto& lineBoxLogicalRect = lineBox.logicalRect();
     if (!lineBox.hasContent()) {
         // Fast path for lines with no content e.g. <div><span></span><span></span></div> or <span><div></div></span> where we construct empty pre and post blocks.
-        ASSERT(!lineBox.contentLogicalWidth() && !lineBoxLogicalRect.height());
+        ASSERT(!lineBox.rootInlineBox().hasContent() && !lineBoxLogicalRect.height());
         auto updateInlineBoxesGeometryIfApplicable = [&] {
             if (!lineBox.hasInlineBox())
                 return;

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp (281279 => 281280)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp	2021-08-19 23:17:35 UTC (rev 281279)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp	2021-08-19 23:21:48 UTC (rev 281280)
@@ -249,7 +249,7 @@
         }
         // Construct the missing LineBox::InlineBoxes starting with the topmost layout box.
         for (auto* layoutBox : WTF::makeReversedRange(layoutBoxesWithoutInlineBoxes)) {
-            auto inlineBox = InlineLevelBox::createInlineBox(*layoutBox, rootInlineBox.logicalLeft(), lineBox.contentLogicalWidth());
+            auto inlineBox = InlineLevelBox::createInlineBox(*layoutBox, rootInlineBox.logicalLeft(), rootInlineBox.logicalWidth());
             setVerticalGeometryForInlineBox(inlineBox);
             simplifiedAlignVerticallyIfApplicable(inlineBox, { });
             lineBox.addInlineLevelBox(WTFMove(inlineBox));
@@ -314,7 +314,7 @@
             // and adjust it later if we come across an inlineBoxEnd run (see below).
             // Inline box run is based on margin box. Let's convert it to border box.
             auto marginStart = formattingContext().geometryForBox(layoutBox).marginStart();
-            auto initialLogicalWidth = lineBox.contentLogicalWidth() - (run.logicalLeft() + marginStart);
+            auto initialLogicalWidth = rootInlineBox.logicalWidth() - (run.logicalLeft() + marginStart);
             ASSERT(initialLogicalWidth >= 0);
             auto inlineBox = InlineLevelBox::createInlineBox(layoutBox, logicalLeft + marginStart, initialLogicalWidth);
             setVerticalGeometryForInlineBox(inlineBox);
@@ -589,7 +589,7 @@
                 break;
             case VerticalAlign::Bottom:
                 // Note that this logical top is not relative to the parent inline box.
-                logicalTop = lineBox.logicalHeight() - inlineLevelBox.layoutBounds().descent - inlineLevelBox.baseline();
+                logicalTop = lineBox.logicalRect().height() - inlineLevelBox.layoutBounds().descent - inlineLevelBox.baseline();
                 break;
             default:
                 ASSERT_NOT_IMPLEMENTED_YET();

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBox.cpp (281279 => 281280)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBox.cpp	2021-08-19 23:17:35 UTC (rev 281279)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBox.cpp	2021-08-19 23:21:48 UTC (rev 281280)
@@ -36,7 +36,6 @@
 
 LineBox::LineBox(const Box& rootLayoutBox, const InlineLayoutPoint& logicalTopleft, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit contentLogicalWidth, size_t nonSpanningInlineLevelBoxCount)
     : m_logicalRect(logicalTopleft, InlineLayoutSize { lineLogicalWidth, { } })
-    , m_contentLogicalWidth(contentLogicalWidth)
     , m_rootInlineBox(rootLayoutBox, contentLogicalLeft, InlineLayoutSize { contentLogicalWidth, { } }, InlineLevelBox::Type::RootInlineBox)
 {
     m_nonRootInlineLevelBoxList.reserveInitialCapacity(nonSpanningInlineLevelBoxCount);

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBox.h (281279 => 281280)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBox.h	2021-08-19 23:17:35 UTC (rev 281279)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBox.h	2021-08-19 23:21:48 UTC (rev 281280)
@@ -63,12 +63,6 @@
     LineBox(const Box& rootLayoutBox, const InlineLayoutPoint& logicalTopLeft, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit contentLogicalWidth, size_t nonSpanningInlineLevelBoxCount);
 
     const InlineRect& logicalRect() const { return m_logicalRect; }
-    InlineLayoutUnit logicalWidth() const { return logicalSize().width(); }
-    InlineLayoutUnit logicalHeight() const { return logicalSize().height(); }
-    InlineLayoutPoint logicalTopLeft() const { return logicalRect().topLeft(); }
-    InlineLayoutSize logicalSize() const { return logicalRect().size(); }
-    InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
-
     // Note that the line can have many inline boxes and be "empty" the same time e.g. <div><span></span><span></span></div>
     bool hasContent() const { return m_hasContent; }
     bool hasInlineBox() const { return m_boxTypes.contains(InlineLevelBox::Type::InlineBox); }
@@ -106,7 +100,6 @@
 
 private:
     InlineRect m_logicalRect;
-    InlineLayoutUnit m_contentLogicalWidth { 0 };
     bool m_hasContent { false };
     OptionSet<InlineLevelBox::Type> m_boxTypes;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to