Bug 1446568: Remove nsDocument::UnlockPointer. r=smaug
And remove some now-unneeded casts.
MozReview-Commit-ID: CFfkiC0xJ2C
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11776,50 +11776,43 @@ nsIDocument::SetPointerLock(Element* aEl
esm->SetCursor(aCursorStyle, nullptr, false,
0.0f, 0.0f, widget, true);
EventStateManager::SetPointerLock(widget, aElement);
return true;
}
void
-nsDocument::UnlockPointer(nsIDocument* aDoc)
+nsIDocument::UnlockPointer(nsIDocument* aDoc)
{
if (!EventStateManager::sIsPointerLocked) {
return;
}
nsCOMPtr<nsIDocument> pointerLockedDoc =
do_QueryReferent(EventStateManager::sPointerLockedDoc);
if (!pointerLockedDoc || (aDoc && aDoc != pointerLockedDoc)) {
return;
}
- nsDocument* doc = static_cast<nsDocument*>(pointerLockedDoc.get());
- if (!doc->SetPointerLock(nullptr, NS_STYLE_CURSOR_AUTO)) {
+ if (!pointerLockedDoc->SetPointerLock(nullptr, NS_STYLE_CURSOR_AUTO)) {
return;
}
nsCOMPtr<Element> pointerLockedElement =
do_QueryReferent(EventStateManager::sPointerLockedElement);
- ChangePointerLockedElement(nullptr, doc, pointerLockedElement);
+ ChangePointerLockedElement(nullptr, pointerLockedDoc, pointerLockedElement);
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(pointerLockedElement,
NS_LITERAL_STRING("MozDOMPointerLock:Exited"),
true, true);
asyncDispatcher->RunDOMEventWhenSafe();
}
void
-nsIDocument::UnlockPointer(nsIDocument* aDoc)
-{
- nsDocument::UnlockPointer(aDoc);
-}
-
-void
nsIDocument::UpdateVisibilityState()
{
dom::VisibilityState oldState = mVisibilityState;
mVisibilityState = ComputeVisibilityState();
if (oldState != mVisibilityState) {
nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
NS_LITERAL_STRING("visibilitychange"),
/* bubbles = */ true,
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -313,18 +313,16 @@ public:
// Returns strong references to mBlockedTrackingNodes. (nsIDocument.h)
//
// This array contains nodes that have been blocked to prevent
// user tracking. They most likely have had their nsIChannel
// canceled by the URL classifier (Safebrowsing).
//
already_AddRefed<nsSimpleContentList> BlockedTrackingNodes() const;
- static void UnlockPointer(nsIDocument* aDoc = nullptr);
-
virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override;
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
virtual nsIDOMNode* AsDOMNode() override { return this; }
protected:
friend class nsNodeUtils;