Bug 1700245 - Split PresShell::ClearMouseCapture into two functions, one takes `nsIFrame`, the other takes no argument. r=tnikkel

Depends on D119067

Differential Revision: https://phabricator.services.mozilla.com/D119068
This commit is contained in:
Hiroyuki Ikezoe 2021-07-06 08:58:55 +00:00
Родитель 6160917fd4
Коммит 1fa23c1c89
3 изменённых файлов: 16 добавлений и 7 удалений

Просмотреть файл

@ -3777,16 +3777,22 @@ void PresShell::ClearMouseCaptureOnView(nsView* aView) {
AllowMouseCapture(false);
}
void PresShell::ClearMouseCapture(nsIFrame* aFrame) {
void PresShell::ClearMouseCapture() {
nsIContent* capturingContent = GetCapturingContent();
if (!capturingContent) {
AllowMouseCapture(false);
return;
}
// null frame argument means clear the capture
if (!aFrame) {
ReleaseCapturingContent();
ReleaseCapturingContent();
AllowMouseCapture(false);
}
void PresShell::ClearMouseCapture(nsIFrame* aFrame) {
MOZ_ASSERT(aFrame);
nsIContent* capturingContent = GetCapturingContent();
if (!capturingContent) {
AllowMouseCapture(false);
return;
}
@ -7772,7 +7778,7 @@ PresShell::EventHandler::ComputeRootFrameToHandleEventWithCapturingContent(
// If the BrowsingContext is active, look for a scrolling container.
BrowsingContext* bc = GetPresContext()->Document()->GetBrowsingContext();
if (!bc || !bc->IsActive()) {
ClearMouseCapture(nullptr);
ClearMouseCapture();
*aIsCapturingContentIgnored = true;
return aRootFrameToHandleEvent;
}
@ -9804,7 +9810,7 @@ bool PresShell::ProcessReflowCommands(bool aInterruptible) {
void PresShell::WindowSizeMoveDone() {
if (mPresContext) {
EventStateManager::ClearGlobalActiveContent(nullptr);
ClearMouseCapture(nullptr);
ClearMouseCapture();
}
}

Просмотреть файл

@ -204,6 +204,9 @@ class PresShell final : public nsStubDocumentObserver,
// clears that capture.
static void ClearMouseCapture(nsIFrame* aFrame);
// Clear the capture content if it exists in this process.
static void ClearMouseCapture();
#ifdef ACCESSIBILITY
/**
* Return the document accessible for this PresShell if there is one.

Просмотреть файл

@ -264,7 +264,7 @@ nsBaseDragService::InvokeDragSession(
// capture. However, this gets in the way of determining drag
// feedback for things like trees because the event coordinates
// are in the wrong coord system, so turn off mouse capture.
PresShell::ClearMouseCapture(nullptr);
PresShell::ClearMouseCapture();
if (mSessionIsSynthesizedForTests) {
mDoingDrag = true;