CSS 'initial' and 'inherit' value constructors should return PassRef.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Nov 2013 23:34:47 +0000 (23:34 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Nov 2013 23:34:47 +0000 (23:34 +0000)
<https://webkit.org/b/123641>

Make the helpers involved in constructing CSS{Initial,Inherited}Value
all return PassRef instead of PassRefPtr. This avoids generating
pointless null checks at the call sites.

Reviewed by Darin Adler.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158465 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSInheritedValue.h
Source/WebCore/css/CSSInitialValue.h
Source/WebCore/css/CSSValuePool.h

index 3f051af..672f0d7 100644 (file)
@@ -1,5 +1,16 @@
 2013-11-01  Andreas Kling  <akling@apple.com>
 
+        CSS 'initial' and 'inherit' value constructors should return PassRef.
+        <https://webkit.org/b/123641>
+
+        Make the helpers involved in constructing CSS{Initial,Inherited}Value
+        all return PassRef instead of PassRefPtr. This avoids generating
+        pointless null checks at the call sites.
+
+        Reviewed by Darin Adler.
+
+2013-11-01  Andreas Kling  <akling@apple.com>
+
         Kill RenderArena.
         <https://webkit.org/b/123634>
 
index c2c601e..f6d168e 100644 (file)
@@ -28,9 +28,9 @@ namespace WebCore {
 
 class CSSInheritedValue : public CSSValue {
 public:
-    static PassRefPtr<CSSInheritedValue> create()
+    static PassRef<CSSInheritedValue> create()
     {
-        return adoptRef(new CSSInheritedValue);
+        return adoptRef(*new CSSInheritedValue);
     }
 
     String customCSSText() const;
index 43e2c16..a0a6e55 100644 (file)
@@ -28,13 +28,13 @@ namespace WebCore {
 
 class CSSInitialValue : public CSSValue {
 public:
-    static PassRefPtr<CSSInitialValue> createExplicit()
+    static PassRef<CSSInitialValue> createExplicit()
     {
-        return adoptRef(new CSSInitialValue(/* implicit */ false));
+        return adoptRef(*new CSSInitialValue(/* implicit */ false));
     }
-    static PassRefPtr<CSSInitialValue> createImplicit()
+    static PassRef<CSSInitialValue> createImplicit()
     {
-        return adoptRef(new CSSInitialValue(/* implicit */ true));
+        return adoptRef(*new CSSInitialValue(/* implicit */ true));
     }
 
     String customCSSText() const;
index c629277..66c68ac 100644 (file)
@@ -44,9 +44,9 @@ class CSSValuePool {
 public:
     PassRefPtr<CSSValueList> createFontFaceValue(const AtomicString&);
     PassRefPtr<CSSPrimitiveValue> createFontFamilyValue(const String&);
-    PassRefPtr<CSSInheritedValue> createInheritedValue() { return m_inheritedValue; }
-    PassRefPtr<CSSInitialValue> createImplicitInitialValue() { return m_implicitInitialValue; }
-    PassRefPtr<CSSInitialValue> createExplicitInitialValue() { return m_explicitInitialValue; }
+    PassRef<CSSInheritedValue> createInheritedValue() { return m_inheritedValue.get(); }
+    PassRef<CSSInitialValue> createImplicitInitialValue() { return m_implicitInitialValue.get(); }
+    PassRef<CSSInitialValue> createExplicitInitialValue() { return m_explicitInitialValue.get(); }
     PassRefPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
     PassRefPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
     PassRefPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
@@ -60,9 +60,9 @@ public:
 private:
     CSSValuePool();
 
-    RefPtr<CSSInheritedValue> m_inheritedValue;
-    RefPtr<CSSInitialValue> m_implicitInitialValue;
-    RefPtr<CSSInitialValue> m_explicitInitialValue;
+    Ref<CSSInheritedValue> m_inheritedValue;
+    Ref<CSSInitialValue> m_implicitInitialValue;
+    Ref<CSSInitialValue> m_explicitInitialValue;
 
     RefPtr<CSSPrimitiveValue> m_identifierValueCache[numCSSValueKeywords];