Title: [159185] trunk/Source/WebCore
- Revision
- 159185
- Author
- [email protected]
- Date
- 2013-11-13 03:45:47 -0800 (Wed, 13 Nov 2013)
Log Message
Avoid unnecessarily padding the FontDescription families vector.
<https://webkit.org/b/124267>
Use a bit of reserveInitialCapacity+uncheckedAppend grease to avoid
jumping all the way to capacity=16 when a style has more than just
a single font-family in it.
130 kB progression on HTML5-8266 locally.
Reviewed by Antti Koivisto.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyFontFamily::applyValue):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (159184 => 159185)
--- trunk/Source/WebCore/ChangeLog 2013-11-13 11:38:14 UTC (rev 159184)
+++ trunk/Source/WebCore/ChangeLog 2013-11-13 11:45:47 UTC (rev 159185)
@@ -1,5 +1,21 @@
2013-11-13 Andreas Kling <[email protected]>
+ Avoid unnecessarily padding the FontDescription families vector.
+ <https://webkit.org/b/124267>
+
+ Use a bit of reserveInitialCapacity+uncheckedAppend grease to avoid
+ jumping all the way to capacity=16 when a style has more than just
+ a single font-family in it.
+
+ 130 kB progression on HTML5-8266 locally.
+
+ Reviewed by Antti Koivisto.
+
+ * css/DeprecatedStyleBuilder.cpp:
+ (WebCore::ApplyPropertyFontFamily::applyValue):
+
+2013-11-13 Andreas Kling <[email protected]>
+
Make remaining CSSPrimitiveValue constructors return PassRef.
<https://webkit.org/b/124270>
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (159184 => 159185)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-13 11:38:14 UTC (rev 159184)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-13 11:45:47 UTC (rev 159185)
@@ -703,14 +703,18 @@
if (!value->isValueList())
return;
+ auto& valueList = toCSSValueList(*value);
+
FontDescription fontDescription = styleResolver->style()->fontDescription();
// Before mapping in a new font-family property, we should reset the generic family.
bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
fontDescription.setGenericFamily(FontDescription::NoFamily);
Vector<AtomicString, 1> families;
- for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
- CSSValue* item = i.value();
+ families.reserveInitialCapacity(valueList.length());
+
+ for (unsigned i = 0; i < valueList.length(); ++i) {
+ CSSValue* item = valueList.item(i);
if (!item->isPrimitiveValue())
continue;
CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
@@ -755,7 +759,7 @@
continue;
if (families.isEmpty())
fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily);
- families.append(face);
+ families.uncheckedAppend(face);
}
if (families.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes