Title: [273889] trunk/Source/WebCore
Revision
273889
Author
za...@apple.com
Date
2021-03-04 08:26:28 -0800 (Thu, 04 Mar 2021)

Log Message

[LFC][IFC] LineBox::m_rootInlineBox does not need to be a UniqueRef
https://bugs.webkit.org/show_bug.cgi?id=222705

Reviewed by Antti Koivisto.

* layout/inlineformatting/InlineLineBox.cpp:
(WebCore::Layout::m_rootInlineBox):
(WebCore::Layout::LineBox::logicalRectForTextRun const):
(WebCore::Layout::LineBox::logicalRectForInlineLevelBox const):
* layout/inlineformatting/InlineLineBox.h:
(WebCore::Layout::LineBox::logicalRectForRootInlineBox const):
(WebCore::Layout::LineBox::alignmentBaseline const):
(WebCore::Layout::LineBox::inlineLevelBoxForLayoutBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273888 => 273889)


--- trunk/Source/WebCore/ChangeLog	2021-03-04 14:23:01 UTC (rev 273888)
+++ trunk/Source/WebCore/ChangeLog	2021-03-04 16:26:28 UTC (rev 273889)
@@ -1,5 +1,21 @@
 2021-03-04  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][IFC] LineBox::m_rootInlineBox does not need to be a UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=222705
+
+        Reviewed by Antti Koivisto.
+
+        * layout/inlineformatting/InlineLineBox.cpp:
+        (WebCore::Layout::m_rootInlineBox):
+        (WebCore::Layout::LineBox::logicalRectForTextRun const):
+        (WebCore::Layout::LineBox::logicalRectForInlineLevelBox const):
+        * layout/inlineformatting/InlineLineBox.h:
+        (WebCore::Layout::LineBox::logicalRectForRootInlineBox const):
+        (WebCore::Layout::LineBox::alignmentBaseline const):
+        (WebCore::Layout::LineBox::inlineLevelBoxForLayoutBox):
+
+2021-03-04  Zalan Bujtas  <za...@apple.com>
+
         [LFC][IFC] InlineContentBuilder::createDisplayNonRootInlineBoxes should check if the line has inline boxes at all
         https://bugs.webkit.org/show_bug.cgi?id=222707
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp (273888 => 273889)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp	2021-03-04 14:23:01 UTC (rev 273888)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp	2021-03-04 16:26:28 UTC (rev 273889)
@@ -86,7 +86,7 @@
 LineBox::LineBox(const Box& rootLayoutBox, const InlineLayoutPoint& logicalTopleft, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit contentLogicalWidth, size_t numberOfRuns)
     : m_logicalRect(logicalTopleft, InlineLayoutSize { lineLogicalWidth, { } })
     , m_contentLogicalWidth(contentLogicalWidth)
-    , m_rootInlineBox(makeUniqueRef<LineBox::InlineLevelBox>(rootLayoutBox, contentLogicalLeft, InlineLayoutSize { contentLogicalWidth, { } }, InlineLevelBox::Type::RootInlineBox))
+    , m_rootInlineBox(rootLayoutBox, contentLogicalLeft, InlineLayoutSize { contentLogicalWidth, { } }, InlineLevelBox::Type::RootInlineBox)
 {
     m_nonRootInlineLevelBoxList.reserveInitialCapacity(numberOfRuns);
     m_nonRootInlineLevelBoxMap.reserveInitialCapacity(numberOfRuns);
@@ -113,7 +113,7 @@
         runlogicalTop += parentInlineBox->logicalTop();
     }
     InlineLayoutUnit logicalHeight = fontMetrics.height();
-    return { runlogicalTop, m_rootInlineBox->logicalLeft() + run.logicalLeft(), run.logicalWidth(), logicalHeight };
+    return { runlogicalTop, m_rootInlineBox.logicalLeft() + run.logicalLeft(), run.logicalWidth(), logicalHeight };
 }
 
 InlineRect LineBox::logicalRectForLineBreakBox(const Box& layoutBox) const
@@ -132,8 +132,8 @@
         return inlineBoxLogicalRect;
 
     // Fast path for inline level boxes on the root inline box (e.g <div><img></div>).
-    if (&layoutBox.parent() == &m_rootInlineBox->layoutBox()) {
-        inlineBoxLogicalRect.moveVertically(m_rootInlineBox->logicalTop());
+    if (&layoutBox.parent() == &m_rootInlineBox.layoutBox()) {
+        inlineBoxLogicalRect.moveVertically(m_rootInlineBox.logicalTop());
         return inlineBoxLogicalRect;
     }
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h (273888 => 273889)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h	2021-03-04 14:23:01 UTC (rev 273888)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h	2021-03-04 16:26:28 UTC (rev 273889)
@@ -153,7 +153,7 @@
 
     InlineRect logicalRectForTextRun(const Line::Run&) const;
     InlineRect logicalRectForLineBreakBox(const Box&) const;
-    InlineRect logicalRectForRootInlineBox() const { return m_rootInlineBox->logicalRect(); }
+    InlineRect logicalRectForRootInlineBox() const { return m_rootInlineBox.logicalRect(); }
     InlineRect logicalBorderBoxForAtomicInlineLevelBox(const Box&, const BoxGeometry&) const;
     InlineRect logicalBorderBoxForInlineBox(const Box&, const BoxGeometry&) const;
 
@@ -161,7 +161,7 @@
     using InlineLevelBoxList = Vector<std::unique_ptr<InlineLevelBox>>;
     const InlineLevelBoxList& nonRootInlineLevelBoxes() const { return m_nonRootInlineLevelBoxList; }
 
-    InlineLayoutUnit alignmentBaseline() const { return m_rootInlineBox->logicalTop() + m_rootInlineBox->baseline(); }
+    InlineLayoutUnit alignmentBaseline() const { return m_rootInlineBox.logicalTop() + m_rootInlineBox.baseline(); }
 
 private:
     friend class LineBoxBuilder;
@@ -172,7 +172,7 @@
 
     InlineLevelBox& rootInlineBox() { return m_rootInlineBox; }
 
-    InlineLevelBox& inlineLevelBoxForLayoutBox(const Box& layoutBox) { return &layoutBox == &m_rootInlineBox->layoutBox() ? m_rootInlineBox.get() : *m_nonRootInlineLevelBoxMap.get(&layoutBox); }
+    InlineLevelBox& inlineLevelBoxForLayoutBox(const Box& layoutBox) { return &layoutBox == &m_rootInlineBox.layoutBox() ? m_rootInlineBox : *m_nonRootInlineLevelBoxMap.get(&layoutBox); }
     InlineRect logicalRectForInlineLevelBox(const Box& layoutBox) const;
 
     void setHasContent(bool hasContent) { m_hasContent = hasContent; }
@@ -183,7 +183,7 @@
     bool m_hasContent { false };
     OptionSet<InlineLevelBox::Type> m_boxTypes;
 
-    UniqueRef<InlineLevelBox> m_rootInlineBox;
+    InlineLevelBox m_rootInlineBox;
     InlineLevelBoxList m_nonRootInlineLevelBoxList;
 
     HashMap<const Box*, InlineLevelBox*> m_nonRootInlineLevelBoxMap;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to