本文整理汇总了C++中EventListenerManager类的典型用法代码示例。如果您正苦于以下问题:C++ EventListenerManager类的具体用法?C++ EventListenerManager怎么用?C++ EventListenerManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventListenerManager类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_QueryInterface
void
mozilla::dom::TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC)
{
#ifdef MOZ_XUL
// Mark the scripts held in the XULPrototypeCache. This is required to keep
// the JS script in the cache live across GC.
nsXULPrototypeCache* cache = nsXULPrototypeCache::MaybeGetInstance();
if (cache) {
if (aIsShutdownGC) {
cache->FlushScripts();
} else {
cache->MarkInGC(aTrc);
}
}
#endif
if (!nsCCUncollectableMarker::sGeneration) {
return;
}
if (nsFrameMessageManager::GetChildProcessManager()) {
nsIContentProcessMessageManager* pg = ProcessGlobal::Get();
if (pg) {
mozilla::TraceScriptHolder(pg, aTrc);
}
}
// Mark globals of active windows black.
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
if (windowsById) {
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
nsGlobalWindow* window = iter.Data();
if (window->GetDocShell() && window->IsOuterWindow()) {
window->TraceGlobalJSObject(aTrc);
EventListenerManager* elm = window->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(aTrc);
}
if (window->IsRootOuterWindow()) {
// In child process trace all the TabChildGlobals.
// Since there is one root outer window per TabChildGlobal, we need
// to look for only those windows, not all.
nsIDocShell* ds = window->GetDocShell();
if (ds) {
nsCOMPtr<nsITabChild> tabChild = ds->GetTabChild();
if (tabChild) {
nsCOMPtr<nsIContentFrameMessageManager> mm;
tabChild->GetMessageManager(getter_AddRefs(mm));
nsCOMPtr<EventTarget> et = do_QueryInterface(mm);
if (et) {
nsCOMPtr<nsISupports> tabChildAsSupports =
do_QueryInterface(tabChild);
mozilla::TraceScriptHolder(tabChildAsSupports, aTrc);
EventListenerManager* elm = et->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(aTrc);
}
// As of now there isn't an easy way to trace message listeners.
}
}
}
}
#ifdef MOZ_XUL
nsIDocument* doc = window->GetExtantDoc();
if (doc && doc->IsXULDocument()) {
XULDocument* xulDoc = static_cast<XULDocument*>(doc);
xulDoc->TraceProtos(aTrc, aGCNumber);
}
#endif
}
}
}
}
示例2: GetExistingListenerManager
EventHandlerNonNull*
EventTarget::GetEventHandler(nsIAtom* aType, const nsAString& aTypeString)
{
EventListenerManager* elm = GetExistingListenerManager();
return elm ? elm->GetEventHandler(aType, aTypeString) : nullptr;
}
示例3: GetExistingListenerManager
OnErrorEventHandlerNonNull* WorkerGlobalScope::GetOnerror() {
mWorkerPrivate->AssertIsOnWorkerThread();
EventListenerManager* elm = GetExistingListenerManager();
return elm ? elm->GetOnErrorEventHandler() : nullptr;
}
示例4: NS_PRECONDITION
//.........这里部分代码省略.........
false);
NS_ENSURE_SUCCESS(rv, rv);
}
else if (aDeep && clone->IsNodeOfType(nsINode::eDOCUMENT)) {
// After cloning the document itself, we want to clone the children into
// the cloned document (somewhat like cloning and importing them into the
// cloned document).
nodeInfoManager = clone->mNodeInfo->NodeInfoManager();
}
}
else if (nodeInfoManager) {
nsIDocument* oldDoc = aNode->OwnerDoc();
bool wasRegistered = false;
if (aNode->IsElement()) {
Element* element = aNode->AsElement();
oldDoc->ClearBoxObjectFor(element);
wasRegistered = oldDoc->UnregisterActivityObserver(element);
}
aNode->mNodeInfo.swap(newNodeInfo);
if (elem) {
elem->NodeInfoChanged(newNodeInfo);
}
nsIDocument* newDoc = aNode->OwnerDoc();
if (newDoc) {
// XXX what if oldDoc is null, we don't know if this should be
// registered or not! Can that really happen?
if (wasRegistered) {
newDoc->RegisterActivityObserver(aNode->AsElement());
}
if (nsPIDOMWindowInner* window = newDoc->GetInnerWindow()) {
EventListenerManager* elm = aNode->GetExistingListenerManager();
if (elm) {
window->SetMutationListeners(elm->MutationListenerBits());
if (elm->MayHavePaintEventListener()) {
window->SetHasPaintEventListeners();
}
if (elm->MayHaveTouchEventListener()) {
window->SetHasTouchEventListeners();
}
if (elm->MayHaveMouseEnterLeaveEventListener()) {
window->SetHasMouseEnterLeaveEventListeners();
}
if (elm->MayHavePointerEnterLeaveEventListener()) {
window->SetHasPointerEnterLeaveEventListeners();
}
}
}
}
if (wasRegistered && oldDoc != newDoc) {
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aNode));
if (domMediaElem) {
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aNode);
mediaElem->NotifyOwnerDocumentActivityChanged();
}
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aNode));
if (objectLoadingContent) {
nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
olc->NotifyOwnerDocumentActivityChanged();
}
}
if (oldDoc != newDoc && oldDoc->MayHaveDOMMutationObservers()) {
示例5: PR_NEXT_LINK
void mozilla::dom::TraceBlackJS(JSTracer* aTrc, bool aIsShutdownGC) {
#ifdef MOZ_XUL
// Mark the scripts held in the XULPrototypeCache. This is required to keep
// the JS script in the cache live across GC.
nsXULPrototypeCache* cache = nsXULPrototypeCache::MaybeGetInstance();
if (cache) {
if (aIsShutdownGC) {
cache->FlushScripts();
} else {
cache->MarkInGC(aTrc);
}
}
#endif
if (!nsCCUncollectableMarker::sGeneration) {
return;
}
if (ContentProcessMessageManager::WasCreated() &&
nsFrameMessageManager::GetChildProcessManager()) {
auto* pg = ContentProcessMessageManager::Get();
if (pg) {
mozilla::TraceScriptHolder(ToSupports(pg), aTrc);
}
}
// Mark globals of active windows black.
nsGlobalWindowOuter::OuterWindowByIdTable* windowsById =
nsGlobalWindowOuter::GetWindowsTable();
if (windowsById) {
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
nsGlobalWindowOuter* window = iter.Data();
if (!window->IsCleanedUp()) {
nsGlobalWindowInner* inner = nullptr;
for (PRCList* win = PR_LIST_HEAD(window); win != window;
win = PR_NEXT_LINK(inner)) {
inner = static_cast<nsGlobalWindowInner*>(win);
if (inner->IsCurrentInnerWindow() ||
(inner->GetExtantDoc() &&
inner->GetExtantDoc()->GetBFCacheEntry())) {
inner->TraceGlobalJSObject(aTrc);
EventListenerManager* elm = inner->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(aTrc);
}
}
}
if (window->IsRootOuterWindow()) {
// In child process trace all the TabChildMessageManagers.
// Since there is one root outer window per TabChildMessageManager, we
// need to look for only those windows, not all.
nsIDocShell* ds = window->GetDocShell();
if (ds) {
nsCOMPtr<nsITabChild> tabChild = ds->GetTabChild();
if (tabChild) {
RefPtr<ContentFrameMessageManager> mm;
tabChild->GetMessageManager(getter_AddRefs(mm));
if (mm) {
nsCOMPtr<nsISupports> tabChildAsSupports =
do_QueryInterface(tabChild);
mozilla::TraceScriptHolder(tabChildAsSupports, aTrc);
EventListenerManager* elm = mm->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(aTrc);
}
// As of now there isn't an easy way to trace message listeners.
}
}
}
}
#ifdef MOZ_XUL
Document* doc = window->GetExtantDoc();
if (doc) {
doc->TraceProtos(aTrc);
}
#endif
}
}
}
}
示例6: TrustedEventsAtSystemGroupBubble
void
nsEditorEventListener::UninstallFromEditor()
{
nsCOMPtr<EventTarget> piTarget = mEditor->GetDOMEventTarget();
if (!piTarget) {
return;
}
EventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
if (!elmP) {
return;
}
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("keydown"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("keyup"),
TrustedEventsAtSystemGroupBubble());
#endif
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("keypress"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("dragenter"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("dragover"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("dragexit"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("drop"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("mousedown"),
TrustedEventsAtCapture());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("mouseup"),
TrustedEventsAtCapture());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("click"),
TrustedEventsAtCapture());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("blur"),
TrustedEventsAtCapture());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("focus"),
TrustedEventsAtCapture());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("text"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("compositionstart"),
TrustedEventsAtSystemGroupBubble());
elmP->RemoveEventListenerByType(this,
NS_LITERAL_STRING("compositionend"),
TrustedEventsAtSystemGroupBubble());
}
示例7: NS_PRECONDITION
nsresult
nsEditorEventListener::InstallToEditor()
{
NS_PRECONDITION(mEditor, "The caller must set mEditor");
nsCOMPtr<EventTarget> piTarget = mEditor->GetDOMEventTarget();
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
// register the event listeners with the listener manager
EventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
NS_ENSURE_STATE(elmP);
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("keydown"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("keyup"),
TrustedEventsAtSystemGroupBubble());
#endif
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("keypress"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("dragenter"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("dragover"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("dragexit"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("drop"),
TrustedEventsAtSystemGroupBubble());
// XXX We should add the mouse event listeners as system event group.
// E.g., web applications cannot prevent middle mouse paste by
// preventDefault() of click event at bubble phase.
// However, if we do so, all click handlers in any frames and frontend
// code need to check if it's editable. It makes easier create new bugs.
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("mousedown"),
TrustedEventsAtCapture());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("mouseup"),
TrustedEventsAtCapture());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("click"),
TrustedEventsAtCapture());
// Focus event doesn't bubble so adding the listener to capturing phase.
// Make sure this works after bug 235441 gets fixed.
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("blur"),
TrustedEventsAtCapture());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("focus"),
TrustedEventsAtCapture());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("text"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("compositionstart"),
TrustedEventsAtSystemGroupBubble());
elmP->AddEventListenerByType(this,
NS_LITERAL_STRING("compositionend"),
TrustedEventsAtSystemGroupBubble());
return NS_OK;
}