Title: [252380] trunk/Source/WebCore
Revision
252380
Author
za...@apple.com
Date
2019-11-12 17:08:08 -0800 (Tue, 12 Nov 2019)

Log Message

[LFC] InlineFormattingState::addInlineRun should take a unique_ptr<Display::Run>
https://bugs.webkit.org/show_bug.cgi?id=204099
<rdar://problem/57102586>

Reviewed by Antti Koivisto.

It's rather wasteful to create a Display::Run just to pass it in to InlineFormattingState::addInlineRun.

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
* layout/inlineformatting/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::addInlineRun):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252379 => 252380)


--- trunk/Source/WebCore/ChangeLog	2019-11-13 00:39:09 UTC (rev 252379)
+++ trunk/Source/WebCore/ChangeLog	2019-11-13 01:08:08 UTC (rev 252380)
@@ -1,3 +1,18 @@
+2019-11-12  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] InlineFormattingState::addInlineRun should take a unique_ptr<Display::Run>
+        https://bugs.webkit.org/show_bug.cgi?id=204099
+        <rdar://problem/57102586>
+
+        Reviewed by Antti Koivisto.
+
+        It's rather wasteful to create a Display::Run just to pass it in to InlineFormattingState::addInlineRun.
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
+        * layout/inlineformatting/InlineFormattingState.h:
+        (WebCore::Layout::InlineFormattingState::addInlineRun):
+
 2019-11-12  Antti Koivisto  <an...@apple.com>
 
         Skip matched declarations cache only for length resolution affecting font properties

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (252379 => 252380)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-11-13 00:39:09 UTC (rev 252379)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-11-13 01:08:08 UTC (rev 252380)
@@ -438,7 +438,7 @@
         // Completely collapsed line runs don't generate display runs either.
         if (lineRun.isCollapsedToVisuallyEmpty())
             continue;
-        formattingState.addInlineRun({ lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext() }, currentLine);
+        formattingState.addInlineRun(makeUnique<Display::Run>(lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext()), currentLine);
     }
 
     // Compute box final geometry.

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h (252379 => 252380)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2019-11-13 00:39:09 UTC (rev 252379)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2019-11-13 01:08:08 UTC (rev 252380)
@@ -54,7 +54,7 @@
 
     const InlineRuns& inlineRuns() const { return m_inlineRuns; }
     InlineRuns& inlineRuns() { return m_inlineRuns; }
-    void addInlineRun(const Display::Run&, const LineBox&);
+    void addInlineRun(std::unique_ptr<Display::Run>&&, const LineBox&);
 
     const LineBoxes& lineBoxes() const { return m_lineBoxes; }
     LineBoxes& lineBoxes() { return m_lineBoxes; }
@@ -70,11 +70,10 @@
     HashMap<const Display::Run*, const LineBox*> m_inlineRunToLineMap;
 };
 
-inline void InlineFormattingState::addInlineRun(const Display::Run& inlineRun, const LineBox& line)
+inline void InlineFormattingState::addInlineRun(std::unique_ptr<Display::Run>&& displayRun, const LineBox& line)
 {
-    auto run = makeUnique<Display::Run>(inlineRun);
-    m_inlineRunToLineMap.set(run.get(), &line);
-    m_inlineRuns.append(WTFMove(run));
+    m_inlineRunToLineMap.set(displayRun.get(), &line);
+    m_inlineRuns.append(WTFMove(displayRun));
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to