Title: [271042] trunk/Source/WebCore
Revision
271042
Author
[email protected]
Date
2020-12-21 15:05:58 -0800 (Mon, 21 Dec 2020)

Log Message

[LFC][Integration] Reserve both the line and the run vector sizes
https://bugs.webkit.org/show_bug.cgi?id=220068
<rdar://problem/72560573>

Reviewed by Simon Fraser.

We actually know how many entries these vectors will have (in case of no-bidi content).

* layout/integration/LayoutIntegrationInlineContent.h:
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271041 => 271042)


--- trunk/Source/WebCore/ChangeLog	2020-12-21 22:31:35 UTC (rev 271041)
+++ trunk/Source/WebCore/ChangeLog	2020-12-21 23:05:58 UTC (rev 271042)
@@ -1,3 +1,18 @@
+2020-12-21  Zalan Bujtas  <[email protected]>
+
+        [LFC][Integration] Reserve both the line and the run vector sizes
+        https://bugs.webkit.org/show_bug.cgi?id=220068
+        <rdar://problem/72560573>
+
+        Reviewed by Simon Fraser.
+
+        We actually know how many entries these vectors will have (in case of no-bidi content).
+
+        * layout/integration/LayoutIntegrationInlineContent.h:
+        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+
 2020-12-21  Chris Dumez  <[email protected]>
 
         Simplify CARingBuffer usage with SharedMemory storage

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h (271041 => 271042)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h	2020-12-21 22:31:35 UTC (rev 271041)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h	2020-12-21 23:05:58 UTC (rev 271042)
@@ -50,8 +50,8 @@
     static Ref<InlineContent> create(const LineLayout& lineLayout) { return adoptRef(*new InlineContent(lineLayout)); }
     ~InlineContent();
 
-    using Runs = Vector<Run, 4>;
-    using Lines = Vector<Line, 4>;
+    using Runs = Vector<Run>;
+    using Lines = Vector<Line>;
 
     Runs runs;
     Lines lines;

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (271041 => 271042)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2020-12-21 22:31:35 UTC (rev 271041)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2020-12-21 23:05:58 UTC (rev 271042)
@@ -289,6 +289,7 @@
     auto& bidiRuns = bidiResolver.runs();
     if (bidiRuns.runCount() == 1) {
         // Fast path for cases when there's no bidi boundary.
+        inlineContent.runs.reserveCapacity(inlineFormattingState.lineRuns().size());
         for (auto& lineRun : inlineFormattingState.lineRuns()) {
             if (auto& text = lineRun.text())
                 createDisplayTextRunForRange(lineRun, text->start(), text->end());
@@ -305,6 +306,7 @@
     auto& lineBoxes = inlineFormattingState.lineBoxes();
     auto& runs = inlineContent.runs;
     size_t runIndex = 0;
+    inlineContent.lines.reserveCapacity(lines.size());
     for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
         auto& line = lines[lineIndex];
         auto& lineBoxLogicalRect = line.lineBoxLogicalRect();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to