Test cases added:
* layout-tests/dom/html/level2/events/dispatchEvent08-expected.txt:
* layout-tests/dom/html/level2/events/dispatchEvent10-expected.txt:
* layout-tests/dom/html/level2/events/dispatchEvent12-expected.txt:
These pass now.
* layout-tests/dom/html/level2/events/dispatchEvent11-expected.txt:
* layout-tests/dom/html/level2/events/dispatchEvent13-expected.txt:
These fail someplace else now.
* khtml/ecma/kjs_events.cpp:
(KJS::JSAbstractEventListener::handleEvent):
Check if the listener has a "handleEvent" function property and
call that.
* khtml/xml/dom_nodeimpl.cpp:
(DOM::NodeImpl::dispatchGenericEvent):
A capturing event listener should not be triggered if an event is
dispatched directly to the node to which the listener has been added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10175
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
-Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent08
-Status: failure
-Detail: atCount: assertEquals failed, actual 0, expected 1.
+Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent08
+Status: Success
-Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent10
-Status: failure
-Detail: atCount: assertEquals failed, actual 0, expected 1.
+Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent10
+Status: Success
-Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent11
-Status: Success
+Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent11
+Status: failure
+Detail: eventCount: assertEquals failed, actual 1, expected 0.
-Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent12
-Status: failure
-Detail: eventCount: assertEquals failed, actual 0, expected 1.
+Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent12
+Status: Success
Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent13
Status: failure
-Detail: eventCount: assertEquals failed, actual 0, expected 1.
+Detail: eventCount: assertEquals failed, actual 2, expected 1.
+2005-08-14 Anders Carlsson <andersca@mac.com>
+
+ Reviewed and landed by Darin.
+
+ Test cases added:
+ * layout-tests/dom/html/level2/events/dispatchEvent08-expected.txt:
+ * layout-tests/dom/html/level2/events/dispatchEvent10-expected.txt:
+ * layout-tests/dom/html/level2/events/dispatchEvent12-expected.txt:
+ These pass now.
+
+ * layout-tests/dom/html/level2/events/dispatchEvent11-expected.txt:
+ * layout-tests/dom/html/level2/events/dispatchEvent13-expected.txt:
+ These fail someplace else now.
+
+ * khtml/ecma/kjs_events.cpp:
+ (KJS::JSAbstractEventListener::handleEvent):
+ Check if the listener has a "handleEvent" function property and
+ call that.
+
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::NodeImpl::dispatchGenericEvent):
+ A capturing event listener should not be triggered if an event is
+ dispatched directly to the node to which the listener has been added.
+
2005-08-14 Anders Carlsson <andersca@mac.com>
Reviewed and landed by Darin.
if (part)
proxy = KJSProxy::proxy( part );
- if (proxy && listener->implementsCall()) {
+ ScriptInterpreter *interpreter = static_cast<ScriptInterpreter *>(proxy->interpreter());
+ ExecState *exec = interpreter->globalExec();
+
+ bool hasHandleEvent = false;
+ ValueImp *handleEventFuncValue = 0;
+ ObjectImp *handleEventFunc = 0;
+
+ handleEventFuncValue = listener->get(exec, "handleEvent");
+ if (handleEventFuncValue->isObject()) {
+ handleEventFunc = static_cast<ObjectImp *>(handleEventFuncValue);
+
+ if (handleEventFunc->implementsCall())
+ hasHandleEvent = true;
+ }
+
+ if (proxy && (listener->implementsCall() || hasHandleEvent)) {
ref();
- ScriptInterpreter *interpreter = static_cast<ScriptInterpreter *>(proxy->interpreter());
- ExecState *exec = interpreter->globalExec();
-
List args;
args.append(getDOMEvent(exec,evt));
}
Interpreter::lock();
- ValueImp *retval = listener->call(exec, thisObj, args);
+ ValueImp *retval;
+ if (hasHandleEvent)
+ retval = handleEventFunc->call(exec, listener, args);
+ else
+ retval = listener->call(exec, thisObj, args);
Interpreter::unlock();
window->setCurrentEvent( 0 );
evt->setEventPhase(Event::AT_TARGET);
evt->setCurrentTarget(it.current());
- // Capturing first. -dwh
- it.current()->handleLocalEvents(evt,true);
-
- // Bubbling second. -dwh
if (!evt->propagationStopped())
it.current()->handleLocalEvents(evt,false);
}