Bug 1151152 - Change behavior when pointer is dragged out of the document. r=smaug

This commit is contained in:
Maksim Lebedev 2015-06-15 10:27:00 -04:00
parent 6f60ab366d
commit cbb7b8d347
2 changed files with 19 additions and 17 deletions

View File

@ -7090,9 +7090,11 @@ PresShell::HandleEvent(nsIFrame* aFrame,
return NS_OK;
}
nsIContent* capturingContent =
(aEvent->HasMouseEventMessage() ||
aEvent->mClass == eWheelEventClass ? GetCapturingContent() : nullptr);
nsIContent* capturingContent = ((aEvent->mClass == ePointerEventClass ||
aEvent->mClass == eWheelEventClass ||
aEvent->HasMouseEventMessage())
? GetCapturingContent()
: nullptr);
nsCOMPtr<nsIDocument> retargetEventDoc;
if (!aDontRetargetEvents) {
@ -7500,19 +7502,19 @@ PresShell::HandleEvent(nsIFrame* aFrame,
//
// Note, currently for backwards compatibility we don't forward mouse events
// to the active document when mouse is over some subdocument.
EventStateManager* activeESM =
EventStateManager::GetActiveEventStateManager();
if (activeESM && aEvent->HasMouseEventMessage() &&
activeESM != shell->GetPresContext()->EventStateManager() &&
static_cast<EventStateManager*>(activeESM)->GetPresContext()) {
nsIPresShell* activeShell =
static_cast<EventStateManager*>(activeESM)->GetPresContext()->
GetPresShell();
if (activeShell &&
nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(),
shell->GetDocument())) {
shell = static_cast<PresShell*>(activeShell);
frame = shell->GetRootFrame();
if (EventStateManager* activeESM = EventStateManager::GetActiveEventStateManager()) {
if (aEvent->mClass == ePointerEventClass || aEvent->HasMouseEventMessage()) {
if (activeESM != shell->GetPresContext()->EventStateManager()) {
if (nsPresContext* activeContext = activeESM->GetPresContext()) {
if (nsIPresShell* activeShell = activeContext->GetPresShell()) {
if (nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(),
shell->GetDocument())) {
shell = static_cast<PresShell*>(activeShell);
frame = shell->GetRootFrame();
}
}
}
}
}
}

View File

@ -11,7 +11,7 @@
<script>
<![CDATA[
SimpleTest.expectAssertions(6);
SimpleTest.expectAssertions(12);
SimpleTest.waitForExplicitFinish();