Bug 1223296 - Extract the function that dispatches a MozMouseHittest into a helper. r=rbarker

--HG--
extra : commitid : ImT31n1mpgZ
This commit is contained in:
Kartikaya Gupta 2015-11-13 15:10:51 -05:00
parent 0b254631ce
commit 820bc62753
2 changed files with 21 additions and 13 deletions

View File

@ -1338,6 +1338,24 @@ nsWindow::OnLongTapEvent(AndroidGeckoEvent *ae)
DispatchEvent(&event);
}
void
nsWindow::DispatchHitTest(const WidgetTouchEvent& aEvent)
{
if (aEvent.mMessage == eTouchStart && aEvent.touches.Length() == 1) {
// Since touch events don't get retargeted by PositionedEventTargeting.cpp
// code on Fennec, we dispatch a dummy mouse event that *does* get
// retargeted. The Fennec browser.js code can use this to activate the
// highlight element in case the this touchstart is the start of a tap.
WidgetMouseEvent hittest(true, eMouseHitTest, this,
WidgetMouseEvent::eReal);
hittest.refPoint = aEvent.touches[0]->mRefPoint;
hittest.ignoreRootScrollFrame = true;
hittest.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
nsEventStatus status;
DispatchEvent(&hittest, status);
}
}
bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
{
RefPtr<nsWindow> kungFuDeathGrip(this);
@ -1368,19 +1386,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
isDownEvent = (event.mMessage == eTouchStart);
}
if (isDownEvent && event.touches.Length() == 1) {
// Since touch events don't get retargeted by PositionedEventTargeting.cpp
// code on Fennec, we dispatch a dummy mouse event that *does* get
// retargeted. The Fennec browser.js code can use this to activate the
// highlight element in case the this touchstart is the start of a tap.
WidgetMouseEvent hittest(true, eMouseHitTest, this,
WidgetMouseEvent::eReal);
hittest.refPoint = event.touches[0]->mRefPoint;
hittest.ignoreRootScrollFrame = true;
hittest.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
nsEventStatus status;
DispatchEvent(&hittest, status);
}
DispatchHitTest(event);
// if the last event we got was a down event, then by now we know for sure whether
// this block has been default-prevented or not. if we haven't already sent the

View File

@ -22,6 +22,7 @@ struct ANPEvent;
namespace mozilla {
class AndroidGeckoEvent;
class TextComposition;
class WidgetTouchEvent;
namespace layers {
class CompositorParent;
@ -187,6 +188,7 @@ protected:
void ConfigureAPZCTreeManager() override;
void ConfigureAPZControllerThread() override;
void DispatchHitTest(const mozilla::WidgetTouchEvent& aEvent);
already_AddRefed<GeckoContentController> CreateRootContentController() override;