本文整理汇总了C++中JSDOMWindow::setCurrentEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ JSDOMWindow::setCurrentEvent方法的具体用法?C++ JSDOMWindow::setCurrentEvent怎么用?C++ JSDOMWindow::setCurrentEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSDOMWindow
的用法示例。
在下文中一共展示了JSDOMWindow::setCurrentEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
{
JSObject* listener = listenerObj();
if (!listener)
return;
JSDOMWindow* window = this->window();
// Null check as clearWindow() can clear this and we still get called back by
// xmlhttprequest objects. See http://bugs.webkit.org/show_bug.cgi?id=13275
if (!window)
return;
Frame* frame = window->impl()->frame();
if (!frame)
return;
ScriptController* script = frame->script();
if (!script->isEnabled() || script->isPaused())
return;
JSLock lock(false);
ExecState* exec = window->globalExec();
JSValue* handleEventFunction = listener->get(exec, Identifier(exec, "handleEvent"));
CallData callData;
CallType callType = handleEventFunction->getCallData(callData);
if (callType == CallTypeNone) {
handleEventFunction = 0;
callType = listener->getCallData(callData);
}
if (callType != CallTypeNone) {
ref();
ArgList args;
args.append(toJS(exec, event));
Event* savedEvent = window->currentEvent();
window->setCurrentEvent(event);
JSValue* retval;
if (handleEventFunction) {
window->startTimeoutCheck();
retval = call(exec, handleEventFunction, callType, callData, listener, args);
} else {
JSValue* thisValue;
if (isWindowEvent)
thisValue = window->shell();
else
thisValue = toJS(exec, event->currentTarget());
window->startTimeoutCheck();
retval = call(exec, listener, callType, callData, thisValue, args);
}
window->stopTimeoutCheck();
window->setCurrentEvent(savedEvent);
if (exec->hadException())
frame->domWindow()->console()->reportCurrentException(exec);
else {
if (!retval->isUndefinedOrNull() && event->storesResultAsString())
event->storeResult(retval->toString(exec));
if (m_isHTML) {
bool retvalbool;
if (retval->getBoolean(retvalbool) && !retvalbool)
event->preventDefault();
}
}
Document::updateDocumentsRendering();
deref();
}
}