Ref-ify various getters that return HTMLCollection.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Feb 2015 01:08:52 +0000 (01:08 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Feb 2015 01:08:52 +0000 (01:08 +0000)
<https://webkit.org/b/141336>

Reviewed by Anders Carlsson.

Make all the getters that return HTMLCollection objects (and never return nullptr)
return Ref instead of RefPtr.

Removed a couple of useless null checks that were exposed by this change.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::getDocumentLinks):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::namedItemGetter):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::nameGetter):
* dom/Document.cpp:
(WebCore::Document::ensureCachedCollection):
(WebCore::Document::images):
(WebCore::Document::applets):
(WebCore::Document::embeds):
(WebCore::Document::plugins):
(WebCore::Document::scripts):
(WebCore::Document::links):
(WebCore::Document::forms):
(WebCore::Document::anchors):
(WebCore::Document::all):
(WebCore::Document::windowNamedItems):
(WebCore::Document::documentNamedItems):
(WebCore::Document::iconURLs):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::ensureCachedHTMLCollection):
* dom/Element.h:
* html/ColorInputType.cpp:
(WebCore::ColorInputType::suggestions):
* html/HTMLDataListElement.cpp:
(WebCore::HTMLDataListElement::options):
* html/HTMLDataListElement.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::children):
* html/HTMLElement.h:
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::elements):
* html/HTMLFieldSetElement.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::elements):
* html/HTMLFormElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setupDateTimeChooserParameters):
* html/HTMLMapElement.cpp:
(WebCore::HTMLMapElement::areas):
* html/HTMLMapElement.h:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::selectedOptions):
(WebCore::HTMLSelectElement::options):
* html/HTMLSelectElement.h:
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::rows):
(WebCore::HTMLTableElement::tBodies):
* html/HTMLTableElement.h:
* html/HTMLTableRowElement.cpp:
(WebCore::HTMLTableRowElement::insertCell):
(WebCore::HTMLTableRowElement::deleteCell):
(WebCore::HTMLTableRowElement::cells):
* html/HTMLTableRowElement.h:
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::insertRow):
(WebCore::HTMLTableSectionElement::deleteRow):
(WebCore::HTMLTableSectionElement::rows):
* html/HTMLTableSectionElement.h:
* html/RangeInputType.cpp:
(WebCore::RangeInputType::updateTickMarkValues):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintSliderTicks):

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

31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/HTMLDataListElement.cpp
Source/WebCore/html/HTMLDataListElement.h
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLElement.h
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFieldSetElement.h
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFormElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLMapElement.cpp
Source/WebCore/html/HTMLMapElement.h
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLSelectElement.h
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTableRowElement.cpp
Source/WebCore/html/HTMLTableRowElement.h
Source/WebCore/html/HTMLTableSectionElement.cpp
Source/WebCore/html/HTMLTableSectionElement.h
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebKit/win/DOMHTMLClasses.cpp

index 7a31caf..b9cf9e7 100644 (file)
@@ -1,3 +1,81 @@
+2015-02-06  Andreas Kling  <akling@apple.com>
+
+        Ref-ify various getters that return HTMLCollection.
+        <https://webkit.org/b/141336>
+
+        Reviewed by Anders Carlsson.
+
+        Make all the getters that return HTMLCollection objects (and never return nullptr)
+        return Ref instead of RefPtr.
+
+        Removed a couple of useless null checks that were exposed by this change.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::getDocumentLinks):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::namedItemGetter):
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::JSHTMLDocument::nameGetter):
+        * dom/Document.cpp:
+        (WebCore::Document::ensureCachedCollection):
+        (WebCore::Document::images):
+        (WebCore::Document::applets):
+        (WebCore::Document::embeds):
+        (WebCore::Document::plugins):
+        (WebCore::Document::scripts):
+        (WebCore::Document::links):
+        (WebCore::Document::forms):
+        (WebCore::Document::anchors):
+        (WebCore::Document::all):
+        (WebCore::Document::windowNamedItems):
+        (WebCore::Document::documentNamedItems):
+        (WebCore::Document::iconURLs):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::ensureCachedHTMLCollection):
+        * dom/Element.h:
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::suggestions):
+        * html/HTMLDataListElement.cpp:
+        (WebCore::HTMLDataListElement::options):
+        * html/HTMLDataListElement.h:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::children):
+        * html/HTMLElement.h:
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::HTMLFieldSetElement::elements):
+        * html/HTMLFieldSetElement.h:
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::elements):
+        * html/HTMLFormElement.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
+        * html/HTMLMapElement.cpp:
+        (WebCore::HTMLMapElement::areas):
+        * html/HTMLMapElement.h:
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::selectedOptions):
+        (WebCore::HTMLSelectElement::options):
+        * html/HTMLSelectElement.h:
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::rows):
+        (WebCore::HTMLTableElement::tBodies):
+        * html/HTMLTableElement.h:
+        * html/HTMLTableRowElement.cpp:
+        (WebCore::HTMLTableRowElement::insertCell):
+        (WebCore::HTMLTableRowElement::deleteCell):
+        (WebCore::HTMLTableRowElement::cells):
+        * html/HTMLTableRowElement.h:
+        * html/HTMLTableSectionElement.cpp:
+        (WebCore::HTMLTableSectionElement::insertRow):
+        (WebCore::HTMLTableSectionElement::deleteRow):
+        (WebCore::HTMLTableSectionElement::rows):
+        * html/HTMLTableSectionElement.h:
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::updateTickMarkValues):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paintSliderTicks):
+
 2015-02-06  Brent Fulgham  <bfulgham@apple.com>
 
         [iOS] Implement audio track selection in fullscreen.
index 6bd64fc..4cfe151 100644 (file)
@@ -1741,7 +1741,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(H
 void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& result)
 {
     Document& document = m_renderer->document();
-    RefPtr<HTMLCollection> links = document.links();
+    Ref<HTMLCollection> links = document.links();
     for (unsigned i = 0; Node* curr = links->item(i); i++) {
         RenderObject* obj = curr->renderer();
         if (obj) {
index 02608fa..48f8184 100644 (file)
@@ -81,7 +81,7 @@ static EncodedJSValue namedItemGetter(ExecState* exec, JSObject* slotBase, Encod
         return JSValue::encode(jsUndefined());
 
     if (UNLIKELY(downcast<HTMLDocument>(*document).windowNamedItemContainsMultipleElements(*atomicPropertyName))) {
-        RefPtr<HTMLCollection> collection = document->windowNamedItems(atomicPropertyName);
+        Ref<HTMLCollection> collection = document->windowNamedItems(atomicPropertyName);
         ASSERT(collection->length() > 1);
         return JSValue::encode(toJS(exec, thisObj->globalObject(), WTF::getPtr(collection)));
     }
index 0593d79..3ad9a47 100644 (file)
@@ -94,7 +94,7 @@ EncodedJSValue JSHTMLDocument::nameGetter(ExecState* exec, JSObject* slotBase, E
         return JSValue::encode(jsUndefined());
 
     if (UNLIKELY(document.documentNamedItemContainsMultipleElements(*atomicPropertyName))) {
-        RefPtr<HTMLCollection> collection = document.documentNamedItems(atomicPropertyName);
+        Ref<HTMLCollection> collection = document.documentNamedItems(atomicPropertyName);
         ASSERT(collection->length() > 1);
         return JSValue::encode(toJS(exec, thisObj->globalObject(), WTF::getPtr(collection)));
     }
index f9af643..5d6078b 100644 (file)
@@ -4537,63 +4537,63 @@ bool Document::hasSVGRootNode() const
     return documentElement() && documentElement()->hasTagName(SVGNames::svgTag);
 }
 
-RefPtr<HTMLCollection> Document::ensureCachedCollection(CollectionType type)
+Ref<HTMLCollection> Document::ensureCachedCollection(CollectionType type)
 {
     return ensureRareData().ensureNodeLists().addCachedCollection<HTMLCollection>(*this, type);
 }
 
-RefPtr<HTMLCollection> Document::images()
+Ref<HTMLCollection> Document::images()
 {
     return ensureCachedCollection(DocImages);
 }
 
-RefPtr<HTMLCollection> Document::applets()
+Ref<HTMLCollection> Document::applets()
 {
     return ensureCachedCollection(DocApplets);
 }
 
-RefPtr<HTMLCollection> Document::embeds()
+Ref<HTMLCollection> Document::embeds()
 {
     return ensureCachedCollection(DocEmbeds);
 }
 
-RefPtr<HTMLCollection> Document::plugins()
+Ref<HTMLCollection> Document::plugins()
 {
     // This is an alias for embeds() required for the JS DOM bindings.
     return ensureCachedCollection(DocEmbeds);
 }
 
-RefPtr<HTMLCollection> Document::scripts()
+Ref<HTMLCollection> Document::scripts()
 {
     return ensureCachedCollection(DocScripts);
 }
 
-RefPtr<HTMLCollection> Document::links()
+Ref<HTMLCollection> Document::links()
 {
     return ensureCachedCollection(DocLinks);
 }
 
-RefPtr<HTMLCollection> Document::forms()
+Ref<HTMLCollection> Document::forms()
 {
     return ensureCachedCollection(DocForms);
 }
 
-RefPtr<HTMLCollection> Document::anchors()
+Ref<HTMLCollection> Document::anchors()
 {
     return ensureCachedCollection(DocAnchors);
 }
 
-RefPtr<HTMLCollection> Document::all()
+Ref<HTMLCollection> Document::all()
 {
     return ensureRareData().ensureNodeLists().addCachedCollection<HTMLAllCollection>(*this, DocAll);
 }
 
-RefPtr<HTMLCollection> Document::windowNamedItems(const AtomicString& name)
+Ref<HTMLCollection> Document::windowNamedItems(const AtomicString& name)
 {
     return ensureRareData().ensureNodeLists().addCachedCollection<WindowNameCollection>(*this, WindowNamedItems, name);
 }
 
-RefPtr<HTMLCollection> Document::documentNamedItems(const AtomicString& name)
+Ref<HTMLCollection> Document::documentNamedItems(const AtomicString& name)
 {
     return ensureRareData().ensureNodeLists().addCachedCollection<DocumentNameCollection>(*this, DocumentNamedItems, name);
 }
@@ -4704,10 +4704,10 @@ const Vector<IconURL>& Document::iconURLs(int iconTypesMask)
 {
     m_iconURLs.clear();
 
-    if (!head() || !(head()->children()))
+    if (!head())
         return m_iconURLs;
 
-    RefPtr<HTMLCollection> children = head()->children();
+    Ref<HTMLCollection> children = head()->children();
     unsigned int length = children->length();
     for (unsigned int i = 0; i < length; ++i) {
         Node* child = children->item(i);
index 8c58f2b..cd7056b 100644 (file)
@@ -506,18 +506,18 @@ public:
 
     RefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
 
-    RefPtr<HTMLCollection> images();
-    RefPtr<HTMLCollection> embeds();
-    RefPtr<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings.
-    RefPtr<HTMLCollection> applets();
-    RefPtr<HTMLCollection> links();
-    RefPtr<HTMLCollection> forms();
-    RefPtr<HTMLCollection> anchors();
-    RefPtr<HTMLCollection> scripts();
-    RefPtr<HTMLCollection> all();
-
-    RefPtr<HTMLCollection> windowNamedItems(const AtomicString& name);
-    RefPtr<HTMLCollection> documentNamedItems(const AtomicString& name);
+    Ref<HTMLCollection> images();
+    Ref<HTMLCollection> embeds();
+    Ref<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings.
+    Ref<HTMLCollection> applets();
+    Ref<HTMLCollection> links();
+    Ref<HTMLCollection> forms();
+    Ref<HTMLCollection> anchors();
+    Ref<HTMLCollection> scripts();
+    Ref<HTMLCollection> all();
+
+    Ref<HTMLCollection> windowNamedItems(const AtomicString& name);
+    Ref<HTMLCollection> documentNamedItems(const AtomicString& name);
 
     // Other methods (not part of DOM)
     bool isSynthesized() const { return m_isSynthesized; }
@@ -1351,7 +1351,7 @@ private:
 
     Node* nodeFromPoint(const LayoutPoint& clientPoint, LayoutPoint* localPoint = nullptr);
 
-    RefPtr<HTMLCollection> ensureCachedCollection(CollectionType);
+    Ref<HTMLCollection> ensureCachedCollection(CollectionType);
 
 #if ENABLE(FULLSCREEN_API)
     void dispatchFullScreenChangeOrErrorEvent(Deque<RefPtr<Node>>&, const AtomicString& eventName, bool shouldNotifyMediaElement);
index 9d815bc..3c0dbd1 100644 (file)
@@ -2901,10 +2901,10 @@ void Element::didRemoveAttribute(const QualifiedName& name, const AtomicString&
     dispatchSubtreeModifiedEvent();
 }
 
-RefPtr<HTMLCollection> Element::ensureCachedHTMLCollection(CollectionType type)
+Ref<HTMLCollection> Element::ensureCachedHTMLCollection(CollectionType type)
 {
     if (HTMLCollection* collection = cachedHTMLCollection(type))
-        return collection;
+        return *collection;
 
     if (type == TableRows) {
         return ensureRareData().ensureNodeLists().addCachedCollection<HTMLTableRowsCollection>(downcast<HTMLTableElement>(*this), type);
index cf47fc8..f9115bf 100644 (file)
@@ -570,7 +570,7 @@ protected:
     void clearTabIndexExplicitlyIfNeeded();
     void setTabIndexExplicitly(short);
 
-    RefPtr<HTMLCollection> ensureCachedHTMLCollection(CollectionType);
+    Ref<HTMLCollection> ensureCachedHTMLCollection(CollectionType);
     HTMLCollection* cachedHTMLCollection(CollectionType);
 
     // classAttributeChanged() exists to share code between
index 12ea9a1..8bbdb97 100644 (file)
@@ -229,7 +229,7 @@ Vector<Color> ColorInputType::suggestions() const
 #if ENABLE(DATALIST_ELEMENT)
     HTMLDataListElement* dataList = element().dataList();
     if (dataList) {
-        RefPtr<HTMLCollection> options = dataList->options();
+        Ref<HTMLCollection> options = dataList->options();
         for (unsigned i = 0; HTMLOptionElement* option = downcast<HTMLOptionElement>(options->item(i)); ++i) {
             if (!element().isValidValue(option->value()))
                 continue;
index 3525726..fe5e76f 100644 (file)
@@ -48,7 +48,7 @@ Ref<HTMLDataListElement> HTMLDataListElement::create(const QualifiedName& tagNam
     return adoptRef(*new HTMLDataListElement(tagName, document));
 }
 
-RefPtr<HTMLCollection> HTMLDataListElement::options()
+Ref<HTMLCollection> HTMLDataListElement::options()
 {
     return ensureCachedHTMLCollection(DataListOptions);
 }
index 61bfba1..1d77243 100644 (file)
@@ -42,7 +42,7 @@ class HTMLDataListElement final : public HTMLElement {
 public:
     static Ref<HTMLDataListElement> create(const QualifiedName&, Document&);
 
-    RefPtr<HTMLCollection> options();
+    Ref<HTMLCollection> options();
 
     void optionElementChildrenChanged();
 
index aec36f8..5854bc9 100644 (file)
@@ -806,7 +806,7 @@ void HTMLElement::setTranslate(bool enable)
     setAttribute(translateAttr, enable ? "yes" : "no");
 }
 
-RefPtr<HTMLCollection> HTMLElement::children()
+Ref<HTMLCollection> HTMLElement::children()
 {
     return ensureCachedHTMLCollection(NodeChildren);
 }
index cdeae7a..20dd3c1 100644 (file)
@@ -42,7 +42,7 @@ class HTMLElement : public StyledElement {
 public:
     static Ref<HTMLElement> create(const QualifiedName& tagName, Document&);
 
-    RefPtr<HTMLCollection> children();
+    Ref<HTMLCollection> children();
 
     WEBCORE_EXPORT virtual String title() const override final;
 
index 9441720..a133a50 100644 (file)
@@ -159,7 +159,7 @@ HTMLLegendElement* HTMLFieldSetElement::legend() const
     return const_cast<HTMLLegendElement*>(childrenOfType<HTMLLegendElement>(*this).first());
 }
 
-RefPtr<HTMLCollection> HTMLFieldSetElement::elements()
+Ref<HTMLCollection> HTMLFieldSetElement::elements()
 {
     return ensureCachedHTMLCollection(FormControls);
 }
index e92e44a..6bc6e1c 100644 (file)
@@ -37,7 +37,7 @@ public:
     static Ref<HTMLFieldSetElement> create(const QualifiedName&, Document&, HTMLFormElement*);
 
     HTMLLegendElement* legend() const;
-    RefPtr<HTMLCollection> elements();
+    Ref<HTMLCollection> elements();
 
     const Vector<FormAssociatedElement*>& associatedElements() const;
     unsigned length() const;
index 82ff11a..0ade3ef 100644 (file)
@@ -644,7 +644,7 @@ void HTMLFormElement::removeImgElement(HTMLImageElement* e)
     ASSERT_UNUSED(removed, removed);
 }
 
-RefPtr<HTMLCollection> HTMLFormElement::elements()
+Ref<HTMLCollection> HTMLFormElement::elements()
 {
     return ensureCachedHTMLCollection(FormControls);
 }
index 217505e..7125ee3 100644 (file)
@@ -50,7 +50,7 @@ public:
     static Ref<HTMLFormElement> create(const QualifiedName&, Document&);
     virtual ~HTMLFormElement();
 
-    RefPtr<HTMLCollection> elements();
+    Ref<HTMLCollection> elements();
     bool hasNamedElement(const AtomicString&);
     Vector<Ref<Element>> namedElements(const AtomicString&);
 
index 7e0e64d..c378f4a 100644 (file)
@@ -1887,7 +1887,7 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
     parameters.isAnchorElementRTL = computedStyle()->direction() == RTL;
 #if ENABLE(DATALIST_ELEMENT)
     if (HTMLDataListElement* dataList = this->dataList()) {
-        RefPtr<HTMLCollection> options = dataList->options();
+        Ref<HTMLCollection> options = dataList->options();
         for (unsigned i = 0; HTMLOptionElement* option = downcast<HTMLOptionElement>(options->item(i)); ++i) {
             if (!isValidValue(option->value()))
                 continue;
index e919355..a3c9c33 100644 (file)
@@ -110,7 +110,7 @@ void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin
     HTMLElement::parseAttribute(name, value);
 }
 
-RefPtr<HTMLCollection> HTMLMapElement::areas()
+Ref<HTMLCollection> HTMLMapElement::areas()
 {
     return ensureCachedHTMLCollection(MapAreas);
 }
index 12614a1..7d77408 100644 (file)
@@ -41,7 +41,7 @@ public:
     bool mapMouseEvent(LayoutPoint location, const LayoutSize&, HitTestResult&);
     
     HTMLImageElement* imageElement();
-    RefPtr<HTMLCollection> areas();
+    Ref<HTMLCollection> areas();
 
 private:
     HTMLMapElement(const QualifiedName&, Document&);
index d1ec967..d5960f2 100644 (file)
@@ -373,12 +373,12 @@ bool HTMLSelectElement::childShouldCreateRenderer(const Node& child) const
     return validationMessageShadowTreeContains(child);
 }
 
-RefPtr<HTMLCollection> HTMLSelectElement::selectedOptions()
+Ref<HTMLCollection> HTMLSelectElement::selectedOptions()
 {
     return ensureCachedHTMLCollection(SelectedOptions);
 }
 
-RefPtr<HTMLOptionsCollection> HTMLSelectElement::options()
+Ref<HTMLOptionsCollection> HTMLSelectElement::options()
 {
     return downcast<HTMLOptionsCollection>(ensureCachedHTMLCollection(SelectOptions).get());
 }
index 1ae212b..887a06a 100644 (file)
@@ -67,8 +67,8 @@ public:
     WEBCORE_EXPORT String value() const;
     void setValue(const String&);
 
-    RefPtr<HTMLOptionsCollection> options();
-    RefPtr<HTMLCollection> selectedOptions();
+    Ref<HTMLOptionsCollection> options();
+    Ref<HTMLCollection> selectedOptions();
 
     void optionElementChildrenChanged();
 
index dc09073..451a96a 100644 (file)
@@ -550,12 +550,12 @@ bool HTMLTableElement::isURLAttribute(const Attribute& attribute) const
     return attribute.name() == backgroundAttr || HTMLElement::isURLAttribute(attribute);
 }
 
-RefPtr<HTMLCollection> HTMLTableElement::rows()
+Ref<HTMLCollection> HTMLTableElement::rows()
 {
     return ensureCachedHTMLCollection(TableRows);
 }
 
-RefPtr<HTMLCollection> HTMLTableElement::tBodies()
+Ref<HTMLCollection> HTMLTableElement::tBodies()
 {
     return ensureCachedHTMLCollection(TableTBodies);
 }
index c87b466..cf5f4a0 100644 (file)
@@ -60,8 +60,8 @@ public:
     RefPtr<HTMLElement> insertRow(int index, ExceptionCode&);
     void deleteRow(int index, ExceptionCode&);
 
-    RefPtr<HTMLCollection> rows();
-    RefPtr<HTMLCollection> tBodies();
+    Ref<HTMLCollection> rows();
+    Ref<HTMLCollection> tBodies();
 
     const AtomicString& rules() const;
     const AtomicString& summary() const;
index 8417a1c..d4351ea 100644 (file)
@@ -120,8 +120,8 @@ int HTMLTableRowElement::sectionRowIndex() const
 
 RefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionCode& ec)
 {
-    RefPtr<HTMLCollection> children = cells();
-    int numCells = children ? children->length() : 0;
+    Ref<HTMLCollection> children = cells();
+    int numCells = children->length();
     if (index < -1 || index > numCells) {
         ec = INDEX_SIZE_ERR;
         return 0;
@@ -143,8 +143,8 @@ RefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionCode& ec
 
 void HTMLTableRowElement::deleteCell(int index, ExceptionCode& ec)
 {
-    RefPtr<HTMLCollection> children = cells();
-    int numCells = children ? children->length() : 0;
+    Ref<HTMLCollection> children = cells();
+    int numCells = children->length();
     if (index == -1)
         index = numCells-1;
     if (index >= 0 && index < numCells) {
@@ -154,7 +154,7 @@ void HTMLTableRowElement::deleteCell(int index, ExceptionCode& ec)
         ec = INDEX_SIZE_ERR;
 }
 
-RefPtr<HTMLCollection> HTMLTableRowElement::cells()
+Ref<HTMLCollection> HTMLTableRowElement::cells()
 {
     return ensureCachedHTMLCollection(TRCells);
 }
index 3170738..c997aec 100644 (file)
@@ -45,7 +45,7 @@ public:
     RefPtr<HTMLElement> insertCell(int index, ExceptionCode&);
     void deleteCell(int index, ExceptionCode&);
 
-    RefPtr<HTMLCollection> cells();
+    Ref<HTMLCollection> cells();
     void setCells(HTMLCollection *, ExceptionCode&);
 
 private:
index 710b473..f75717e 100644 (file)
@@ -59,8 +59,8 @@ const StyleProperties* HTMLTableSectionElement::additionalPresentationAttributeS
 RefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionCode& ec)
 {
     RefPtr<HTMLTableRowElement> row;
-    RefPtr<HTMLCollection> children = rows();
-    int numRows = children ? (int)children->length() : 0;
+    Ref<HTMLCollection> children = rows();
+    int numRows = children->length();
     if (index < -1 || index > numRows)
         ec = INDEX_SIZE_ERR; // per the DOM
     else {
@@ -81,8 +81,8 @@ RefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionCode&
 
 void HTMLTableSectionElement::deleteRow(int index, ExceptionCode& ec)
 {
-    RefPtr<HTMLCollection> children = rows();
-    int numRows = children ? (int)children->length() : 0;
+    Ref<HTMLCollection> children = rows();
+    int numRows = children->length();
     if (index == -1)
         index = numRows - 1;
     if (index >= 0 && index < numRows) {
@@ -145,7 +145,7 @@ void HTMLTableSectionElement::setVAlign(const AtomicString& value)
     setAttribute(valignAttr, value);
 }
 
-RefPtr<HTMLCollection> HTMLTableSectionElement::rows()
+Ref<HTMLCollection> HTMLTableSectionElement::rows()
 {
     return ensureCachedHTMLCollection(TSectionRows);
 }
index 391011a..0c14400 100644 (file)
@@ -53,7 +53,7 @@ public:
     const AtomicString& vAlign() const;
     void setVAlign(const AtomicString&);
 
-    RefPtr<HTMLCollection> rows();
+    Ref<HTMLCollection> rows();
 
 private:
     HTMLTableSectionElement(const QualifiedName& tagName, Document&);
index 8812771..b5b9e79 100644 (file)
@@ -368,7 +368,7 @@ void RangeInputType::updateTickMarkValues()
     HTMLDataListElement* dataList = element().dataList();
     if (!dataList)
         return;
-    RefPtr<HTMLCollection> options = dataList->options();
+    Ref<HTMLCollection> options = dataList->options();
     m_tickMarkValues.reserveCapacity(options->length());
     for (unsigned i = 0; i < options->length(); ++i) {
         Node* node = options->item(i);
index 7e1720f..e8f6f53 100644 (file)
@@ -1030,7 +1030,7 @@ void RenderTheme::paintSliderTicks(const RenderObject& o, const PaintInfo& paint
         tickRegionSideMargin = trackBounds.y() + (thumbSize.width() - tickSize.width() * zoomFactor) / 2.0;
         tickRegionWidth = trackBounds.height() - thumbSize.width();
     }
-    RefPtr<HTMLCollection> options = dataList->options();
+    Ref<HTMLCollection> options = dataList->options();
     GraphicsContextStateSaver stateSaver(*paintInfo.context);
     paintInfo.context->setFillColor(o.style().visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB);
     for (unsigned i = 0; Node* node = options->item(i); i++) {
index d9af9a0..e084094 100644 (file)
@@ -703,9 +703,6 @@ HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options(
     ASSERT(m_element);
     HTMLSelectElement& selectElement = downcast<HTMLSelectElement>(*m_element);
 
-    if (!selectElement.options())
-        return E_FAIL;
-
     *result = nullptr;
     RefPtr<HTMLOptionsCollection> options = selectElement.options();
     *result = DOMHTMLOptionsCollection::createInstance(options.get());