mshtml: Added IHTMLScriptElement:get_type implementation.
This commit is contained in:
parent
5ecd33e2f9
commit
134dad7ecd
|
@ -39,6 +39,8 @@ typedef struct {
|
||||||
HTMLElement element;
|
HTMLElement element;
|
||||||
|
|
||||||
const IHTMLScriptElementVtbl *lpHTMLScriptElementVtbl;
|
const IHTMLScriptElementVtbl *lpHTMLScriptElementVtbl;
|
||||||
|
|
||||||
|
nsIDOMHTMLScriptElement *nsscript;
|
||||||
} HTMLScriptElement;
|
} HTMLScriptElement;
|
||||||
|
|
||||||
#define HTMLSCRIPT(x) ((IHTMLScriptElement*) &(x)->lpHTMLScriptElementVtbl)
|
#define HTMLSCRIPT(x) ((IHTMLScriptElement*) &(x)->lpHTMLScriptElementVtbl)
|
||||||
|
@ -203,8 +205,22 @@ static HRESULT WINAPI HTMLScriptElement_put_type(IHTMLScriptElement *iface, BSTR
|
||||||
static HRESULT WINAPI HTMLScriptElement_get_type(IHTMLScriptElement *iface, BSTR *p)
|
static HRESULT WINAPI HTMLScriptElement_get_type(IHTMLScriptElement *iface, BSTR *p)
|
||||||
{
|
{
|
||||||
HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
|
HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
|
||||||
FIXME("(%p)->(%p)\n", This, p);
|
const PRUnichar *nstype;
|
||||||
return E_NOTIMPL;
|
nsAString nstype_str;
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
|
||||||
|
nsAString_Init(&nstype_str, NULL);
|
||||||
|
nsres = nsIDOMHTMLScriptElement_GetType(This->nsscript, &nstype_str);
|
||||||
|
if(NS_FAILED(nsres))
|
||||||
|
ERR("GetType failed: %08x\n", nsres);
|
||||||
|
|
||||||
|
nsAString_GetData(&nstype_str, &nstype);
|
||||||
|
*p = *nstype ? SysAllocString(nstype) : NULL;
|
||||||
|
nsAString_Finish(&nstype_str);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IHTMLScriptElementVtbl HTMLScriptElementVtbl = {
|
static const IHTMLScriptElementVtbl HTMLScriptElementVtbl = {
|
||||||
|
@ -277,11 +293,16 @@ static const NodeImplVtbl HTMLScriptElementImplVtbl = {
|
||||||
HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement *nselem)
|
HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement *nselem)
|
||||||
{
|
{
|
||||||
HTMLScriptElement *ret = heap_alloc(sizeof(HTMLScriptElement));
|
HTMLScriptElement *ret = heap_alloc(sizeof(HTMLScriptElement));
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
HTMLElement_Init(&ret->element);
|
HTMLElement_Init(&ret->element);
|
||||||
|
|
||||||
ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl;
|
ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl;
|
||||||
ret->element.node.vtbl = &HTMLScriptElementImplVtbl;
|
ret->element.node.vtbl = &HTMLScriptElementImplVtbl;
|
||||||
|
|
||||||
|
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript);
|
||||||
|
if(NS_FAILED(nsres))
|
||||||
|
ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
|
||||||
|
|
||||||
return &ret->element;
|
return &ret->element;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1271,6 +1271,30 @@ interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement
|
||||||
nsresult Select();
|
nsresult Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
object,
|
||||||
|
uuid(a6cf90b1-15b3-11d2-932e-00805f8add32),
|
||||||
|
local
|
||||||
|
/* FROZEN */
|
||||||
|
]
|
||||||
|
interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement
|
||||||
|
{
|
||||||
|
nsresult GetText(nsAString *aText);
|
||||||
|
nsresult SetText(const nsAString *aText);
|
||||||
|
nsresult GetHtmlFor(nsAString *aHtmlFor);
|
||||||
|
nsresult SetHtmlFor(const nsAString *aHtmlFor);
|
||||||
|
nsresult GetEvent(nsAString *aEvent);
|
||||||
|
nsresult SetEvent(const nsAString *aEvent);
|
||||||
|
nsresult GetCharset(nsAString *aCharset);
|
||||||
|
nsresult SetCharset(const nsAString *aCharset);
|
||||||
|
nsresult GetDefer(PRBool *aDefer);
|
||||||
|
nsresult SetDefer(PRBool aDefer);
|
||||||
|
nsresult GetSrc(nsAString *aSrc);
|
||||||
|
nsresult SetSrc(const nsAString *aSrc);
|
||||||
|
nsresult GetType(nsAString *aType);
|
||||||
|
nsresult SetType(const nsAString *aType);
|
||||||
|
}
|
||||||
|
|
||||||
[
|
[
|
||||||
object,
|
object,
|
||||||
uuid(94928ab3-8b63-11d3-989d-001083010e9b),
|
uuid(94928ab3-8b63-11d3-989d-001083010e9b),
|
||||||
|
|
|
@ -43,7 +43,7 @@ static const char elem_test_str[] =
|
||||||
"<select id=\"s\"><option id=\"x\">opt1</option><option id=\"y\">opt2</option></select>"
|
"<select id=\"s\"><option id=\"x\">opt1</option><option id=\"y\">opt2</option></select>"
|
||||||
"<textarea id=\"X\">text text</textarea>"
|
"<textarea id=\"X\">text text</textarea>"
|
||||||
"<table><tbody></tbody></table>"
|
"<table><tbody></tbody></table>"
|
||||||
"<script type=\"text/javascript\"></script>"
|
"<script id=\"sc\" type=\"text/javascript\"></script>"
|
||||||
"</body></html>";
|
"</body></html>";
|
||||||
static const char indent_test_str[] =
|
static const char indent_test_str[] =
|
||||||
"<html><head><title>test</title></head><body>abc<br /><a href=\"about:blank\">123</a></body></html>";
|
"<html><head><title>test</title></head><body>abc<br /><a href=\"about:blank\">123</a></body></html>";
|
||||||
|
@ -54,6 +54,8 @@ static WCHAR characterW[] = {'c','h','a','r','a','c','t','e','r',0};
|
||||||
static WCHAR texteditW[] = {'t','e','x','t','e','d','i','t',0};
|
static WCHAR texteditW[] = {'t','e','x','t','e','d','i','t',0};
|
||||||
static WCHAR wordW[] = {'w','o','r','d',0};
|
static WCHAR wordW[] = {'w','o','r','d',0};
|
||||||
|
|
||||||
|
static const WCHAR text_javascriptW[] = {'t','e','x','t','/','j','a','v','a','s','c','r','i','p','t',0};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ET_NONE,
|
ET_NONE,
|
||||||
ET_HTML,
|
ET_HTML,
|
||||||
|
@ -1193,6 +1195,7 @@ static void test_elems(IHTMLDocument2 *doc)
|
||||||
|
|
||||||
static const WCHAR xW[] = {'x',0};
|
static const WCHAR xW[] = {'x',0};
|
||||||
static const WCHAR sW[] = {'s',0};
|
static const WCHAR sW[] = {'s',0};
|
||||||
|
static const WCHAR scW[] = {'s','c',0};
|
||||||
static const WCHAR xxxW[] = {'x','x','x',0};
|
static const WCHAR xxxW[] = {'x','x','x',0};
|
||||||
|
|
||||||
static const elem_type_t all_types[] = {
|
static const elem_type_t all_types[] = {
|
||||||
|
@ -1250,6 +1253,20 @@ static void test_elems(IHTMLDocument2 *doc)
|
||||||
IHTMLElement_Release(elem);
|
IHTMLElement_Release(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elem = get_elem_by_id(doc, scW, TRUE);
|
||||||
|
if(elem) {
|
||||||
|
IHTMLScriptElement *script;
|
||||||
|
BSTR type;
|
||||||
|
|
||||||
|
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLScriptElement, (void**)&script);
|
||||||
|
ok(hres == S_OK, "Could not get IHTMLScriptElement interface: %08x\n", hres);
|
||||||
|
|
||||||
|
hres = IHTMLScriptElement_get_type(script, &type);
|
||||||
|
ok(hres == S_OK, "get_type failed: %08x\n", hres);
|
||||||
|
ok(!lstrcmpW(type, text_javascriptW), "Unexpected type %s\n", dbgstr_w(type));
|
||||||
|
SysFreeString(type);
|
||||||
|
}
|
||||||
|
|
||||||
test_stylesheets(doc);
|
test_stylesheets(doc);
|
||||||
test_create_option_elem(doc);
|
test_create_option_elem(doc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue