Changeset 51091 in webkit


Ignore:
Timestamp:
Nov 17, 2009 3:37:37 PM (14 years ago)
Author:
jhoneycutt@apple.com
Message:

DOMHTMLOptionsCollection is missing some implementation.

https://bugs.webkit.org/show_bug.cgi?id=31488

Reviewed by Dan Bernstein.

  • DOMHTMLClasses.cpp:

(DOMHTMLOptionsCollection::DOMHTMLOptionsCollection):
Initialize m_collection.
(DOMHTMLOptionsCollection::createInstance):
Create a DOMHTMLOptionsCollection. If we fail to query for
IDOMHTMLOptionsCollection, delete it, and return 0. Otherwise, return
the result.
(DOMHTMLOptionsCollection::length):
(DOMHTMLOptionsCollection::item):
Create a DOMNode for the WebCore Node. If this is 0, return E_FAIL.
(DOMHTMLOptionsCollection::namedItem):
Correct the signature of this function.

  • DOMHTMLClasses.h:

Declare DOMHTMLOptionsCollection::createInstance(). Correct the
signature of namedItem() to match IDOMHTMLOptionsCollection. Add a
member to DOMHTMLOptionsCollection to hold the WebCore object.

Location:
trunk/WebKit/win
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/win/ChangeLog

    r51090 r51091  
     12009-11-12  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        DOMHTMLOptionsCollection is missing some implementation.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=31488
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * DOMHTMLClasses.cpp:
     10        (DOMHTMLOptionsCollection::DOMHTMLOptionsCollection):
     11        Initialize m_collection.
     12        (DOMHTMLOptionsCollection::createInstance):
     13        Create a DOMHTMLOptionsCollection. If we fail to query for
     14        IDOMHTMLOptionsCollection, delete it, and return 0. Otherwise, return
     15        the result.
     16        (DOMHTMLOptionsCollection::length):
     17        (DOMHTMLOptionsCollection::item):
     18        Create a DOMNode for the WebCore Node. If this is 0, return E_FAIL.
     19        (DOMHTMLOptionsCollection::namedItem):
     20        Correct the signature of this function.
     21
     22        * DOMHTMLClasses.h:
     23        Declare DOMHTMLOptionsCollection::createInstance(). Correct the
     24        signature of namedItem() to match IDOMHTMLOptionsCollection. Add a
     25        member to DOMHTMLOptionsCollection to hold the WebCore object.
     26
    1272009-11-12  Jon Honeycutt  <jhoneycutt@apple.com>
    228
  • trunk/WebKit/win/DOMHTMLClasses.cpp

    r51090 r51091  
    4040#include <WebCore/HTMLNames.h>
    4141#include <WebCore/HTMLOptionElement.h>
     42#include <WebCore/HTMLOptionsCollection.h>
    4243#include <WebCore/HTMLSelectElement.h>
    4344#include <WebCore/HTMLTextAreaElement.h>
     
    135136// DOMHTMLOptionsCollection ---------------------------------------------------
    136137
     138DOMHTMLOptionsCollection::DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection* collection)
     139    : m_collection(collection)
     140{
     141}
     142
     143IDOMHTMLOptionsCollection* DOMHTMLOptionsCollection::createInstance(WebCore::HTMLOptionsCollection* collection)
     144{
     145    if (!collection)
     146        return 0;
     147
     148    IDOMHTMLOptionsCollection* optionsCollection = 0;
     149    DOMHTMLOptionsCollection* newCollection = new DOMHTMLOptionsCollection(collection);
     150    if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLOptionsCollection, (void**)&optionsCollection))) {
     151        delete newCollection;
     152        return 0;
     153    }
     154
     155    return optionsCollection;
     156}
     157
    137158HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::length(
    138     /* [retval][out] */ unsigned int* /*result*/)
    139 {
    140     ASSERT_NOT_REACHED();
    141     return E_NOTIMPL;
     159    /* [retval][out] */ unsigned int* result)
     160{
     161    if (!result)
     162        return E_POINTER;
     163
     164    *result = m_collection->length();
     165    return S_OK;
    142166}
    143167
     
    150174
    151175HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::item(
    152     /* [in] */ unsigned int /*index*/,
    153     /* [retval][out] */ IDOMNode** /*result*/)
    154 {
    155     ASSERT_NOT_REACHED();
    156     return E_NOTIMPL;
     176    /* [in] */ unsigned int index,
     177    /* [retval][out] */ IDOMNode** result)
     178{
     179    if (!result)
     180        return E_POINTER;
     181
     182    *result = DOMNode::createInstance(m_collection->item(index));
     183
     184    return *result ? S_OK : E_FAIL;
    157185}
    158186
    159187HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::namedItem(
    160188    /* [in] */ BSTR /*name*/,
    161     /* [retval][out] */ IDOMNode* /*result*/)
     189    /* [retval][out] */ IDOMNode** /*result*/)
    162190{
    163191    ASSERT_NOT_REACHED();
  • trunk/WebKit/win/DOMHTMLClasses.h

    r30180 r51091  
    3535namespace WebCore {
    3636    class HTMLCollection;
     37    class HTMLOptionsCollection;
    3738}
    3839
     
    100101class DOMHTMLOptionsCollection : public DOMObject, public IDOMHTMLOptionsCollection
    101102{
     103public:
     104    static IDOMHTMLOptionsCollection* createInstance(WebCore::HTMLOptionsCollection*);
     105
    102106    // IUnknown
    103107    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
     
    150154    virtual HRESULT STDMETHODCALLTYPE namedItem(
    151155        /* [in] */ BSTR name,
    152         /* [retval][out] */ IDOMNode *result);
     156        /* [retval][out] */ IDOMNode **result);
     157
     158private:
     159    DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection*);
     160
     161    RefPtr<WebCore::HTMLOptionsCollection> m_collection;
    153162};
    154163
Note: See TracChangeset for help on using the changeset viewer.