Title: [275638] trunk/Source/WebCore
Revision
275638
Author
[email protected]
Date
2021-04-07 15:36:13 -0700 (Wed, 07 Apr 2021)

Log Message

Wasted vector capacity under CSSFontFace::setUnicodeRange()
https://bugs.webkit.org/show_bug.cgi?id=224266

Reviewed by Devin Rousso.

We know how big the Vector<UnicodeRange> is up-front.

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::setUnicodeRange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275637 => 275638)


--- trunk/Source/WebCore/ChangeLog	2021-04-07 22:36:11 UTC (rev 275637)
+++ trunk/Source/WebCore/ChangeLog	2021-04-07 22:36:13 UTC (rev 275638)
@@ -1,5 +1,17 @@
 2021-04-07  Simon Fraser  <[email protected]>
 
+        Wasted vector capacity under CSSFontFace::setUnicodeRange()
+        https://bugs.webkit.org/show_bug.cgi?id=224266
+
+        Reviewed by Devin Rousso.
+
+        We know how big the Vector<UnicodeRange> is up-front.
+
+        * css/CSSFontFace.cpp:
+        (WebCore::CSSFontFace::setUnicodeRange):
+
+2021-04-07  Simon Fraser  <[email protected]>
+
         Wasted vector capacity under RuleFeatureSet::collectFeatures()
         https://bugs.webkit.org/show_bug.cgi?id=224248
 

Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (275637 => 275638)


--- trunk/Source/WebCore/css/CSSFontFace.cpp	2021-04-07 22:36:11 UTC (rev 275637)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp	2021-04-07 22:36:13 UTC (rev 275638)
@@ -271,11 +271,14 @@
     if (!is<CSSValueList>(unicodeRange))
         return false;
 
+    auto& list = downcast<CSSValueList>(unicodeRange);
+
     Vector<UnicodeRange> ranges;
-    auto& list = downcast<CSSValueList>(unicodeRange);
+    ranges.reserveInitialCapacity(list.length());
+
     for (auto& rangeValue : list) {
         auto& range = downcast<CSSUnicodeRangeValue>(rangeValue.get());
-        ranges.append({ range.from(), range.to() });
+        ranges.uncheckedAppend({ range.from(), range.to() });
     }
 
     if (ranges == m_ranges)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to