Ref-ify DOMSettableTokenList.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Dec 2014 20:22:50 +0000 (20:22 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Dec 2014 20:22:50 +0000 (20:22 +0000)
<https://webkit.org/b/139785>

Reviewed by Chris Dumez.

Make DOMSettableTokenList::create() return a Ref, and have its two client
elements store it in a Ref instead of a RefPtr (and fix their getter API
to return references.)

* html/DOMSettableTokenList.cpp:
(WebCore::DOMSettableTokenList::create): Deleted.
* html/DOMSettableTokenList.h:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::sizes): Deleted.
* html/HTMLLinkElement.h:
* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::htmlFor): Deleted.
* html/HTMLOutputElement.h:

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

Source/WebCore/ChangeLog
Source/WebCore/html/DOMSettableTokenList.cpp
Source/WebCore/html/DOMSettableTokenList.h
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h
Source/WebCore/html/HTMLOutputElement.cpp
Source/WebCore/html/HTMLOutputElement.h

index 23f543a..90d58a3 100644 (file)
@@ -1,5 +1,26 @@
 2014-12-18  Andreas Kling  <akling@apple.com>
 
+        Ref-ify DOMSettableTokenList.
+        <https://webkit.org/b/139785>
+
+        Reviewed by Chris Dumez.
+
+        Make DOMSettableTokenList::create() return a Ref, and have its two client
+        elements store it in a Ref instead of a RefPtr (and fix their getter API
+        to return references.)
+
+        * html/DOMSettableTokenList.cpp:
+        (WebCore::DOMSettableTokenList::create): Deleted.
+        * html/DOMSettableTokenList.h:
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::sizes): Deleted.
+        * html/HTMLLinkElement.h:
+        * html/HTMLOutputElement.cpp:
+        (WebCore::HTMLOutputElement::htmlFor): Deleted.
+        * html/HTMLOutputElement.h:
+
+2014-12-18  Andreas Kling  <akling@apple.com>
+
         Ref-ify ClientRectList.
         <https://webkit.org/b/139780>
 
index 741ff59..3f3b011 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<DOMSettableTokenList> DOMSettableTokenList::create()
-{
-    return adoptRef(new DOMSettableTokenList());
-}
-
 void DOMSettableTokenList::ref()
 {
     RefCounted<DOMSettableTokenList>::ref();
index 08ddf2c..577d1f8 100644 (file)
@@ -38,7 +38,10 @@ typedef int ExceptionCode;
 class DOMSettableTokenList final : public DOMTokenList, public RefCounted<DOMSettableTokenList> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<DOMSettableTokenList> create();
+    static Ref<DOMSettableTokenList> create()
+    {
+        return adoptRef(*new DOMSettableTokenList);
+    }
 
     virtual void ref() override;
     virtual void deref() override;
index d5518c9..3e1e66d 100644 (file)
@@ -514,11 +514,6 @@ void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType noti
         : DocumentStyleSheetCollection::RemovePendingSheetNotifyLater);
 }
 
-DOMSettableTokenList* HTMLLinkElement::sizes() const
-{
-    return m_sizes.get();
-}
-
 void HTMLLinkElement::setSizes(const String& value)
 {
     m_sizes->setValue(value);
index 961cc6a..7eae08b 100644 (file)
@@ -67,7 +67,7 @@ public:
     bool isDisabled() const { return m_disabledState == Disabled; }
     bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; }
     void setSizes(const String&);
-    DOMSettableTokenList* sizes() const;
+    DOMSettableTokenList& sizes() { return m_sizes.get(); }
 
     void dispatchPendingEvent(LinkEventSender*);
     static void dispatchPendingLoadEvents();
@@ -130,7 +130,7 @@ private:
 
     String m_type;
     String m_media;
-    RefPtr<DOMSettableTokenList> m_sizes;
+    Ref<DOMSettableTokenList> m_sizes;
     DisabledState m_disabledState;
     LinkRelAttribute m_relAttribute;
     bool m_loading;
index 071ef4c..a72b75f 100644 (file)
@@ -70,11 +70,6 @@ void HTMLOutputElement::parseAttribute(const QualifiedName& name, const AtomicSt
         HTMLFormControlElement::parseAttribute(name, value);
 }
 
-DOMSettableTokenList* HTMLOutputElement::htmlFor() const
-{
-    return m_tokens.get();
-}
-
 void HTMLOutputElement::setFor(const String& value)
 {
     m_tokens->setValue(value);
index 916eea0..f1acec8 100644 (file)
@@ -45,7 +45,7 @@ public:
     String defaultValue() const;
     void setDefaultValue(const String&);
     void setFor(const String&);
-    DOMSettableTokenList* htmlFor() const;
+    DOMSettableTokenList& htmlFor() { return m_tokens.get(); }
     
     virtual bool canContainRangeEndPoint() const override { return false; }
 
@@ -66,7 +66,7 @@ private:
     bool m_isDefaultValueMode;
     bool m_isSetTextContentInProgress;
     String m_defaultValue;
-    RefPtr<DOMSettableTokenList> m_tokens;
+    Ref<DOMSettableTokenList> m_tokens;
 };
 
 } // namespace