зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156008 - Convert CapturingContentInfo::mContent to StaticRefPtr; r=roc
This commit is contained in:
Родитель
3a7c11fc1a
Коммит
9014085ccb
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "gfxPoint.h"
|
||||
#include "nsTHashtable.h"
|
||||
|
@ -136,7 +137,7 @@ typedef struct CapturingContentInfo {
|
|||
bool mPointerLock;
|
||||
bool mRetargetToElement;
|
||||
bool mPreventDrag;
|
||||
nsIContent* mContent;
|
||||
mozilla::StaticRefPtr<nsIContent> mContent;
|
||||
} CapturingContentInfo;
|
||||
|
||||
// d910f009-d209-74c1-6b04-30c83c051c78
|
||||
|
|
|
@ -199,7 +199,7 @@ using namespace mozilla::layout;
|
|||
|
||||
CapturingContentInfo nsIPresShell::gCaptureInfo =
|
||||
{ false /* mAllowed */, false /* mPointerLock */, false /* mRetargetToElement */,
|
||||
false /* mPreventDrag */, nullptr /* mContent */ };
|
||||
false /* mPreventDrag */ };
|
||||
nsIContent* nsIPresShell::gKeyDownTarget;
|
||||
nsClassHashtable<nsUint32HashKey, nsIPresShell::PointerCaptureInfo>* nsIPresShell::gPointerCaptureList;
|
||||
nsClassHashtable<nsUint32HashKey, nsIPresShell::PointerInfo>* nsIPresShell::gActivePointersIds;
|
||||
|
@ -3875,7 +3875,7 @@ PresShell::ClearMouseCaptureOnView(nsView* aView)
|
|||
if (view) {
|
||||
do {
|
||||
if (view == aView) {
|
||||
NS_RELEASE(gCaptureInfo.mContent);
|
||||
gCaptureInfo.mContent = nullptr;
|
||||
// the view containing the captured content likely disappeared so
|
||||
// disable capture for now.
|
||||
gCaptureInfo.mAllowed = false;
|
||||
|
@ -3890,7 +3890,7 @@ PresShell::ClearMouseCaptureOnView(nsView* aView)
|
|||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(gCaptureInfo.mContent);
|
||||
gCaptureInfo.mContent = nullptr;
|
||||
}
|
||||
|
||||
// disable mouse capture until the next mousedown as a dialog has opened
|
||||
|
@ -3909,20 +3909,20 @@ nsIPresShell::ClearMouseCapture(nsIFrame* aFrame)
|
|||
|
||||
// null frame argument means clear the capture
|
||||
if (!aFrame) {
|
||||
NS_RELEASE(gCaptureInfo.mContent);
|
||||
gCaptureInfo.mContent = nullptr;
|
||||
gCaptureInfo.mAllowed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* capturingFrame = gCaptureInfo.mContent->GetPrimaryFrame();
|
||||
if (!capturingFrame) {
|
||||
NS_RELEASE(gCaptureInfo.mContent);
|
||||
gCaptureInfo.mContent = nullptr;
|
||||
gCaptureInfo.mAllowed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::IsAncestorFrameCrossDoc(aFrame, capturingFrame)) {
|
||||
NS_RELEASE(gCaptureInfo.mContent);
|
||||
gCaptureInfo.mContent = nullptr;
|
||||
gCaptureInfo.mAllowed = false;
|
||||
}
|
||||
}
|
||||
|
@ -6357,14 +6357,14 @@ nsIPresShell::SetCapturingContent(nsIContent* aContent, uint8_t aFlags)
|
|||
return;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gCaptureInfo.mContent);
|
||||
gCaptureInfo.mContent = nullptr;
|
||||
|
||||
// only set capturing content if allowed or the CAPTURE_IGNOREALLOWED or
|
||||
// CAPTURE_POINTERLOCK flags are used.
|
||||
if ((aFlags & CAPTURE_IGNOREALLOWED) || gCaptureInfo.mAllowed ||
|
||||
(aFlags & CAPTURE_POINTERLOCK)) {
|
||||
if (aContent) {
|
||||
NS_ADDREF(gCaptureInfo.mContent = aContent);
|
||||
gCaptureInfo.mContent = aContent;
|
||||
}
|
||||
// CAPTURE_POINTERLOCK is the same as CAPTURE_RETARGETTOELEMENT & CAPTURE_IGNOREALLOWED
|
||||
gCaptureInfo.mRetargetToElement = ((aFlags & CAPTURE_RETARGETTOELEMENT) != 0) ||
|
||||
|
|
Загрузка…
Ссылка в новой задаче