mshtml: Added IHTMLDocument4::fireEvent implementation.

This commit is contained in:
Jacek Caban 2012-09-13 12:29:17 +02:00 committed by Alexandre Julliard
parent fae1fff830
commit 05dc7eac8d
3 changed files with 37 additions and 9 deletions

View file

@ -777,8 +777,10 @@ static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEv
VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
{
HTMLDocument *This = impl_from_IHTMLDocument4(iface);
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
return E_NOTIMPL;
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
return dispatch_event(&This->doc_node->node, bstrEventName, pvarEventObject, pfCanceled);
}
static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,

View file

@ -364,13 +364,10 @@ static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLEle
TRACE("(%p)->(%p)\n", This, p);
if(!This->target) {
*p = NULL;
return S_OK;
}
return IHTMLDOMNode_QueryInterface(&This->target->IHTMLDOMNode_iface, &IID_IHTMLElement,
(void**)p);
*p = NULL;
if(This->target)
IHTMLDOMNode_QueryInterface(&This->target->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
return S_OK;
}
static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p)

View file

@ -20,6 +20,16 @@ function ondataavailable_test() {
ok(evobj.type === "dataavailable", "evobj.type = " + evobj.type);
}
function ondataavailableDocHandler() {
b = true;
ok(window.event === evobj, "window.event != evobj");
ok(evobj.srcElement === null, "evobj.srcElement = " + evobj.srcElement);
ok(evobj.fromElement === null, "evobj.srcElement = " + evobj.fromElement);
ok(evobj.toElement === null, "evobj.srcElement = " + evobj.toElement);
ok(evobj.type === "dataavailable", "evobj.type = " + evobj.type);
}
div.attachEvent("ondataavailable", ondataavailableHandler);
evobj = document.createEventObject();
@ -33,6 +43,25 @@ function ondataavailable_test() {
ok(evobj.srcElement === div, "evobj.srcElement = " + evobj.srcElement);
ok(evobj.type === "dataavailable", "evobj.type = " + evobj.type);
div.detachEvent("ondataavailable", ondataavailableHandler);
b = false;
div.fireEvent("ondataavailable", evobj);
ok(!b, "ondataavailable handler called?");
ok(evobj.srcElement === div, "evobj.srcElement = " + evobj.srcElement);
ok(evobj.type === "dataavailable", "evobj.type = " + evobj.type);
document.attachEvent("ondataavailable", ondataavailableDocHandler);
evobj = document.createEventObject();
document.fireEvent("ondataavailable", evobj);
ok(b, "ondataavailable handler not called?");
ok(evobj.srcElement === null, "evobj.srcElement = " + evobj.srcElement);
ok(evobj.type === "dataavailable", "evobj.type = " + evobj.type);
}
function runTests() {