Commit d057b0ae authored by jhoneycutt@apple.com's avatar jhoneycutt@apple.com
Browse files

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 691c348e
2009-11-12 Jon Honeycutt <jhoneycutt@apple.com>
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.
2009-11-12 Jon Honeycutt <jhoneycutt@apple.com>
DOMHTMLInputElement::rectOnScreen() returns the wrong rect
......
......@@ -39,6 +39,7 @@
#include <WebCore/HTMLInputElement.h>
#include <WebCore/HTMLNames.h>
#include <WebCore/HTMLOptionElement.h>
#include <WebCore/HTMLOptionsCollection.h>
#include <WebCore/HTMLSelectElement.h>
#include <WebCore/HTMLTextAreaElement.h>
#include <WebCore/IntRect.h>
......@@ -134,11 +135,34 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::QueryInterface(REFIID riid,
// DOMHTMLOptionsCollection ---------------------------------------------------
DOMHTMLOptionsCollection::DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection* collection)
: m_collection(collection)
{
}
IDOMHTMLOptionsCollection* DOMHTMLOptionsCollection::createInstance(WebCore::HTMLOptionsCollection* collection)
{
if (!collection)
return 0;
IDOMHTMLOptionsCollection* optionsCollection = 0;
DOMHTMLOptionsCollection* newCollection = new DOMHTMLOptionsCollection(collection);
if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLOptionsCollection, (void**)&optionsCollection))) {
delete newCollection;
return 0;
}
return optionsCollection;
}
HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::length(
/* [retval][out] */ unsigned int* /*result*/)
/* [retval][out] */ unsigned int* result)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!result)
return E_POINTER;
*result = m_collection->length();
return S_OK;
}
HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength(
......@@ -149,16 +173,20 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength(
}
HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::item(
/* [in] */ unsigned int /*index*/,
/* [retval][out] */ IDOMNode** /*result*/)
/* [in] */ unsigned int index,
/* [retval][out] */ IDOMNode** result)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!result)
return E_POINTER;
*result = DOMNode::createInstance(m_collection->item(index));
return *result ? S_OK : E_FAIL;
}
HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::namedItem(
/* [in] */ BSTR /*name*/,
/* [retval][out] */ IDOMNode* /*result*/)
/* [retval][out] */ IDOMNode** /*result*/)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
......
......@@ -34,6 +34,7 @@
namespace WebCore {
class HTMLCollection;
class HTMLOptionsCollection;
}
class DOMHTMLCollection : public DOMObject, public IDOMHTMLCollection
......@@ -99,6 +100,9 @@ protected:
class DOMHTMLOptionsCollection : public DOMObject, public IDOMHTMLOptionsCollection
{
public:
static IDOMHTMLOptionsCollection* createInstance(WebCore::HTMLOptionsCollection*);
// IUnknown
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
......@@ -149,7 +153,12 @@ class DOMHTMLOptionsCollection : public DOMObject, public IDOMHTMLOptionsCollect
virtual HRESULT STDMETHODCALLTYPE namedItem(
/* [in] */ BSTR name,
/* [retval][out] */ IDOMNode *result);
/* [retval][out] */ IDOMNode **result);
private:
DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection*);
RefPtr<WebCore::HTMLOptionsCollection> m_collection;
};
class DOMHTMLDocument : public DOMDocument, public IDOMHTMLDocument
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment