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; }
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()); }
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; }
void DocManager::AddListeners(nsIDocument* aDocument, bool aAddDOMContentLoadedListener) { nsPIDOMWindow* window = aDocument->GetWindow(); EventTarget* target = window->GetChromeEventHandler(); EventListenerManager* elm = target->GetOrCreateListenerManager(); elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"), TrustedEventsAtCapture()); #ifdef A11Y_LOG if (logging::IsEnabled(logging::eDocCreate)) logging::Text("added 'pagehide' listener"); #endif if (aAddDOMContentLoadedListener) { elm->AddEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"), TrustedEventsAtCapture()); #ifdef A11Y_LOG if (logging::IsEnabled(logging::eDocCreate)) logging::Text("added 'DOMContentLoaded' listener"); #endif } }