Changeset 104383 in webkit


Ignore:
Timestamp:
Jan 7, 2012 1:35:21 AM (12 years ago)
Author:
kling@webkit.org
Message:

Simplify HTMLCollection ownership model.
<http://webkit.org/b/75437>

Reviewed by Sam Weinig.

Source/WebCore:

Remove HTMLCollection's inheritance from RefCounted and use OwnPtr to store it.
Added ref()/deref() methods that forward to the collection's base node, these
are only ever used by DOM wrappers.

This is a behavior change, HTMLCollection wrappers now keep the base node alive.

Test: fast/dom/htmlcollection-protects-base.html

  • html/HTMLCollection.h:

(WebCore::HTMLCollection::ref):
(WebCore::HTMLCollection::deref):

Removed inheritance from RefCounted. Added ref/deref that forward the refs
to the collection's base Node.

  • dom/Element.cpp:

(WebCore::Element::~Element):

  • dom/Document.h:
  • dom/Document.cpp:

(WebCore::Document::~Document):

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::~HTMLFormElement):

  • html/HTMLSelectElement.h:
  • html/HTMLSelectElement.cpp:

Remove HTMLCollection::detachFromNode() and call sites.

  • html/HTMLAllCollection.cpp:

(WebCore::HTMLAllCollection::namedItemWithIndex):

  • html/HTMLCollection.cpp:

(WebCore::HTMLCollection::HTMLCollection):
(WebCore::HTMLCollection::invalidateCacheIfNeeded):
(WebCore::HTMLCollection::itemAfter):
(WebCore::HTMLCollection::calcLength):
(WebCore::HTMLCollection::length):
(WebCore::HTMLCollection::item):
(WebCore::HTMLCollection::nextItem):
(WebCore::HTMLCollection::namedItem):
(WebCore::HTMLCollection::updateNameCache):
(WebCore::HTMLCollection::hasNamedItem):
(WebCore::HTMLCollection::namedItems):
(WebCore::HTMLCollection::tags):

  • html/HTMLFormCollection.cpp:

(WebCore::HTMLFormCollection::calcLength):
(WebCore::HTMLFormCollection::item):
(WebCore::HTMLFormCollection::getNamedItem):
(WebCore::HTMLFormCollection::namedItem):
(WebCore::HTMLFormCollection::updateNameCache):

  • html/HTMLNameCollection.cpp:

(WebCore::HTMLNameCollection::itemAfter):

  • html/HTMLOptionsCollection.cpp:

(WebCore::HTMLOptionsCollection::add):
(WebCore::HTMLOptionsCollection::remove):
(WebCore::HTMLOptionsCollection::selectedIndex):
(WebCore::HTMLOptionsCollection::setSelectedIndex):
(WebCore::HTMLOptionsCollection::setLength):

  • html/HTMLPropertiesCollection.cpp:

(WebCore::HTMLPropertiesCollection::length):
(WebCore::HTMLPropertiesCollection::item):
(WebCore::HTMLPropertiesCollection::names):

Removed base node null-checks and assertions. Added one assertion to
the HTMLCollection constructor (that m_base is non-null.)

  • dom/Document.h:
  • dom/Document.cpp:

(WebCore::Document::openSearchDescriptionURL):
(WebCore::Document::cachedCollection):
(WebCore::Document::images):
(WebCore::Document::applets):
(WebCore::Document::embeds):
(WebCore::Document::plugins):
(WebCore::Document::objects):
(WebCore::Document::scripts):
(WebCore::Document::links):
(WebCore::Document::forms):
(WebCore::Document::anchors):
(WebCore::Document::all):
(WebCore::Document::windowNamedItems):
(WebCore::Document::documentNamedItems):

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::namedItemGetter):

  • bindings/js/JSHTMLDocumentCustom.cpp:

(WebCore::JSHTMLDocument::nameGetter):
(WebCore::JSHTMLDocument::all):

  • bindings/v8/custom/V8DOMWindowCustom.cpp:

(WebCore::V8DOMWindow::namedPropertyGetter):

  • bindings/v8/custom/V8HTMLDocumentCustom.cpp:

(WebCore::V8HTMLDocument::GetNamedProperty):

  • dom/ElementRareData.h:

(WebCore::ElementRareData::ensureCachedHTMLCollection):

  • dom/NodeRareData.h:

(WebCore::NodeRareData::properties):

  • html/HTMLAllCollection.h:
  • html/HTMLAllCollection.cpp:

(WebCore::HTMLAllCollection::create):

  • html/HTMLCollection.h:
  • html/HTMLCollection.cpp:

(WebCore::HTMLCollection::create):
(WebCore::HTMLCollection::HTMLCollection):

  • html/HTMLDataListElement.cpp:

(WebCore::HTMLDataListElement::options):

  • html/HTMLDataListElement.h:
  • html/HTMLElement.cpp:

(WebCore::HTMLElement::children):

  • html/HTMLElement.h:
  • html/HTMLSelectElement.h:

(WebCore::HTMLSelectElement::options):

  • html/HTMLFormCollection.h:
  • html/HTMLFormElement.h:
  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::elements):

  • html/HTMLNameCollection.h:

(WebCore::HTMLNameCollection::create):

  • html/HTMLFormCollection.cpp:

(WebCore::HTMLFormCollection::create):

  • html/HTMLMapElement.cpp:

(WebCore::HTMLMapElement::imageElement):
(WebCore::HTMLMapElement::areas):

  • html/HTMLMapElement.h:
  • html/HTMLPropertiesCollection.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/HTMLTableRowsCollection.cpp:

(WebCore::HTMLTableRowsCollection::create):
(WebCore::HTMLTableRowsCollection::itemAfter):

  • html/HTMLTableRowsCollection.h:
  • html/HTMLTableSectionElement.h:
  • html/HTMLTableSectionElement.cpp:

(WebCore::HTMLTableSectionElement::insertRow):
(WebCore::HTMLTableSectionElement::deleteRow):
(WebCore::HTMLTableSectionElement::rows):

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::selectedOption):

  • html/HTMLOptionsCollection.h:
  • html/HTMLOptionsCollection.cpp:

(WebCore::HTMLOptionsCollection::create):

  • html/HTMLPropertiesCollection.cpp:

(WebCore::HTMLPropertiesCollection::create):

  • Source/WebCore/accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::getDocumentLinks):

Store cached HTMLCollections in OwnPtrs. Methods that used to return
PassRefPtr<HTMLCollection> now simply return HTMLCollection*.
Updated call sites as appropriate.

LayoutTests:

  • Removed fast/dom/htmlcollection-zombies.html since it was testing bogus behavior.
  • Added a test to verify that HTMLCollection protects its base node from GC.
  • fast/dom/htmlcollection-protects-base-expected.txt: Added.
  • fast/dom/htmlcollection-protects-base.html: Added.
  • fast/dom/htmlcollection-zombies-expected.txt: Removed.
  • fast/dom/htmlcollection-zombies.html: Removed.
Location:
trunk
Files:
2 added
2 deleted
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r104381 r104383  
     12012-01-07  Andreas Kling  <awesomekling@apple.com>
     2
     3        Simplify HTMLCollection ownership model.
     4        <http://webkit.org/b/75437>
     5
     6        Reviewed by Sam Weinig.
     7
     8        - Removed fast/dom/htmlcollection-zombies.html since it was testing bogus behavior.
     9        - Added a test to verify that HTMLCollection protects its base node from GC.
     10
     11        * fast/dom/htmlcollection-protects-base-expected.txt: Added.
     12        * fast/dom/htmlcollection-protects-base.html: Added.
     13        * fast/dom/htmlcollection-zombies-expected.txt: Removed.
     14        * fast/dom/htmlcollection-zombies.html: Removed.
     15
    1162012-01-06  Ryosuke Niwa  <rniwa@webkit.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r104382 r104383  
     12012-01-07  Andreas Kling  <awesomekling@apple.com>
     2
     3        Simplify HTMLCollection ownership model.
     4        <http://webkit.org/b/75437>
     5
     6        Reviewed by Sam Weinig.
     7
     8        Remove HTMLCollection's inheritance from RefCounted and use OwnPtr to store it.
     9        Added ref()/deref() methods that forward to the collection's base node, these
     10        are only ever used by DOM wrappers.
     11
     12        This is a behavior change, HTMLCollection wrappers now keep the base node alive.
     13
     14        Test: fast/dom/htmlcollection-protects-base.html
     15
     16        * html/HTMLCollection.h:
     17        (WebCore::HTMLCollection::ref):
     18        (WebCore::HTMLCollection::deref):
     19
     20            Removed inheritance from RefCounted. Added ref/deref that forward the refs
     21            to the collection's base Node.
     22
     23        * dom/Element.cpp:
     24        (WebCore::Element::~Element):
     25        * dom/Document.h:
     26        * dom/Document.cpp:
     27        (WebCore::Document::~Document):
     28        * html/HTMLFormElement.cpp:
     29        (WebCore::HTMLFormElement::~HTMLFormElement):
     30        * html/HTMLSelectElement.h:
     31        * html/HTMLSelectElement.cpp:
     32
     33            Remove HTMLCollection::detachFromNode() and call sites.
     34
     35        * html/HTMLAllCollection.cpp:
     36        (WebCore::HTMLAllCollection::namedItemWithIndex):
     37        * html/HTMLCollection.cpp:
     38        (WebCore::HTMLCollection::HTMLCollection):
     39        (WebCore::HTMLCollection::invalidateCacheIfNeeded):
     40        (WebCore::HTMLCollection::itemAfter):
     41        (WebCore::HTMLCollection::calcLength):
     42        (WebCore::HTMLCollection::length):
     43        (WebCore::HTMLCollection::item):
     44        (WebCore::HTMLCollection::nextItem):
     45        (WebCore::HTMLCollection::namedItem):
     46        (WebCore::HTMLCollection::updateNameCache):
     47        (WebCore::HTMLCollection::hasNamedItem):
     48        (WebCore::HTMLCollection::namedItems):
     49        (WebCore::HTMLCollection::tags):
     50        * html/HTMLFormCollection.cpp:
     51        (WebCore::HTMLFormCollection::calcLength):
     52        (WebCore::HTMLFormCollection::item):
     53        (WebCore::HTMLFormCollection::getNamedItem):
     54        (WebCore::HTMLFormCollection::namedItem):
     55        (WebCore::HTMLFormCollection::updateNameCache):
     56        * html/HTMLNameCollection.cpp:
     57        (WebCore::HTMLNameCollection::itemAfter):
     58        * html/HTMLOptionsCollection.cpp:
     59        (WebCore::HTMLOptionsCollection::add):
     60        (WebCore::HTMLOptionsCollection::remove):
     61        (WebCore::HTMLOptionsCollection::selectedIndex):
     62        (WebCore::HTMLOptionsCollection::setSelectedIndex):
     63        (WebCore::HTMLOptionsCollection::setLength):
     64        * html/HTMLPropertiesCollection.cpp:
     65        (WebCore::HTMLPropertiesCollection::length):
     66        (WebCore::HTMLPropertiesCollection::item):
     67        (WebCore::HTMLPropertiesCollection::names):
     68
     69            Removed base node null-checks and assertions. Added one assertion to
     70            the HTMLCollection constructor (that m_base is non-null.)
     71
     72        * dom/Document.h:
     73        * dom/Document.cpp:
     74        (WebCore::Document::openSearchDescriptionURL):
     75        (WebCore::Document::cachedCollection):
     76        (WebCore::Document::images):
     77        (WebCore::Document::applets):
     78        (WebCore::Document::embeds):
     79        (WebCore::Document::plugins):
     80        (WebCore::Document::objects):
     81        (WebCore::Document::scripts):
     82        (WebCore::Document::links):
     83        (WebCore::Document::forms):
     84        (WebCore::Document::anchors):
     85        (WebCore::Document::all):
     86        (WebCore::Document::windowNamedItems):
     87        (WebCore::Document::documentNamedItems):
     88        * bindings/js/JSDOMWindowCustom.cpp:
     89        (WebCore::namedItemGetter):
     90        * bindings/js/JSHTMLDocumentCustom.cpp:
     91        (WebCore::JSHTMLDocument::nameGetter):
     92        (WebCore::JSHTMLDocument::all):
     93        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     94        (WebCore::V8DOMWindow::namedPropertyGetter):
     95        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
     96        (WebCore::V8HTMLDocument::GetNamedProperty):
     97        * dom/ElementRareData.h:
     98        (WebCore::ElementRareData::ensureCachedHTMLCollection):
     99        * dom/NodeRareData.h:
     100        (WebCore::NodeRareData::properties):
     101        * html/HTMLAllCollection.h:
     102        * html/HTMLAllCollection.cpp:
     103        (WebCore::HTMLAllCollection::create):
     104        * html/HTMLCollection.h:
     105        * html/HTMLCollection.cpp:
     106        (WebCore::HTMLCollection::create):
     107        (WebCore::HTMLCollection::HTMLCollection):
     108        * html/HTMLDataListElement.cpp:
     109        (WebCore::HTMLDataListElement::options):
     110        * html/HTMLDataListElement.h:
     111        * html/HTMLElement.cpp:
     112        (WebCore::HTMLElement::children):
     113        * html/HTMLElement.h:
     114        * html/HTMLSelectElement.h:
     115        (WebCore::HTMLSelectElement::options):
     116        * html/HTMLFormCollection.h:
     117        * html/HTMLFormElement.h:
     118        * html/HTMLFormElement.cpp:
     119        (WebCore::HTMLFormElement::elements):
     120        * html/HTMLNameCollection.h:
     121        (WebCore::HTMLNameCollection::create):
     122        * html/HTMLFormCollection.cpp:
     123        (WebCore::HTMLFormCollection::create):
     124        * html/HTMLMapElement.cpp:
     125        (WebCore::HTMLMapElement::imageElement):
     126        (WebCore::HTMLMapElement::areas):
     127        * html/HTMLMapElement.h:
     128        * html/HTMLPropertiesCollection.h:
     129        * html/HTMLTableElement.cpp:
     130        (WebCore::HTMLTableElement::rows):
     131        (WebCore::HTMLTableElement::tBodies):
     132        * html/HTMLTableElement.h:
     133        * html/HTMLTableRowElement.cpp:
     134        (WebCore::HTMLTableRowElement::insertCell):
     135        (WebCore::HTMLTableRowElement::deleteCell):
     136        (WebCore::HTMLTableRowElement::cells):
     137        * html/HTMLTableRowElement.h:
     138        * html/HTMLTableRowsCollection.cpp:
     139        (WebCore::HTMLTableRowsCollection::create):
     140        (WebCore::HTMLTableRowsCollection::itemAfter):
     141        * html/HTMLTableRowsCollection.h:
     142        * html/HTMLTableSectionElement.h:
     143        * html/HTMLTableSectionElement.cpp:
     144        (WebCore::HTMLTableSectionElement::insertRow):
     145        (WebCore::HTMLTableSectionElement::deleteRow):
     146        (WebCore::HTMLTableSectionElement::rows):
     147        * html/HTMLInputElement.cpp:
     148        (WebCore::HTMLInputElement::selectedOption):
     149        * html/HTMLOptionsCollection.h:
     150        * html/HTMLOptionsCollection.cpp:
     151        (WebCore::HTMLOptionsCollection::create):
     152        * html/HTMLPropertiesCollection.cpp:
     153        (WebCore::HTMLPropertiesCollection::create):
     154        * Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
     155        (WebCore::AccessibilityRenderObject::getDocumentLinks):
     156
     157            Store cached HTMLCollections in OwnPtrs. Methods that used to return
     158            PassRefPtr<HTMLCollection> now simply return HTMLCollection*.
     159            Updated call sites as appropriate.
     160
    11612012-01-07  Adam Barth  <abarth@webkit.org>
    2162
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r104276 r104383  
    24012401{
    24022402    Document* document = m_renderer->document();
    2403     RefPtr<HTMLCollection> coll = document->links();
     2403    HTMLCollection* coll = document->links();
    24042404    Node* curr = coll->firstItem();
    24052405    while (curr) {
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r104376 r104383  
    116116    ASSERT(document->isHTMLDocument());
    117117
    118     RefPtr<HTMLCollection> collection = document->windowNamedItems(identifierToAtomicString(propertyName));
     118    HTMLCollection* collection = document->windowNamedItems(identifierToAtomicString(propertyName));
    119119    if (collection->length() == 1)
    120120        return toJS(exec, thisObj, collection->firstItem());
    121     return toJS(exec, thisObj, collection.get());
     121    return toJS(exec, thisObj, collection);
    122122}
    123123
  • trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp

    r104376 r104383  
    6262    HTMLDocument* document = static_cast<HTMLDocument*>(thisObj->impl());
    6363
    64     RefPtr<HTMLCollection> collection = document->documentNamedItems(identifierToAtomicString(propertyName));
     64    HTMLCollection* collection = document->documentNamedItems(identifierToAtomicString(propertyName));
    6565
    6666    unsigned length = collection->length();
     
    7878    }
    7979
    80     return toJS(exec, thisObj->globalObject(), collection.get());
     80    return toJS(exec, thisObj->globalObject(), collection);
    8181}
    8282
     
    9090        return v;
    9191
    92     return toJS(exec, globalObject(), static_cast<HTMLDocument*>(impl())->all().get());
     92    return toJS(exec, globalObject(), static_cast<HTMLDocument*>(impl())->all());
    9393}
    9494
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r104376 r104383  
    513513    if (doc && doc->isHTMLDocument()) {
    514514        if (static_cast<HTMLDocument*>(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) {
    515             RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
     515            HTMLCollection* items = doc->windowNamedItems(propName);
    516516            if (items->length() >= 1) {
    517517                if (items->length() == 1)
    518518                    return toV8(items->firstItem());
    519                 return toV8(items.release());
     519                return toV8(items);
    520520            }
    521521        }
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

    r104376 r104383  
    8080        return v8::Handle<v8::Value>();
    8181
    82     RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key);
     82    HTMLCollection* items = htmlDocument->documentNamedItems(key);
    8383    if (!items->length())
    8484        return v8::Handle<v8::Value>();
     
    9393    }
    9494
    95     return toV8(items.release());
     95    return toV8(items);
    9696}
    9797
  • trunk/Source/WebCore/dom/Document.cpp

    r104376 r104383  
    568568    if (m_mediaQueryMatcher)
    569569        m_mediaQueryMatcher->documentDestroyed();
    570 
    571     for (unsigned i = 0; i < NumUnnamedDocumentCachedTypes; ++i) {
    572         if (m_collections[i])
    573             m_collections[i]->detachFromNode();
    574     }
    575 
    576     if (m_allCollection)
    577         m_allCollection->detachFromNode();
    578570}
    579571
     
    41774169        return KURL();
    41784170
    4179     RefPtr<HTMLCollection> children = head()->children();
     4171    HTMLCollection* children = head()->children();
    41804172    for (Node* child = children->firstItem(); child; child = children->nextItem()) {
    41814173        if (!child->hasTagName(linkTag))
     
    43024294#endif
    43034295
    4304 const RefPtr<HTMLCollection>& Document::cachedCollection(CollectionType type)
     4296HTMLCollection* Document::cachedCollection(CollectionType type)
    43054297{
    43064298    ASSERT(static_cast<unsigned>(type) < NumUnnamedDocumentCachedTypes);
    43074299    if (!m_collections[type])
    43084300        m_collections[type] = HTMLCollection::create(this, type);
    4309     return m_collections[type];
    4310 }
    4311 
    4312 PassRefPtr<HTMLCollection> Document::images()
     4301    return m_collections[type].get();
     4302}
     4303
     4304HTMLCollection* Document::images()
    43134305{
    43144306    return cachedCollection(DocImages);
    43154307}
    43164308
    4317 PassRefPtr<HTMLCollection> Document::applets()
     4309HTMLCollection* Document::applets()
    43184310{
    43194311    return cachedCollection(DocApplets);
    43204312}
    43214313
    4322 PassRefPtr<HTMLCollection> Document::embeds()
     4314HTMLCollection* Document::embeds()
    43234315{
    43244316    return cachedCollection(DocEmbeds);
    43254317}
    43264318
    4327 PassRefPtr<HTMLCollection> Document::plugins()
     4319HTMLCollection* Document::plugins()
    43284320{
    43294321    // This is an alias for embeds() required for the JS DOM bindings.
     
    43314323}
    43324324
    4333 PassRefPtr<HTMLCollection> Document::objects()
     4325HTMLCollection* Document::objects()
    43344326{
    43354327    return cachedCollection(DocObjects);
    43364328}
    43374329
    4338 PassRefPtr<HTMLCollection> Document::scripts()
     4330HTMLCollection* Document::scripts()
    43394331{
    43404332    return cachedCollection(DocScripts);
    43414333}
    43424334
    4343 PassRefPtr<HTMLCollection> Document::links()
     4335HTMLCollection* Document::links()
    43444336{
    43454337    return cachedCollection(DocLinks);
    43464338}
    43474339
    4348 PassRefPtr<HTMLCollection> Document::forms()
     4340HTMLCollection* Document::forms()
    43494341{
    43504342    return cachedCollection(DocForms);
    43514343}
    43524344
    4353 PassRefPtr<HTMLCollection> Document::anchors()
     4345HTMLCollection* Document::anchors()
    43544346{
    43554347    return cachedCollection(DocAnchors);
    43564348}
    43574349
    4358 PassRefPtr<HTMLAllCollection> Document::all()
     4350HTMLAllCollection* Document::all()
    43594351{
    43604352    if (!m_allCollection)
    43614353        m_allCollection = HTMLAllCollection::create(this);
    4362     return m_allCollection;
    4363 }
    4364 
    4365 PassRefPtr<HTMLCollection> Document::windowNamedItems(const AtomicString& name)
    4366 {
    4367     RefPtr<HTMLNameCollection>& collection = m_windowNamedItemCollections.add(name.impl(), 0).first->second;
     4354    return m_allCollection.get();
     4355}
     4356
     4357HTMLCollection* Document::windowNamedItems(const AtomicString& name)
     4358{
     4359    OwnPtr<HTMLNameCollection>& collection = m_windowNamedItemCollections.add(name.impl(), nullptr).first->second;
    43684360    if (!collection)
    43694361        collection = HTMLNameCollection::create(this, WindowNamedItems, name);
    4370     return collection;
    4371 }
    4372 
    4373 PassRefPtr<HTMLCollection> Document::documentNamedItems(const AtomicString& name)
    4374 {
    4375     RefPtr<HTMLNameCollection>& collection = m_documentNamedItemCollections.add(name.impl(), 0).first->second;
     4362    return collection.get();
     4363}
     4364
     4365HTMLCollection* Document::documentNamedItems(const AtomicString& name)
     4366{
     4367    OwnPtr<HTMLNameCollection>& collection = m_documentNamedItemCollections.add(name.impl(), nullptr).first->second;
    43764368    if (!collection)
    43774369        collection = HTMLNameCollection::create(this, DocumentNamedItems, name);
    4378     return collection;
     4370    return collection.get();
    43794371}
    43804372
  • trunk/Source/WebCore/dom/Document.h

    r104376 r104383  
    411411    PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
    412412
    413     PassRefPtr<HTMLCollection> images();
    414     PassRefPtr<HTMLCollection> embeds();
    415     PassRefPtr<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings.
    416     PassRefPtr<HTMLCollection> applets();
    417     PassRefPtr<HTMLCollection> links();
    418     PassRefPtr<HTMLCollection> forms();
    419     PassRefPtr<HTMLCollection> anchors();
    420     PassRefPtr<HTMLCollection> objects();
    421     PassRefPtr<HTMLCollection> scripts();
    422     PassRefPtr<HTMLCollection> windowNamedItems(const AtomicString& name);
    423     PassRefPtr<HTMLCollection> documentNamedItems(const AtomicString& name);
    424 
    425     PassRefPtr<HTMLAllCollection> all();
     413    HTMLCollection* images();
     414    HTMLCollection* embeds();
     415    HTMLCollection* plugins(); // an alias for embeds() required for the JS DOM bindings.
     416    HTMLCollection* applets();
     417    HTMLCollection* links();
     418    HTMLCollection* forms();
     419    HTMLCollection* anchors();
     420    HTMLCollection* objects();
     421    HTMLCollection* scripts();
     422    HTMLCollection* windowNamedItems(const AtomicString& name);
     423    HTMLCollection* documentNamedItems(const AtomicString& name);
     424
     425    HTMLAllCollection* all();
    426426
    427427    // Other methods (not part of DOM)
     
    11831183#endif
    11841184
    1185     const RefPtr<HTMLCollection>& cachedCollection(CollectionType);
     1185    HTMLCollection* cachedCollection(CollectionType);
    11861186
    11871187    int m_guardRefCount;
     
    13661366    CheckedRadioButtons m_checkedRadioButtons;
    13671367
    1368     RefPtr<HTMLCollection> m_collections[NumUnnamedDocumentCachedTypes];
    1369     RefPtr<HTMLAllCollection> m_allCollection;
    1370 
    1371     typedef HashMap<AtomicStringImpl*, RefPtr<HTMLNameCollection> > NamedCollectionMap;
     1368    OwnPtr<HTMLCollection> m_collections[NumUnnamedDocumentCachedTypes];
     1369    OwnPtr<HTMLAllCollection> m_allCollection;
     1370
     1371    typedef HashMap<AtomicStringImpl*, OwnPtr<HTMLNameCollection> > NamedCollectionMap;
    13721372    NamedCollectionMap m_documentNamedItemCollections;
    13731373    NamedCollectionMap m_windowNamedItemCollections;
  • trunk/Source/WebCore/dom/Element.cpp

    r104376 r104383  
    124124    if (m_attributeMap)
    125125        m_attributeMap->detachFromElement();
    126 
    127     if (hasRareData()) {
    128         ElementRareData* elementRareData = rareData();
    129         if (elementRareData->hasCachedHTMLCollections()) {
    130             for (unsigned type = 0; type < NumNodeCollectionTypes; ++type) {
    131                 if (HTMLCollection* collection = elementRareData->cachedHTMLCollection(static_cast<CollectionType>(FirstNodeCollectionType + type)))
    132                     collection->detachFromNode();
    133             }
    134         }
    135     }
    136126}
    137127
  • trunk/Source/WebCore/dom/ElementRareData.h

    r104376 r104383  
    4444    using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach;
    4545
    46     typedef FixedArray<RefPtr<HTMLCollection>, NumNodeCollectionTypes> CachedHTMLCollectionArray;
     46    typedef FixedArray<OwnPtr<HTMLCollection>, NumNodeCollectionTypes> CachedHTMLCollectionArray;
    4747
    4848    bool hasCachedHTMLCollections() const
    4949    {
    5050        return m_cachedCollections;
    51     }
    52 
    53     HTMLCollection* cachedHTMLCollection(CollectionType type) const
    54     {
    55         ASSERT(m_cachedCollections);
    56         return (*m_cachedCollections)[type - FirstNodeCollectionType].get();
    5751    }
    5852
     
    6256            m_cachedCollections = adoptPtr(new CachedHTMLCollectionArray);
    6357
    64         RefPtr<HTMLCollection>& collection = (*m_cachedCollections)[type - FirstNodeCollectionType];
     58        OwnPtr<HTMLCollection>& collection = (*m_cachedCollections)[type - FirstNodeCollectionType];
    6559        if (!collection)
    6660            collection = HTMLCollection::create(element, type);
  • trunk/Source/WebCore/dom/NodeRareData.h

    r104376 r104383  
    222222    {
    223223        if (!m_properties)
    224             m_properties = HTMLPropertiesCollection::create(node);
     224            m_properties = adoptPtr(HTMLPropertiesCollection::create(node));
    225225
    226226        return m_properties.get();
     
    257257    mutable RefPtr<DOMSettableTokenList> m_itemRef;
    258258    mutable RefPtr<DOMSettableTokenList> m_itemType;
    259     mutable RefPtr<HTMLPropertiesCollection> m_properties;
     259    mutable OwnPtr<HTMLPropertiesCollection> m_properties;
    260260#endif
    261261};
  • trunk/Source/WebCore/html/HTMLAllCollection.cpp

    r104376 r104383  
    3131namespace WebCore {
    3232
    33 PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document)
     33PassOwnPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document)
    3434{
    35     return adoptRef(new HTMLAllCollection(document));
     35    return adoptPtr(new HTMLAllCollection(document));
    3636}
    3737
     
    4747Node* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigned index) const
    4848{
    49     if (!base())
    50         return 0;
    51 
    5249    invalidateCacheIfNeeded();
    5350    updateNameCache();
  • trunk/Source/WebCore/html/HTMLAllCollection.h

    r104376 r104383  
    3333class HTMLAllCollection : public HTMLCollection {
    3434public:
    35     static PassRefPtr<HTMLAllCollection> create(Document*);
     35    static PassOwnPtr<HTMLAllCollection> create(Document*);
    3636    virtual ~HTMLAllCollection();
    3737
  • trunk/Source/WebCore/html/HTMLCollection.cpp

    r104376 r104383  
    4242    , m_base(base)
    4343{
     44    ASSERT(m_base);
    4445    m_cache.clear();
    4546}
     
    7778}
    7879
    79 PassRefPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type)
    80 {
    81     return adoptRef(new HTMLCollection(base, type));
     80PassOwnPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type)
     81{
     82    return adoptPtr(new HTMLCollection(base, type));
    8283}
    8384
     
    8687}
    8788
    88 void HTMLCollection::detachFromNode()
    89 {
    90     m_base = 0;
    91 }
    92 
    9389void HTMLCollection::invalidateCacheIfNeeded() const
    9490{
    95     ASSERT(m_base);
    96 
    9791    uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
    9892
     
    162156Element* HTMLCollection::itemAfter(Element* previous) const
    163157{
    164     ASSERT(m_base);
    165 
    166158    Node* current;
    167159    if (!previous)
     
    183175unsigned HTMLCollection::calcLength() const
    184176{
    185     ASSERT(m_base);
    186 
    187177    unsigned len = 0;
    188178    for (Element* current = itemAfter(0); current; current = itemAfter(current))
     
    195185unsigned HTMLCollection::length() const
    196186{
    197     if (!m_base)
    198         return 0;
    199 
    200187    invalidateCacheIfNeeded();
    201188    if (!m_cache.hasLength) {
     
    208195Node* HTMLCollection::item(unsigned index) const
    209196{
    210     if (!m_base)
    211         return 0;
    212 
    213197     invalidateCacheIfNeeded();
    214198     if (m_cache.current && m_cache.position == index)
     
    237221Node* HTMLCollection::nextItem() const
    238222{
    239      ASSERT(m_base);
    240223     invalidateCacheIfNeeded();
    241224
     
    277260Node* HTMLCollection::namedItem(const AtomicString& name) const
    278261{
    279     if (!m_base)
    280         return 0;
    281 
    282262    // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp
    283263    // This method first searches for an object with a matching id
     
    307287void HTMLCollection::updateNameCache() const
    308288{
    309     ASSERT(m_base);
    310 
    311289    if (m_cache.hasNameCache)
    312290        return;
     
    329307bool HTMLCollection::hasNamedItem(const AtomicString& name) const
    330308{
    331     if (!m_base)
    332         return false;
    333 
    334309    if (name.isEmpty())
    335310        return false;
     
    353328void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& result) const
    354329{
    355     if (!m_base)
    356         return;
    357 
    358330    ASSERT(result.isEmpty());
    359331    if (name.isEmpty())
     
    375347PassRefPtr<NodeList> HTMLCollection::tags(const String& name)
    376348{
    377     if (!m_base)
    378         return 0;
    379 
    380349    return m_base->getElementsByTagName(name);
    381350}
  • trunk/Source/WebCore/html/HTMLCollection.h

    r104376 r104383  
    2424#define HTMLCollection_h
    2525
     26#include "Node.h"
    2627#include "CollectionType.h"
    27 #include <wtf/RefCounted.h>
    2828#include <wtf/Forward.h>
    2929#include <wtf/HashMap.h>
     30#include <wtf/PassOwnPtr.h>
    3031#include <wtf/Vector.h>
    3132
     
    3435class Document;
    3536class Element;
    36 class Node;
    3737class NodeList;
    3838
    39 class HTMLCollection : public RefCounted<HTMLCollection> {
     39class HTMLCollection {
    4040public:
    41     static PassRefPtr<HTMLCollection> create(Node* base, CollectionType);
     41    static PassOwnPtr<HTMLCollection> create(Node* base, CollectionType);
    4242    virtual ~HTMLCollection();
     43
     44    void ref() { m_base->ref(); }
     45    void deref() { m_base->deref(); }
    4346
    4447    unsigned length() const;
     
    5861    Node* base() const { return m_base; }
    5962    CollectionType type() const { return static_cast<CollectionType>(m_type); }
    60 
    61     void detachFromNode();
    6263
    6364protected:
  • trunk/Source/WebCore/html/HTMLDataListElement.cpp

    r104376 r104383  
    4848}
    4949
    50 PassRefPtr<HTMLCollection> HTMLDataListElement::options()
     50HTMLCollection* HTMLDataListElement::options()
    5151{
    5252    return ensureCachedHTMLCollection(DataListOptions);
  • trunk/Source/WebCore/html/HTMLDataListElement.h

    r104376 r104383  
    4444    static PassRefPtr<HTMLDataListElement> create(const QualifiedName&, Document*);
    4545
    46     PassRefPtr<HTMLCollection> options();
     46    HTMLCollection* options();
    4747
    4848private:
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r104376 r104383  
    825825}
    826826
    827 PassRefPtr<HTMLCollection> HTMLElement::children()
     827HTMLCollection* HTMLElement::children()
    828828{
    829829    return ensureCachedHTMLCollection(NodeChildren);
  • trunk/Source/WebCore/html/HTMLElement.h

    r104376 r104383  
    4040    static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document*);
    4141
    42     PassRefPtr<HTMLCollection> children();
    43    
     42    HTMLCollection* children();
     43
    4444    virtual String title() const;
    4545
  • trunk/Source/WebCore/html/HTMLFormCollection.cpp

    r104376 r104383  
    4141}
    4242
    43 PassRefPtr<HTMLFormCollection> HTMLFormCollection::create(HTMLFormElement* form)
     43PassOwnPtr<HTMLFormCollection> HTMLFormCollection::create(HTMLFormElement* form)
    4444{
    45     return adoptRef(new HTMLFormCollection(form));
     45    return adoptPtr(new HTMLFormCollection(form));
    4646}
    4747
     
    5252unsigned HTMLFormCollection::calcLength() const
    5353{
    54     ASSERT(base());
    5554    return static_cast<HTMLFormElement*>(base())->length();
    5655}
     
    5857Node* HTMLFormCollection::item(unsigned index) const
    5958{
    60     if (!base())
    61         return 0;
    62 
    6359    invalidateCacheIfNeeded();
    6460
     
    9793Element* HTMLFormCollection::getNamedItem(const QualifiedName& attrName, const AtomicString& name) const
    9894{
    99     if (!base())
    100         return 0;
    101 
    10295    m_cache.position = 0;
    10396    return getNamedFormItem(attrName, name, 0);
     
    144137Node* HTMLFormCollection::namedItem(const AtomicString& name) const
    145138{
    146     if (!base())
    147         return 0;
    148 
    149139    // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp
    150140    // This method first searches for an object with a matching id
     
    162152void HTMLFormCollection::updateNameCache() const
    163153{
    164     if (!base())
    165         return;
    166 
    167154    if (m_cache.hasNameCache)
    168155        return;
  • trunk/Source/WebCore/html/HTMLFormCollection.h

    r104376 r104383  
    3636class HTMLFormCollection : public HTMLCollection {
    3737public:
    38     static PassRefPtr<HTMLFormCollection> create(HTMLFormElement*);
     38    static PassOwnPtr<HTMLFormCollection> create(HTMLFormElement*);
    3939
    4040    virtual ~HTMLFormCollection();
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r104376 r104383  
    9292HTMLFormElement::~HTMLFormElement()
    9393{
    94     if (m_elementsCollection)
    95         m_elementsCollection->detachFromNode();
    96 
    9794    if (!shouldAutocomplete())
    9895        document()->unregisterForPageCacheSuspensionCallbacks(this);
     
    502499}
    503500
    504 PassRefPtr<HTMLCollection> HTMLFormElement::elements()
     501HTMLCollection* HTMLFormElement::elements()
    505502{
    506503    if (!m_elementsCollection)
    507504        m_elementsCollection = HTMLFormCollection::create(this);
    508     return m_elementsCollection;
     505    return m_elementsCollection.get();
    509506}
    510507
  • trunk/Source/WebCore/html/HTMLFormElement.h

    r104376 r104383  
    4848    virtual ~HTMLFormElement();
    4949
    50     PassRefPtr<HTMLCollection> elements();
     50    HTMLCollection* elements();
    5151    void getNamedElements(const AtomicString&, Vector<RefPtr<Node> >&);
    5252
     
    150150    FormSubmission::Attributes m_attributes;
    151151    OwnPtr<AliasMap> m_elementAliases;
    152     RefPtr<HTMLFormCollection> m_elementsCollection;
     152    OwnPtr<HTMLFormCollection> m_elementsCollection;
    153153
    154154    CheckedRadioButtons m_checkedRadioButtons;
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r104376 r104383  
    15771577    if (!sourceElement)
    15781578        return 0;
    1579     RefPtr<HTMLCollection> options = sourceElement->options();
     1579    HTMLCollection* options = sourceElement->options();
    15801580    if (!options)
    15811581        return 0;
  • trunk/Source/WebCore/html/HTMLMapElement.cpp

    r104376 r104383  
    8383HTMLImageElement* HTMLMapElement::imageElement()
    8484{
    85     RefPtr<HTMLCollection> coll = document()->images();
     85    HTMLCollection* coll = document()->images();
    8686    for (Node* curr = coll->firstItem(); curr; curr = coll->nextItem()) {
    8787        if (!curr->hasTagName(imgTag))
     
    127127}
    128128
    129 PassRefPtr<HTMLCollection> HTMLMapElement::areas()
     129HTMLCollection* HTMLMapElement::areas()
    130130{
    131131    return ensureCachedHTMLCollection(MapAreas);
  • trunk/Source/WebCore/html/HTMLMapElement.h

    r104376 r104383  
    4242   
    4343    HTMLImageElement* imageElement();
    44     PassRefPtr<HTMLCollection> areas();
     44    HTMLCollection* areas();
    4545
    4646private:
  • trunk/Source/WebCore/html/HTMLNameCollection.cpp

    r104376 r104383  
    4141Element* HTMLNameCollection::itemAfter(Element* previous) const
    4242{
    43     if (!base())
    44         return 0;
    45 
    4643    ASSERT(previous != base());
    4744
  • trunk/Source/WebCore/html/HTMLNameCollection.h

    r104376 r104383  
    3434class HTMLNameCollection : public HTMLCollection {
    3535public:
    36     static PassRefPtr<HTMLNameCollection> create(Document* document, CollectionType type, const AtomicString& name)
     36    static PassOwnPtr<HTMLNameCollection> create(Document* document, CollectionType type, const AtomicString& name)
    3737    {
    38         return adoptRef(new HTMLNameCollection(document, type, name));
     38        return adoptPtr(new HTMLNameCollection(document, type, name));
    3939    }
    4040
  • trunk/Source/WebCore/html/HTMLOptionsCollection.cpp

    r104376 r104383  
    3333}
    3434
    35 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(HTMLSelectElement* select)
     35PassOwnPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(HTMLSelectElement* select)
    3636{
    37     return adoptRef(new HTMLOptionsCollection(select));
     37    return adoptPtr(new HTMLOptionsCollection(select));
    3838}
    3939
     
    6060    HTMLSelectElement* select = toHTMLSelectElement(base());
    6161
    62     if (!select)
    63         return;
    64 
    6562    if (index == -1 || unsigned(index) >= length())
    6663        select->add(newOption, 0, ec);
     
    7370void HTMLOptionsCollection::remove(int index)
    7471{
    75     if (!base())
    76         return;
    7772    toHTMLSelectElement(base())->remove(index);
    7873}
     
    8075int HTMLOptionsCollection::selectedIndex() const
    8176{
    82     if (!base())
    83         return -1;
    8477    return toHTMLSelectElement(base())->selectedIndex();
    8578}
     
    8780void HTMLOptionsCollection::setSelectedIndex(int index)
    8881{
    89     if (!base())
    90         return;
    9182    toHTMLSelectElement(base())->setSelectedIndex(index);
    9283}
     
    9485void HTMLOptionsCollection::setLength(unsigned length, ExceptionCode& ec)
    9586{
    96     if (!base())
    97         return;
    9887    toHTMLSelectElement(base())->setLength(length, ec);
    9988}
  • trunk/Source/WebCore/html/HTMLOptionsCollection.h

    r104376 r104383  
    3636class HTMLOptionsCollection : public HTMLCollection {
    3737public:
    38     static PassRefPtr<HTMLOptionsCollection> create(HTMLSelectElement*);
     38    static PassOwnPtr<HTMLOptionsCollection> create(HTMLSelectElement*);
    3939
    4040    void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&);
  • trunk/Source/WebCore/html/HTMLPropertiesCollection.cpp

    r104376 r104383  
    5050}
    5151
    52 PassRefPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(PassRefPtr<Node> itemNode)
     52PassOwnPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(PassRefPtr<Node> itemNode)
    5353{
    54     return adoptRef(new HTMLPropertiesCollection(itemNode));
     54    return adoptPtr(new HTMLPropertiesCollection(itemNode));
    5555}
    5656
     
    124124unsigned HTMLPropertiesCollection::length() const
    125125{
    126     if (!base())
    127         return 0;
    128 
    129126    if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr))
    130127        return 0;
     
    137134Node* HTMLPropertiesCollection::item(unsigned index) const
    138135{
    139     if (!base())
    140         return 0;
    141 
    142136    if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr))
    143137        return 0;
     
    157151    m_properties.clear();
    158152    m_propertyNames->clear();
    159 
    160     if (!base())
    161         return 0;
    162153
    163154    if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr))
  • trunk/Source/WebCore/html/HTMLPropertiesCollection.h

    r104376 r104383  
    4242class HTMLPropertiesCollection : public HTMLCollection {
    4343public:
    44     static PassRefPtr<HTMLPropertiesCollection> create(PassRefPtr<Node>);
     44    static PassOwnPtr<HTMLPropertiesCollection> create(PassRefPtr<Node>);
    4545    virtual ~HTMLPropertiesCollection();
    4646
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r104376 r104383  
    9393}
    9494
    95 HTMLSelectElement::~HTMLSelectElement()
    96 {
    97     if (m_optionsCollection)
    98         m_optionsCollection->detachFromNode();
    99 }
    100 
    10195PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
    10296{
     
    332326}
    333327
    334 PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options()
     328HTMLOptionsCollection* HTMLSelectElement::options()
    335329{
    336330    if (!m_optionsCollection)
    337331        m_optionsCollection = HTMLOptionsCollection::create(this);
    338     return m_optionsCollection;
     332    return m_optionsCollection.get();
    339333}
    340334
  • trunk/Source/WebCore/html/HTMLSelectElement.h

    r104376 r104383  
    2929#include "Event.h"
    3030#include "HTMLFormControlElementWithState.h"
     31#include "HTMLOptionsCollection.h"
    3132#include <wtf/Vector.h>
    3233
     
    4041    static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*, HTMLFormElement*);
    4142
    42     virtual ~HTMLSelectElement();
    43 
    4443    int selectedIndex() const;
    4544    void setSelectedIndex(int);
     
    6463    void setValue(const String&);
    6564
    66     PassRefPtr<HTMLOptionsCollection> options();
     65    HTMLOptionsCollection* options();
    6766
    6867    void optionElementChildrenChanged();
     
    176175    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
    177176
    178     RefPtr<HTMLOptionsCollection> m_optionsCollection;
     177    OwnPtr<HTMLOptionsCollection> m_optionsCollection;
    179178
    180179    // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects.
  • trunk/Source/WebCore/html/HTMLTableElement.cpp

    r104376 r104383  
    5353{
    5454    ASSERT(hasTagName(tableTag));
    55 }
    56 
    57 HTMLTableElement::~HTMLTableElement()
    58 {
    59     if (m_rowsCollection)
    60         m_rowsCollection->detachFromNode();
    6155}
    6256
     
    625619}
    626620
    627 PassRefPtr<HTMLCollection> HTMLTableElement::rows()
     621HTMLCollection* HTMLTableElement::rows()
    628622{
    629623    if (!m_rowsCollection)
    630624        m_rowsCollection = HTMLTableRowsCollection::create(this);
    631     return m_rowsCollection;
    632 }
    633 
    634 PassRefPtr<HTMLCollection> HTMLTableElement::tBodies()
     625    return m_rowsCollection.get();
     626}
     627
     628HTMLCollection* HTMLTableElement::tBodies()
    635629{
    636630    return ensureCachedHTMLCollection(TableTBodies);
  • trunk/Source/WebCore/html/HTMLTableElement.h

    r103873 r104383  
    4141    static PassRefPtr<HTMLTableElement> create(const QualifiedName&, Document*);
    4242
    43     virtual ~HTMLTableElement();
    44 
    4543    HTMLTableCaptionElement* caption() const;
    4644    void setCaption(PassRefPtr<HTMLTableCaptionElement>, ExceptionCode&);
     
    6159    void deleteRow(int index, ExceptionCode&);
    6260
    63     PassRefPtr<HTMLCollection> rows();
    64     PassRefPtr<HTMLCollection> tBodies();
     61    HTMLCollection* rows();
     62    HTMLCollection* tBodies();
    6563
    6664    String rules() const;
     
    104102    unsigned short m_padding;
    105103    RefPtr<CSSMappedAttributeDeclaration> m_paddingDecl;
    106     RefPtr<HTMLTableRowsCollection> m_rowsCollection;
     104    OwnPtr<HTMLTableRowsCollection> m_rowsCollection;
    107105};
    108106
  • trunk/Source/WebCore/html/HTMLTableRowElement.cpp

    r103883 r104383  
    121121PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionCode& ec)
    122122{
    123     RefPtr<HTMLCollection> children = cells();
     123    HTMLCollection* children = cells();
    124124    int numCells = children ? children->length() : 0;
    125125    if (index < -1 || index > numCells) {
     
    144144void HTMLTableRowElement::deleteCell(int index, ExceptionCode& ec)
    145145{
    146     RefPtr<HTMLCollection> children = cells();
     146    HTMLCollection* children = cells();
    147147    int numCells = children ? children->length() : 0;
    148148    if (index == -1)
     
    155155}
    156156
    157 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells()
     157HTMLCollection* HTMLTableRowElement::cells()
    158158{
    159159    return ensureCachedHTMLCollection(TRCells);
  • trunk/Source/WebCore/html/HTMLTableRowElement.h

    r66057 r104383  
    4545    void deleteCell(int index, ExceptionCode&);
    4646
    47     PassRefPtr<HTMLCollection> cells();
     47    HTMLCollection* cells();
    4848    void setCells(HTMLCollection *, ExceptionCode&);
    4949
  • trunk/Source/WebCore/html/HTMLTableRowsCollection.cpp

    r103883 r104383  
    157157}
    158158
    159 PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(HTMLTableElement* table)
     159PassOwnPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(HTMLTableElement* table)
    160160{
    161     return adoptRef(new HTMLTableRowsCollection(table));
     161    return adoptPtr(new HTMLTableRowsCollection(table));
    162162}
    163163
    164164Element* HTMLTableRowsCollection::itemAfter(Element* previous) const
    165165{
    166     ASSERT(base());
    167166    ASSERT(!previous || previous->hasLocalName(trTag));
    168167    return rowAfter(static_cast<HTMLTableElement*>(base()), static_cast<HTMLTableRowElement*>(previous));
  • trunk/Source/WebCore/html/HTMLTableRowsCollection.h

    r103856 r104383  
    3939class HTMLTableRowsCollection : public HTMLCollection {
    4040public:
    41     static PassRefPtr<HTMLTableRowsCollection> create(HTMLTableElement*);
     41    static PassOwnPtr<HTMLTableRowsCollection> create(HTMLTableElement*);
    4242
    4343    static HTMLTableRowElement* rowAfter(HTMLTableElement*, HTMLTableRowElement*);
  • trunk/Source/WebCore/html/HTMLTableSectionElement.cpp

    r103883 r104383  
    6464{
    6565    RefPtr<HTMLTableRowElement> row;
    66     RefPtr<HTMLCollection> children = rows();
     66    HTMLCollection* children = rows();
    6767    int numRows = children ? (int)children->length() : 0;
    6868    if (index < -1 || index > numRows)
     
    8686void HTMLTableSectionElement::deleteRow(int index, ExceptionCode& ec)
    8787{
    88     RefPtr<HTMLCollection> children = rows();
     88    HTMLCollection* children = rows();
    8989    int numRows = children ? (int)children->length() : 0;
    9090    if (index == -1)
     
    150150}
    151151
    152 PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows()
     152HTMLCollection* HTMLTableSectionElement::rows()
    153153{
    154154    return ensureCachedHTMLCollection(TSectionRows);
  • trunk/Source/WebCore/html/HTMLTableSectionElement.h

    r66057 r104383  
    5252    void setVAlign(const String&);
    5353
    54     PassRefPtr<HTMLCollection> rows();
     54    HTMLCollection* rows();
    5555
    5656private:
Note: See TracChangeset for help on using the changeset viewer.