本文整理汇总了C++中EventTarget::toLocalDOMWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::toLocalDOMWindow方法的具体用法?C++ EventTarget::toLocalDOMWindow怎么用?C++ EventTarget::toLocalDOMWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventTarget
的用法示例。
在下文中一共展示了EventTarget::toLocalDOMWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchEvent
void DOMWindowEventQueue::dispatchEvent(Event* event) {
EventTarget* eventTarget = event->target();
InspectorInstrumentation::AsyncTask asyncTask(
eventTarget->getExecutionContext(), event);
if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow())
window->dispatchEvent(event, nullptr);
else
eventTarget->dispatchEvent(event);
}
示例2: createImageBitmap
ScriptPromise HTMLVideoElement::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& options, ExceptionState& exceptionState)
{
ASSERT(eventTarget.toLocalDOMWindow());
if (getNetworkState() == HTMLMediaElement::NETWORK_EMPTY) {
exceptionState.throwDOMException(InvalidStateError, "The provided element has not retrieved data.");
return ScriptPromise();
}
if (getReadyState() <= HTMLMediaElement::HAVE_METADATA) {
exceptionState.throwDOMException(InvalidStateError, "The provided element's player has no current data.");
return ScriptPromise();
}
if (!sw || !sh) {
exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width"));
return ScriptPromise();
}
return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::create(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), options));
}