Bug 942246 - Event fluffing fails to generate a click under certain conditions. r=smaug

This commit is contained in:
Vivien Nicolas 2014-01-16 15:52:27 +01:00
parent 293391fdad
commit 738ac97473

View File

@ -2621,6 +2621,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// the mouse on the nearest scrollable frame. If there isn't a scrollable
// frame, or something else is already capturing the mouse, there's no
// reason to capture.
bool hasCapturedContent = false;
if (!nsIPresShell::GetCapturingContent()) {
nsIScrollableFrame* scrollFrame =
nsLayoutUtils::GetNearestScrollableFrame(this,
@ -2630,6 +2631,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
nsIFrame* capturingFrame = do_QueryFrame(scrollFrame);
nsIPresShell::SetCapturingContent(capturingFrame->GetContent(),
CAPTURE_IGNOREALLOWED);
hasCapturedContent = true;
}
}
@ -2673,6 +2675,13 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// let the user move the caret by tapping and dragging.
if (!offsets.content->IsEditable() &&
Preferences::GetBool("browser.ignoreNativeFrameTextSelection", false)) {
// On touchables devices, mouse events are generated if the gesture is a tap.
// Such events are never going to generate a drag action, so let's release
// captured content if any.
if (hasCapturedContent) {
nsIPresShell::SetCapturingContent(nullptr, 0);
}
return fc->HandleClick(offsets.content, offsets.StartOffset(),
offsets.EndOffset(), false, false,
offsets.associateWithNext);