本文整理汇总了C++中EventTarget::GetOrCreateListenerManager方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::GetOrCreateListenerManager方法的具体用法?C++ EventTarget::GetOrCreateListenerManager怎么用?C++ EventTarget::GetOrCreateListenerManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventTarget
的用法示例。
在下文中一共展示了EventTarget::GetOrCreateListenerManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPresShell
nsresult
HTMLEditor::EndMoving()
{
if (mPositioningShadow) {
nsCOMPtr<nsIPresShell> ps = GetPresShell();
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
DeleteRefToAnonymousNode(std::move(mPositioningShadow), ps);
mPositioningShadow = nullptr;
}
EventTarget* eventTarget = GetDOMEventTarget();
if (eventTarget && mMouseMotionListenerP) {
EventListenerManager* eventListenerManager =
eventTarget->GetOrCreateListenerManager();
eventListenerManager->RemoveEventListenerByType(
mMouseMotionListenerP,
NS_LITERAL_STRING("mousemove"),
TrustedEventsAtSystemGroupBubble());
}
mMouseMotionListenerP = nullptr;
mGrabberClicked = false;
mIsMoving = false;
RefPtr<Selection> selection = GetSelection();
if (!selection) {
return NS_ERROR_NOT_INITIALIZED;
}
nsresult rv = RefereshEditingUI(*selection);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
示例2: TrustedEventsAtCapture
void
DocManager::RemoveListeners(nsIDocument* aDocument)
{
nsPIDOMWindow* window = aDocument->GetWindow();
if (!window)
return;
EventTarget* target = window->GetChromeEventHandler();
if (!target)
return;
EventListenerManager* elm = target->GetOrCreateListenerManager();
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
TrustedEventsAtCapture());
}
示例3: GetDOMEventTarget
nsresult
HTMLEditor::GrabberClicked()
{
// add a mouse move listener to the editor
nsresult rv = NS_OK;
if (!mMouseMotionListenerP) {
EventTarget* eventTarget = GetDOMEventTarget();
if (NS_WARN_IF(!eventTarget)) {
return NS_ERROR_FAILURE;
}
mMouseMotionListenerP = new ResizerMouseMotionListener(*this);
EventListenerManager* eventListenerManager =
eventTarget->GetOrCreateListenerManager();
eventListenerManager->AddEventListenerByType(
mMouseMotionListenerP,
NS_LITERAL_STRING("mousemove"),
TrustedEventsAtSystemGroupBubble());
}
mGrabberClicked = true;
return rv;
}