Title: [125968] trunk/Source/WebCore
Revision
125968
Author
[email protected]
Date
2012-08-18 10:43:58 -0700 (Sat, 18 Aug 2012)

Log Message

CSSValueList: Reserve the exact amount of space needed when constructing from CSS parser.
(No bug URL as Bugzilla is down today.)

Reviewed by Antti Koivisto.

Use Vector::reserveInitialCapacity() when constructing a CSSValueList from a CSSParserValueList
since we have the final length available. Also inlined the trivial append() and prepend().

* css/CSSValueList.cpp:
(WebCore::CSSValueList::CSSValueList):
* css/CSSValueList.h:
(WebCore::CSSValueList::append):
(WebCore::CSSValueList::prepend):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125967 => 125968)


--- trunk/Source/WebCore/ChangeLog	2012-08-18 14:21:38 UTC (rev 125967)
+++ trunk/Source/WebCore/ChangeLog	2012-08-18 17:43:58 UTC (rev 125968)
@@ -1,3 +1,19 @@
+2012-08-18  Andreas Kling  <[email protected]>
+
+        CSSValueList: Reserve the exact amount of space needed when constructing from CSS parser.
+        (No bug URL as Bugzilla is down today.)
+
+        Reviewed by Antti Koivisto.
+
+        Use Vector::reserveInitialCapacity() when constructing a CSSValueList from a CSSParserValueList
+        since we have the final length available. Also inlined the trivial append() and prepend().
+
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::CSSValueList):
+        * css/CSSValueList.h:
+        (WebCore::CSSValueList::append):
+        (WebCore::CSSValueList::prepend):
+
 2012-08-18  Pavel Feldman  <[email protected]>
 
         Web Inspector: make profiles panel a lazily loaded module.

Modified: trunk/Source/WebCore/css/CSSValueList.cpp (125967 => 125968)


--- trunk/Source/WebCore/css/CSSValueList.cpp	2012-08-18 14:21:38 UTC (rev 125967)
+++ trunk/Source/WebCore/css/CSSValueList.cpp	2012-08-18 17:43:58 UTC (rev 125968)
@@ -41,27 +41,17 @@
     m_valueListSeparator = listSeparator;
 }
 
-CSSValueList::CSSValueList(CSSParserValueList* list)
+CSSValueList::CSSValueList(CSSParserValueList* parserValues)
     : CSSValue(ValueListClass)
 {
     m_valueListSeparator = SpaceSeparator;
-    if (list) {
-        size_t size = list->size();
-        for (unsigned i = 0; i < size; ++i)
-            append(list->valueAt(i)->createCSSValue());
+    if (parserValues) {
+        m_values.reserveInitialCapacity(parserValues->size());
+        for (unsigned i = 0; i < parserValues->size(); ++i)
+            m_values.uncheckedAppend(parserValues->valueAt(i)->createCSSValue());
     }
 }
 
-void CSSValueList::append(PassRefPtr<CSSValue> val)
-{
-    m_values.append(val);
-}
-
-void CSSValueList::prepend(PassRefPtr<CSSValue> val)
-{
-    m_values.prepend(val);
-}
-
 bool CSSValueList::removeAll(CSSValue* val)
 {
     bool found = false;

Modified: trunk/Source/WebCore/css/CSSValueList.h (125967 => 125968)


--- trunk/Source/WebCore/css/CSSValueList.h	2012-08-18 14:21:38 UTC (rev 125967)
+++ trunk/Source/WebCore/css/CSSValueList.h	2012-08-18 17:43:58 UTC (rev 125968)
@@ -52,8 +52,8 @@
     CSSValue* item(size_t index) { return index < m_values.size() ? m_values[index].get() : 0; }
     CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); }
 
-    void append(PassRefPtr<CSSValue>);
-    void prepend(PassRefPtr<CSSValue>);
+    void append(PassRefPtr<CSSValue> value) { m_values.append(value); }
+    void prepend(PassRefPtr<CSSValue> value) { m_values.prepend(value); }
     bool removeAll(CSSValue*);
     bool hasValue(CSSValue*) const;
     PassRefPtr<CSSValueList> copy();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to