Title: [157786] trunk/Source/WebCore
- Revision
- 157786
- Author
- akl...@apple.com
- Date
- 2013-10-22 06:04:13 -0700 (Tue, 22 Oct 2013)
Log Message
CSSValueList constructor functions should return PassRef.
<https://webkit.org/b/123151>
These functions always return objects, and thus can return PassRef.
Also made CSSValueList::createFromParserValueList() take a reference
since that function is only ever called with a non-null value.
Reviewed by Antti Koivisto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (157785 => 157786)
--- trunk/Source/WebCore/ChangeLog 2013-10-22 13:03:30 UTC (rev 157785)
+++ trunk/Source/WebCore/ChangeLog 2013-10-22 13:04:13 UTC (rev 157786)
@@ -1,5 +1,16 @@
2013-10-22 Andreas Kling <akl...@apple.com>
+ CSSValueList constructor functions should return PassRef.
+ <https://webkit.org/b/123151>
+
+ These functions always return objects, and thus can return PassRef.
+ Also made CSSValueList::createFromParserValueList() take a reference
+ since that function is only ever called with a non-null value.
+
+ Reviewed by Antti Koivisto.
+
+2013-10-22 Andreas Kling <akl...@apple.com>
+
Avoid parent style ref churn in createTextRendererIfNeeded().
<https://webkit.org/b/123148>
Modified: trunk/Source/WebCore/css/CSSFunctionValue.cpp (157785 => 157786)
--- trunk/Source/WebCore/css/CSSFunctionValue.cpp 2013-10-22 13:03:30 UTC (rev 157785)
+++ trunk/Source/WebCore/css/CSSFunctionValue.cpp 2013-10-22 13:04:13 UTC (rev 157786)
@@ -38,7 +38,7 @@
, m_name(function->name)
{
if (function->args)
- m_args = CSSValueList::createFromParserValueList(function->args.get());
+ m_args = CSSValueList::createFromParserValueList(*function->args);
}
CSSFunctionValue::CSSFunctionValue(String name, PassRefPtr<CSSValueList> args)
Modified: trunk/Source/WebCore/css/CSSValueList.cpp (157785 => 157786)
--- trunk/Source/WebCore/css/CSSValueList.cpp 2013-10-22 13:03:30 UTC (rev 157785)
+++ trunk/Source/WebCore/css/CSSValueList.cpp 2013-10-22 13:04:13 UTC (rev 157786)
@@ -39,15 +39,13 @@
m_valueListSeparator = listSeparator;
}
-CSSValueList::CSSValueList(CSSParserValueList* parserValues)
+CSSValueList::CSSValueList(CSSParserValueList& parserValues)
: CSSValue(ValueListClass)
{
m_valueListSeparator = SpaceSeparator;
- if (parserValues) {
- m_values.reserveInitialCapacity(parserValues->size());
- for (unsigned i = 0; i < parserValues->size(); ++i)
- m_values.uncheckedAppend(parserValues->valueAt(i)->createCSSValue());
- }
+ m_values.reserveInitialCapacity(parserValues.size());
+ for (unsigned i = 0, size = parserValues.size(); i < size; ++i)
+ m_values.uncheckedAppend(parserValues.valueAt(i)->createCSSValue());
}
bool CSSValueList::removeAll(CSSValue* val)
Modified: trunk/Source/WebCore/css/CSSValueList.h (157785 => 157786)
--- trunk/Source/WebCore/css/CSSValueList.h 2013-10-22 13:03:30 UTC (rev 157785)
+++ trunk/Source/WebCore/css/CSSValueList.h 2013-10-22 13:04:13 UTC (rev 157786)
@@ -31,21 +31,21 @@
class CSSValueList : public CSSValue {
public:
- static PassRefPtr<CSSValueList> createCommaSeparated()
+ static PassRef<CSSValueList> createCommaSeparated()
{
- return adoptRef(new CSSValueList(CommaSeparator));
+ return adoptRef(*new CSSValueList(CommaSeparator));
}
- static PassRefPtr<CSSValueList> createSpaceSeparated()
+ static PassRef<CSSValueList> createSpaceSeparated()
{
- return adoptRef(new CSSValueList(SpaceSeparator));
+ return adoptRef(*new CSSValueList(SpaceSeparator));
}
- static PassRefPtr<CSSValueList> createSlashSeparated()
+ static PassRef<CSSValueList> createSlashSeparated()
{
- return adoptRef(new CSSValueList(SlashSeparator));
+ return adoptRef(*new CSSValueList(SlashSeparator));
}
- static PassRefPtr<CSSValueList> createFromParserValueList(CSSParserValueList* list)
+ static PassRef<CSSValueList> createFromParserValueList(CSSParserValueList& list)
{
- return adoptRef(new CSSValueList(list));
+ return adoptRef(*new CSSValueList(list));
}
size_t length() const { return m_values.size(); }
@@ -78,7 +78,7 @@
private:
explicit CSSValueList(ValueListSeparator);
- explicit CSSValueList(CSSParserValueList*);
+ explicit CSSValueList(CSSParserValueList&);
Vector<RefPtr<CSSValue>, 4> m_values;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes