mshtml: Added IHTMLImgElement::put_src implementation.
This commit is contained in:
parent
47d8352067
commit
23ad09865e
|
@ -35,6 +35,8 @@ typedef struct {
|
|||
HTMLElement element;
|
||||
|
||||
const IHTMLImgElementVtbl *lpHTMLImgElementVtbl;
|
||||
|
||||
nsIDOMHTMLImageElement *nsimg;
|
||||
} HTMLImgElement;
|
||||
|
||||
#define HTMLIMG(x) ((IHTMLImgElement*) &(x)->lpHTMLImgElementVtbl)
|
||||
|
@ -240,8 +242,18 @@ static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
|
|||
static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
|
||||
{
|
||||
HTMLImgElement *This = HTMLIMG_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
nsAString src_str;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
nsAString_Init(&src_str, v);
|
||||
nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
|
||||
nsAString_Finish(&src_str);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("SetSrc failed: %08x\n", nsres);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
|
||||
|
@ -516,6 +528,9 @@ static void HTMLImgElement_destructor(HTMLDOMNode *iface)
|
|||
{
|
||||
HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
|
||||
|
||||
if(This->nsimg)
|
||||
nsIDOMHTMLImageElement_Release(This->nsimg);
|
||||
|
||||
HTMLElement_destructor(&This->element.node);
|
||||
}
|
||||
|
||||
|
@ -544,10 +559,15 @@ static dispex_static_data_t HTMLImgElement_dispex = {
|
|||
HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem)
|
||||
{
|
||||
HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement));
|
||||
nsresult nsres;
|
||||
|
||||
ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLImgElementImplVtbl;
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
|
||||
|
||||
init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex);
|
||||
HTMLElement_Init(&ret->element);
|
||||
|
||||
|
|
|
@ -1295,6 +1295,39 @@ interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement
|
|||
nsresult SetType(const nsAString *aType);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(a6cf90ab-15b3-11d2-932e-00805f8add32),
|
||||
local
|
||||
]
|
||||
interface nsIDOMHTMLImageElement : nsIDOMHTMLElement
|
||||
{
|
||||
nsresult GetName(nsAString *aName);
|
||||
nsresult SetName(const nsAString *aName);
|
||||
nsresult GetAlign(nsAString *aAlign);
|
||||
nsresult SetAlign(const nsAString *aAlign);
|
||||
nsresult GetAlt(nsAString *aAlt);
|
||||
nsresult SetAlt(const nsAString *aAlt);
|
||||
nsresult GetBorder(nsAString *aBorder);
|
||||
nsresult SetBorder(const nsAString *aBorder);
|
||||
nsresult GetHeight(PRInt32 *aHeight);
|
||||
nsresult SetHeight(PRInt32 aHeight);
|
||||
nsresult GetHspace(PRInt32 *aHspace);
|
||||
nsresult SetHspace(PRInt32 aHspace);
|
||||
nsresult GetIsMap(PRBool *aIsMap);
|
||||
nsresult SetIsMap(PRBool aIsMap);
|
||||
nsresult GetLongDesc(nsAString *aLongDesc);
|
||||
nsresult SetLongDesc(const nsAString *aLongDesc);
|
||||
nsresult GetSrc(nsAString *aSrc);
|
||||
nsresult SetSrc(const nsAString *aSrc);
|
||||
nsresult GetUseMap(nsAString *aUseMap);
|
||||
nsresult SetUseMap(const nsAString *aUseMap);
|
||||
nsresult GetVspace(PRInt32 *aVspace);
|
||||
nsresult SetVspace(PRInt32 aVspace);
|
||||
nsresult GetWidth(PRInt32 *aWidth);
|
||||
nsresult SetWidth(PRInt32 aWidth);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(94928ab3-8b63-11d3-989d-001083010e9b),
|
||||
|
|
|
@ -48,7 +48,7 @@ static const char elem_test_str[] =
|
|||
"<table><tbody></tbody></table>"
|
||||
"<script id=\"sc\" type=\"text/javascript\"></script>"
|
||||
"<test />"
|
||||
"<img /"
|
||||
"<img id=\"imgid\"/>"
|
||||
"</body></html>";
|
||||
static const char indent_test_str[] =
|
||||
"<html><head><title>test</title></head><body>abc<br /><a href=\"about:blank\">123</a></body></html>";
|
||||
|
@ -845,6 +845,23 @@ static long _get_node_type(unsigned line, IUnknown *unk)
|
|||
return type;
|
||||
}
|
||||
|
||||
#define test_img_set_src(u,s) _test_img_set_src(__LINE__,u,s)
|
||||
static void _test_img_set_src(unsigned line, IUnknown *unk, const char *src)
|
||||
{
|
||||
IHTMLImgElement *img;
|
||||
BSTR tmp;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IHTMLImgElement, (void**)&img);
|
||||
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLImgElement: %08x\n", hres);
|
||||
|
||||
tmp = a2bstr(src);
|
||||
hres = IHTMLImgElement_put_src(img, tmp);
|
||||
IHTMLImgElement_Release(img);
|
||||
SysFreeString(tmp);
|
||||
ok_(__FILE__,line) (hres == S_OK, "put_src failed: %08x\n", hres);
|
||||
}
|
||||
|
||||
#define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b)
|
||||
static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VARIANT_BOOL exb)
|
||||
{
|
||||
|
@ -1759,6 +1776,7 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
long type;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR imgidW[] = {'i','m','g','i','d',0};
|
||||
static const WCHAR inW[] = {'i','n',0};
|
||||
static const WCHAR xW[] = {'x',0};
|
||||
static const WCHAR sW[] = {'s',0};
|
||||
|
@ -1888,6 +1906,12 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
IHTMLElement_Release(elem);
|
||||
}
|
||||
|
||||
elem = get_elem_by_id(doc, imgidW, TRUE);
|
||||
if(elem) {
|
||||
test_img_set_src((IUnknown*)elem, "about:blank");
|
||||
IHTMLElement_Release(elem);
|
||||
}
|
||||
|
||||
hres = IHTMLDocument2_get_body(doc, &elem);
|
||||
ok(hres == S_OK, "get_body failed: %08x\n", hres);
|
||||
|
||||
|
|
Loading…
Reference in New Issue