Bug 859305 - Stop the browser app from panning the page when the user drags an <input type=range>'s thumb in the out-of-process case. r=smaug

This commit is contained in:
Jonathan Watt 2013-04-11 10:11:54 +01:00
parent c9726527fa
commit 3ee133ed0e
3 changed files with 34 additions and 1 deletions

View File

@ -6930,7 +6930,8 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
tmpStatus = nsEventStatus_eIgnore;
nsEventDispatcher::Dispatch(targetPtr, context,
&newEvent, nullptr, &tmpStatus, aEventCB);
if (nsEventStatus_eConsumeNoDefault == tmpStatus) {
if (nsEventStatus_eConsumeNoDefault == tmpStatus ||
newEvent.mFlags.mMultipleActionsPrevented) {
preventDefault = true;
}

View File

@ -52,6 +52,34 @@ NS_QUERYFRAME_HEAD(nsRangeFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
void
nsRangeFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
// B2G's AsyncPanZoomController::ReceiveInputEvent handles touch events
// without checking whether the out-of-process document that it controls
// will handle them, unless it has been told that the document might do so.
// This is for perf reasons, otherwise it has to wait for the event to be
// round-tripped to the other process and back, delaying panning, etc.
// We must call SetHasTouchEventListeners() in order to get APZC to wait
// until the event has been round-tripped and check whether it has been
// handled, otherwise B2G will end up panning the document when the user
// tries to drag our thumb.
//
nsIPresShell* presShell = PresContext()->GetPresShell();
if (presShell) {
nsIDocument* document = presShell->GetDocument();
if (document) {
nsPIDOMWindow* innerWin = document->GetInnerWindow();
if (innerWin) {
innerWin->SetHasTouchEventListeners();
}
}
}
return nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
void
nsRangeFrame::DestroyFrom(nsIFrame* aDestructRoot)
{

View File

@ -29,6 +29,10 @@ public:
NS_DECL_FRAMEARENA_HELPERS
// nsIFrame overrides
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,