diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index 09890cb7758..2af4faacf60 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -36,6 +36,8 @@ typedef struct { HTMLElement element; const IHTMLObjectElementVtbl *lpIHTMLObjectElementVtbl; + + nsIDOMHTMLObjectElement *nsobject; } HTMLObjectElement; #define HTMLOBJECT(x) (&(x)->lpIHTMLObjectElementVtbl) @@ -314,8 +316,19 @@ static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LO static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p) { HTMLObjectElement *This = HTMLOBJECT_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + PRInt32 vspace; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace); + if(NS_FAILED(nsres)) { + ERR("GetVspace failed: %08x\n", nsres); + return E_FAIL; + } + + *p = vspace; + return S_OK; } static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v) @@ -405,6 +418,9 @@ static void HTMLObjectElement_destructor(HTMLDOMNode *iface) { HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface); + if(This->nsobject) + nsIDOMHTMLObjectElement_Release(This->nsobject); + HTMLElement_destructor(&This->element.node); } @@ -430,10 +446,16 @@ static dispex_static_data_t HTMLObjectElement_dispex = { HTMLElement *HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) { HTMLObjectElement *ret = heap_alloc_zero(sizeof(*ret)); + nsresult nsres; ret->lpIHTMLObjectElementVtbl = &HTMLObjectElementVtbl; ret->element.node.vtbl = &HTMLObjectElementImplVtbl; HTMLElement_Init(&ret->element, doc, nselem, &HTMLObjectElement_dispex); + + nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject); + if(NS_FAILED(nsres)) + ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres); + return &ret->element; } diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index c7aaf889797..0d82d7cbb91 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1638,6 +1638,51 @@ interface nsIDOMHTMLFrameElement : nsIDOMHTMLElement nsresult GetContentDocument(nsIDOMDocument **aContentDocument); } +[ + object, + uuid(a6cf90ac-15b3-11d2-932e-00805f8add32), + local +] +interface nsIDOMHTMLObjectElement : nsIDOMHTMLElement +{ + nsresult GetForm(nsIDOMHTMLFormElement **aForm); + nsresult GetCode(nsAString *aCode); + nsresult SetCode(const nsAString *aCode); + nsresult GetAlign(nsAString *aAlign); + nsresult SetAlign(const nsAString *aAlign); + nsresult GetArchive(nsAString *aArchive); + nsresult SetArchive(const nsAString *aArchive); + nsresult GetBorder(nsAString *aBorder); + nsresult SetBorder(const nsAString *aBorder); + nsresult GetCodeBase(nsAString *aCodeBase); + nsresult SetCodeBase(const nsAString *aCodeBase); + nsresult GetCodeType(nsAString *aCodeType); + nsresult SetCodeType(const nsAString *aCodeType); + nsresult GetData(nsAString *aData); + nsresult SetData(const nsAString *aData); + nsresult GetDeclare(PRBool *aDeclare); + nsresult SetDeclare(PRBool aDeclare); + nsresult GetHeight(nsAString *aHeight); + nsresult SetHeight(const nsAString *aHeight); + nsresult GetHspace(PRInt32 *aHspace); + nsresult SetHspace(PRInt32 aHspace); + nsresult GetName(nsAString *aName); + nsresult SetName(const nsAString *aName); + nsresult GetStandby(nsAString *aStandby); + nsresult SetStandby(const nsAString *aStandby); + nsresult GetTabIndex(PRInt32 *aTabIndex); + nsresult SetTabIndex(PRInt32 aTabIndex); + nsresult GetType(nsAString *aType); + nsresult SetType(const nsAString *aType); + nsresult GetUseMap(nsAString *aUseMap); + nsresult SetUseMap(const nsAString *aUseMap); + nsresult GetVspace(PRInt32 *aVspace); + nsresult SetVspace(PRInt32 aVspace); + nsresult GetWidth(nsAString *aWidth); + nsresult SetWidth(const nsAString *aWidth); + nsresult GetContentDocument(nsIDOMDocument **aContentDocument); +} + [ object, uuid(94928ab3-8b63-11d3-989d-001083010e9b), diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c1110ba5e43..9ba45ce9668 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -48,7 +48,7 @@ static const char elem_test_str[] = "" "
td1 texttd2 text
" "" - "" + "" "" "" "
" @@ -756,6 +756,17 @@ static IHTMLCommentElement *_get_comment_iface(unsigned line, IUnknown *unk) return comment; } +#define get_object_iface(u) _get_object_iface(__LINE__,u) +static IHTMLObjectElement *_get_object_iface(unsigned line, IUnknown *unk) +{ + IHTMLObjectElement *obj; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLObjectElement, (void**)&obj); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLObjectElement: %08x\n", hres); + return obj; +} + #define test_node_name(u,n) _test_node_name(__LINE__,u,n) static void _test_node_name(unsigned line, IUnknown *unk, const char *exname) { @@ -1284,6 +1295,20 @@ static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext) SysFreeString(text); } +#define test_object_vspace(u,s) _test_object_vspace(__LINE__,u,s) +static void _test_object_vspace(unsigned line, IUnknown *unk, LONG exl) +{ + IHTMLObjectElement *object = _get_object_iface(line, unk); + LONG l; + HRESULT hres; + + l = 0xdeadbeef; + hres = IHTMLObjectElement_get_vspace(object, &l); + ok_(__FILE__,line)(hres == S_OK, "get_vspace failed: %08x\n", hres); + ok_(__FILE__,line)(l == exl, "vspace=%d, expected %d\n", l, exl); + IHTMLObjectElement_Release(object); +} + #define create_option_elem(d,t,v) _create_option_elem(__LINE__,d,t,v) static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *doc, const char *txt, const char *val) @@ -6224,6 +6249,13 @@ static void test_elems(IHTMLDocument2 *doc) IHTMLElement_Release(elem); } + elem = get_doc_elem_by_id(doc, "objid"); + ok(elem != NULL, "elem == NULL\n"); + if(elem) { + test_object_vspace((IUnknown*)elem, 100); + IHTMLElement_Release(elem); + } + elem = get_elem_by_id(doc, "a", TRUE); if(elem) { test_anchor_href((IUnknown*)elem, "http://test/");