Bug 964421 - Add a mechanism to HandleLongTap(Up) to allow content to preventDefault touches and stop panning while long tapping. r=kats
This commit is contained in:
@@ -356,21 +356,21 @@ child:
|
||||
* the scroll offset. This message is expected to round-trip back to
|
||||
* ZoomToRect() with a rect indicating where we should zoom to.
|
||||
*/
|
||||
HandleDoubleTap(CSSIntPoint point);
|
||||
HandleDoubleTap(CSSIntPoint point, ScrollableLayerGuid aGuid);
|
||||
|
||||
/**
|
||||
* Requests handling of a single tap. |point| is in CSS pixels, relative to
|
||||
* the scroll offset. This message is expected to send a "mousedown" and
|
||||
* "mouseup" series of events at this point.
|
||||
*/
|
||||
HandleSingleTap(CSSIntPoint point);
|
||||
HandleSingleTap(CSSIntPoint point, ScrollableLayerGuid aGuid);
|
||||
|
||||
/**
|
||||
* Requests handling of a long tap. |point| is in CSS pixels, relative to
|
||||
* the scroll offset. This message is expected to send a "contextmenu"
|
||||
* events at this point.
|
||||
*/
|
||||
HandleLongTap(CSSIntPoint point);
|
||||
HandleLongTap(CSSIntPoint point, ScrollableLayerGuid aGuid);
|
||||
|
||||
/**
|
||||
* Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
|
||||
@@ -379,7 +379,7 @@ child:
|
||||
* this message is expected to generate a "mousedown" and "mouseup"
|
||||
* series of events
|
||||
*/
|
||||
HandleLongTapUp(CSSIntPoint point);
|
||||
HandleLongTapUp(CSSIntPoint point, ScrollableLayerGuid aGuid);
|
||||
|
||||
/**
|
||||
* Notifies the child that the parent has begun or finished transforming
|
||||
|
||||
@@ -1592,7 +1592,7 @@ TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvHandleDoubleTap(const CSSIntPoint& aPoint)
|
||||
TabChild::RecvHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (!mGlobal || !mTabChildGlobal) {
|
||||
return true;
|
||||
@@ -1609,7 +1609,7 @@ TabChild::RecvHandleDoubleTap(const CSSIntPoint& aPoint)
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvHandleSingleTap(const CSSIntPoint& aPoint)
|
||||
TabChild::RecvHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (!mGlobal || !mTabChildGlobal) {
|
||||
return true;
|
||||
@@ -1626,7 +1626,7 @@ TabChild::RecvHandleSingleTap(const CSSIntPoint& aPoint)
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint)
|
||||
TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (!mGlobal || !mTabChildGlobal) {
|
||||
return true;
|
||||
@@ -1636,18 +1636,20 @@ TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint)
|
||||
DispatchMouseEvent(NS_LITERAL_STRING("contextmenu"), aPoint, 2, 1, 0, false,
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
|
||||
|
||||
SendContentReceivedTouch(aGuid, mContextMenuHandled);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvHandleLongTapUp(const CSSIntPoint& aPoint)
|
||||
TabChild::RecvHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (mContextMenuHandled) {
|
||||
mContextMenuHandled = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
RecvHandleSingleTap(aPoint);
|
||||
RecvHandleSingleTap(aPoint, aGuid);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -222,10 +222,14 @@ public:
|
||||
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
|
||||
virtual bool RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
|
||||
const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleDoubleTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleSingleTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleLongTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleLongTapUp(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleSingleTap(const CSSIntPoint& aPoint,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleLongTap(const CSSIntPoint& aPoint,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
virtual bool RecvHandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
virtual bool RecvNotifyTransformBegin(const ViewID& aViewId) MOZ_OVERRIDE;
|
||||
virtual bool RecvNotifyTransformEnd(const ViewID& aViewId) MOZ_OVERRIDE;
|
||||
virtual bool RecvActivate() MOZ_OVERRIDE;
|
||||
|
||||
@@ -514,32 +514,40 @@ TabParent::AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScr
|
||||
}
|
||||
}
|
||||
|
||||
void TabParent::HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
void TabParent::HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid &aGuid)
|
||||
{
|
||||
if (!mIsDestroyed) {
|
||||
unused << SendHandleDoubleTap(aPoint);
|
||||
unused << SendHandleDoubleTap(aPoint, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
void TabParent::HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
void TabParent::HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid &aGuid)
|
||||
{
|
||||
// TODO Send the modifier data to TabChild for use in mouse events.
|
||||
if (!mIsDestroyed) {
|
||||
unused << SendHandleSingleTap(aPoint);
|
||||
unused << SendHandleSingleTap(aPoint, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
void TabParent::HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
void TabParent::HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid &aGuid)
|
||||
{
|
||||
if (!mIsDestroyed) {
|
||||
unused << SendHandleLongTap(aPoint);
|
||||
unused << SendHandleLongTap(aPoint, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
void TabParent::HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
void TabParent::HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid &aGuid)
|
||||
{
|
||||
if (!mIsDestroyed) {
|
||||
unused << SendHandleLongTapUp(aPoint);
|
||||
unused << SendHandleLongTapUp(aPoint, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,40 +725,40 @@ CSSIntPoint TabParent::AdjustTapToChildWidget(const CSSIntPoint& aPoint)
|
||||
aPoint.y + presContext->DevPixelsToIntCSSPixels(mChildProcessOffsetAtTouchStart.y));
|
||||
}
|
||||
|
||||
bool TabParent::SendHandleSingleTap(const CSSIntPoint& aPoint)
|
||||
bool TabParent::SendHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PBrowserParent::SendHandleSingleTap(AdjustTapToChildWidget(aPoint));
|
||||
return PBrowserParent::SendHandleSingleTap(AdjustTapToChildWidget(aPoint), aGuid);
|
||||
}
|
||||
|
||||
bool TabParent::SendHandleLongTap(const CSSIntPoint& aPoint)
|
||||
bool TabParent::SendHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PBrowserParent::SendHandleLongTap(AdjustTapToChildWidget(aPoint));
|
||||
return PBrowserParent::SendHandleLongTap(AdjustTapToChildWidget(aPoint), aGuid);
|
||||
}
|
||||
|
||||
bool TabParent::SendHandleLongTapUp(const CSSIntPoint& aPoint)
|
||||
bool TabParent::SendHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PBrowserParent::SendHandleLongTapUp(AdjustTapToChildWidget(aPoint));
|
||||
return PBrowserParent::SendHandleLongTapUp(AdjustTapToChildWidget(aPoint), aGuid);
|
||||
}
|
||||
|
||||
bool TabParent::SendHandleDoubleTap(const CSSIntPoint& aPoint)
|
||||
bool TabParent::SendHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PBrowserParent::SendHandleDoubleTap(AdjustTapToChildWidget(aPoint));
|
||||
return PBrowserParent::SendHandleDoubleTap(AdjustTapToChildWidget(aPoint), aGuid);
|
||||
}
|
||||
|
||||
bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
|
||||
|
||||
@@ -207,10 +207,18 @@ public:
|
||||
void UpdateDimensions(const nsRect& rect, const nsIntSize& size);
|
||||
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
|
||||
void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration);
|
||||
void HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
void HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
void HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
void HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
void HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid);
|
||||
void HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid);
|
||||
void HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid);
|
||||
void HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid);
|
||||
void NotifyTransformBegin(ViewID aViewId);
|
||||
void NotifyTransformEnd(ViewID aViewId);
|
||||
void Activate();
|
||||
@@ -230,10 +238,10 @@ public:
|
||||
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& event);
|
||||
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
|
||||
bool SendRealTouchEvent(WidgetTouchEvent& event);
|
||||
bool SendHandleSingleTap(const CSSIntPoint& aPoint);
|
||||
bool SendHandleLongTap(const CSSIntPoint& aPoint);
|
||||
bool SendHandleLongTapUp(const CSSIntPoint& aPoint);
|
||||
bool SendHandleDoubleTap(const CSSIntPoint& aPoint);
|
||||
bool SendHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
|
||||
bool SendHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
|
||||
bool SendHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
|
||||
bool SendHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
|
||||
|
||||
virtual PDocumentRendererParent*
|
||||
AllocPDocumentRendererParent(const nsRect& documentRect,
|
||||
|
||||
@@ -559,12 +559,7 @@ nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent)
|
||||
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
|
||||
mTouchQueue.AppendElement(multiTouchInput);
|
||||
|
||||
if (!mContentResponseTimeoutTask) {
|
||||
mContentResponseTimeoutTask =
|
||||
NewRunnableMethod(this, &AsyncPanZoomController::TimeoutContentResponse);
|
||||
|
||||
PostDelayedTask(mContentResponseTimeoutTask, gContentResponseTimeout);
|
||||
}
|
||||
SetContentResponseTimer();
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
@@ -936,7 +931,9 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent)
|
||||
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
|
||||
CSSIntPoint geckoScreenPoint;
|
||||
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
|
||||
controller->HandleLongTap(geckoScreenPoint, modifiers);
|
||||
SetState(WAITING_CONTENT_RESPONSE);
|
||||
SetContentResponseTimer();
|
||||
controller->HandleLongTap(geckoScreenPoint, modifiers, GetGuid());
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
@@ -950,7 +947,7 @@ nsEventStatus AsyncPanZoomController::OnLongPressUp(const TapGestureInput& aEven
|
||||
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
|
||||
CSSIntPoint geckoScreenPoint;
|
||||
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
|
||||
controller->HandleLongTapUp(geckoScreenPoint, modifiers);
|
||||
controller->HandleLongTapUp(geckoScreenPoint, modifiers, GetGuid());
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
@@ -966,7 +963,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
|
||||
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
|
||||
CSSIntPoint geckoScreenPoint;
|
||||
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
|
||||
controller->HandleSingleTap(geckoScreenPoint, modifiers);
|
||||
controller->HandleSingleTap(geckoScreenPoint, modifiers, GetGuid());
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
@@ -980,7 +977,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput
|
||||
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
|
||||
CSSIntPoint geckoScreenPoint;
|
||||
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
|
||||
controller->HandleSingleTap(geckoScreenPoint, modifiers);
|
||||
controller->HandleSingleTap(geckoScreenPoint, modifiers, GetGuid());
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
@@ -995,7 +992,7 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent)
|
||||
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
|
||||
CSSIntPoint geckoScreenPoint;
|
||||
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
|
||||
controller->HandleDoubleTap(geckoScreenPoint, modifiers);
|
||||
controller->HandleDoubleTap(geckoScreenPoint, modifiers, GetGuid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1929,6 +1926,15 @@ bool AsyncPanZoomController::AllowZoom() {
|
||||
&& !(mFrameMetrics.GetDisableScrollingX() || mFrameMetrics.GetDisableScrollingY());
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::SetContentResponseTimer() {
|
||||
if (!mContentResponseTimeoutTask) {
|
||||
mContentResponseTimeoutTask =
|
||||
NewRunnableMethod(this, &AsyncPanZoomController::TimeoutContentResponse);
|
||||
|
||||
PostDelayedTask(mContentResponseTimeoutTask, gContentResponseTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::TimeoutContentResponse() {
|
||||
mContentResponseTimeoutTask = nullptr;
|
||||
ContentReceivedTouch(false);
|
||||
|
||||
@@ -508,6 +508,15 @@ protected:
|
||||
*/
|
||||
const FrameMetrics& GetFrameMetrics();
|
||||
|
||||
/**
|
||||
* Sets the timer for content response to a series of touch events, if it
|
||||
* hasn't been already. This is to prevent us from batching up touch events
|
||||
* indefinitely in the case that content doesn't respond with whether or not
|
||||
* it wants to preventDefault. When the timer is fired, the touch event queue
|
||||
* will be flushed.
|
||||
*/
|
||||
void SetContentResponseTimer();
|
||||
|
||||
/**
|
||||
* Timeout function for content response. This should be called on a timer
|
||||
* after we get our first touch event in a batch, under the condition that we
|
||||
|
||||
@@ -42,27 +42,35 @@ public:
|
||||
* AsyncPanZoomController::ZoomToRect with the dimensions that we want to zoom
|
||||
* to.
|
||||
*/
|
||||
virtual void HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers) = 0;
|
||||
virtual void HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Requests handling a single tap. |aPoint| is in CSS pixels, relative to the
|
||||
* current scroll offset. This should simulate and send to content a mouse
|
||||
* button down, then mouse button up at |aPoint|.
|
||||
*/
|
||||
virtual void HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers) = 0;
|
||||
virtual void HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Requests handling a long tap. |aPoint| is in CSS pixels, relative to the
|
||||
* current scroll offset.
|
||||
*/
|
||||
virtual void HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers) = 0;
|
||||
virtual void HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
|
||||
* relative to the current scroll offset. HandleLongTapUp will always be
|
||||
* preceeded by HandleLongTap
|
||||
*/
|
||||
virtual void HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers) = 0;
|
||||
virtual void HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Requests sending a mozbrowserasyncscroll domevent to embedder.
|
||||
|
||||
@@ -31,10 +31,10 @@ class MockContentController : public GeckoContentController {
|
||||
public:
|
||||
MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&));
|
||||
MOCK_METHOD2(AcknowledgeScrollUpdate, void(const FrameMetrics::ViewID&, const uint32_t& aScrollGeneration));
|
||||
MOCK_METHOD2(HandleDoubleTap, void(const CSSIntPoint&, int32_t));
|
||||
MOCK_METHOD2(HandleSingleTap, void(const CSSIntPoint&, int32_t));
|
||||
MOCK_METHOD2(HandleLongTap, void(const CSSIntPoint&, int32_t));
|
||||
MOCK_METHOD2(HandleLongTapUp, void(const CSSIntPoint&, int32_t));
|
||||
MOCK_METHOD3(HandleDoubleTap, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
|
||||
MOCK_METHOD3(HandleSingleTap, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
|
||||
MOCK_METHOD3(HandleLongTap, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
|
||||
MOCK_METHOD3(HandleLongTapUp, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
|
||||
MOCK_METHOD3(SendAsyncScrollDOMEvent, void(bool aIsRoot, const CSSRect &aContentRect, const CSSSize &aScrollableSize));
|
||||
MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs));
|
||||
};
|
||||
@@ -596,7 +596,7 @@ TEST(AsyncPanZoomController, ShortPress) {
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
apzc->UpdateZoomConstraints(ZoomConstraints(false, CSSToScreenScale(1.0), CSSToScreenScale(1.0)));
|
||||
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSIntPoint(10, 10), 0)).Times(1);
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
|
||||
|
||||
int time = 0;
|
||||
nsEventStatus status = ApzcTap(apzc, 10, 10, time, 100);
|
||||
@@ -615,7 +615,7 @@ TEST(AsyncPanZoomController, MediumPress) {
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
apzc->UpdateZoomConstraints(ZoomConstraints(false, CSSToScreenScale(1.0), CSSToScreenScale(1.0)));
|
||||
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSIntPoint(10, 10), 0)).Times(1);
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
|
||||
|
||||
int time = 0;
|
||||
nsEventStatus status = ApzcTap(apzc, 10, 10, time, 400);
|
||||
@@ -642,8 +642,8 @@ TEST(AsyncPanZoomController, LongPress) {
|
||||
Task* t = mcc->GetDelayedTask();
|
||||
|
||||
EXPECT_TRUE(nullptr != t);
|
||||
EXPECT_CALL(*mcc, HandleLongTap(CSSIntPoint(10, 10), 0)).Times(1);
|
||||
EXPECT_CALL(*mcc, HandleLongTapUp(CSSIntPoint(10, 10), 0)).Times(1);
|
||||
EXPECT_CALL(*mcc, HandleLongTap(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
|
||||
EXPECT_CALL(*mcc, HandleLongTapUp(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
|
||||
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(AtLeast(1));
|
||||
|
||||
// Manually invoke the longpress while the touch is currently down.
|
||||
|
||||
@@ -540,7 +540,8 @@ public:
|
||||
}
|
||||
|
||||
virtual void HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers) MOZ_OVERRIDE
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
|
||||
{
|
||||
if (MessageLoop::current() != mUILoop) {
|
||||
// We have to send this message from the "UI thread" (main
|
||||
@@ -548,17 +549,18 @@ public:
|
||||
mUILoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &RemoteContentController::HandleDoubleTap,
|
||||
aPoint, aModifiers));
|
||||
aPoint, aModifiers, aGuid));
|
||||
return;
|
||||
}
|
||||
if (mRenderFrame) {
|
||||
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
|
||||
browser->HandleDoubleTap(aPoint, aModifiers);
|
||||
browser->HandleDoubleTap(aPoint, aModifiers, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers) MOZ_OVERRIDE
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
|
||||
{
|
||||
if (MessageLoop::current() != mUILoop) {
|
||||
// We have to send this message from the "UI thread" (main
|
||||
@@ -566,17 +568,18 @@ public:
|
||||
mUILoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &RemoteContentController::HandleSingleTap,
|
||||
aPoint, aModifiers));
|
||||
aPoint, aModifiers, aGuid));
|
||||
return;
|
||||
}
|
||||
if (mRenderFrame) {
|
||||
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
|
||||
browser->HandleSingleTap(aPoint, aModifiers);
|
||||
browser->HandleSingleTap(aPoint, aModifiers, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers) MOZ_OVERRIDE
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
|
||||
{
|
||||
if (MessageLoop::current() != mUILoop) {
|
||||
// We have to send this message from the "UI thread" (main
|
||||
@@ -584,17 +587,18 @@ public:
|
||||
mUILoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &RemoteContentController::HandleLongTap,
|
||||
aPoint, aModifiers));
|
||||
aPoint, aModifiers, aGuid));
|
||||
return;
|
||||
}
|
||||
if (mRenderFrame) {
|
||||
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
|
||||
browser->HandleLongTap(aPoint, aModifiers);
|
||||
browser->HandleLongTap(aPoint, aModifiers, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers) MOZ_OVERRIDE
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
|
||||
{
|
||||
if (MessageLoop::current() != mUILoop) {
|
||||
// We have to send this message from the "UI thread" (main
|
||||
@@ -602,12 +606,12 @@ public:
|
||||
mUILoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &RemoteContentController::HandleLongTapUp,
|
||||
aPoint, aModifiers));
|
||||
aPoint, aModifiers, aGuid));
|
||||
return;
|
||||
}
|
||||
if (mRenderFrame) {
|
||||
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
|
||||
browser->HandleLongTapUp(aPoint, aModifiers);
|
||||
browser->HandleLongTapUp(aPoint, aModifiers, aGuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1938,7 +1938,9 @@ AndroidBridge::AcknowledgeScrollUpdate(const mozilla::layers::FrameMetrics::View
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
AndroidBridge::HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
|
||||
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
|
||||
@@ -1946,7 +1948,9 @@ AndroidBridge::HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
AndroidBridge::HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
// TODO Send the modifier data to Gecko for use in mouse events.
|
||||
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
|
||||
@@ -1955,7 +1959,9 @@ AndroidBridge::HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
AndroidBridge::HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
|
||||
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
|
||||
@@ -1963,7 +1969,9 @@ AndroidBridge::HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
AndroidBridge::HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -433,10 +433,18 @@ public:
|
||||
void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
|
||||
void AcknowledgeScrollUpdate(const mozilla::layers::FrameMetrics::ViewID& aScrollId,
|
||||
const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
|
||||
void HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE;
|
||||
void HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE;
|
||||
void HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE;
|
||||
void HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE;
|
||||
void HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
void HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
void HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
void HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
|
||||
void SendAsyncScrollDOMEvent(bool aIsRoot,
|
||||
const CSSRect& aContentRect,
|
||||
const CSSSize& aScrollableSize) MOZ_OVERRIDE;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace widget {
|
||||
class ParentProcessController : public mozilla::layers::GeckoContentController
|
||||
{
|
||||
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
|
||||
public:
|
||||
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
|
||||
@@ -22,10 +23,18 @@ public:
|
||||
virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE;
|
||||
|
||||
// No-ops
|
||||
virtual void HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE {}
|
||||
virtual void HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE {}
|
||||
virtual void HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE {}
|
||||
virtual void HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers) MOZ_OVERRIDE {}
|
||||
virtual void HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
|
||||
virtual void HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
|
||||
virtual void HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
|
||||
virtual void HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
|
||||
|
||||
virtual void SendAsyncScrollDOMEvent(bool aIsRoot,
|
||||
const CSSRect &aContentRect,
|
||||
|
||||
@@ -244,22 +244,30 @@ APZController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
APZController::HandleDoubleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
APZController::HandleSingleTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
APZController::HandleLongTap(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleLongTapUp(const CSSIntPoint& aPoint, int32_t aModifiers)
|
||||
APZController::HandleLongTapUp(const CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,18 @@ public:
|
||||
// GeckoContentController interface
|
||||
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics);
|
||||
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration);
|
||||
virtual void HandleDoubleTap(const mozilla::CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
virtual void HandleSingleTap(const mozilla::CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
virtual void HandleLongTap(const mozilla::CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
virtual void HandleLongTapUp(const mozilla::CSSIntPoint& aPoint, int32_t aModifiers);
|
||||
virtual void HandleDoubleTap(const mozilla::CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void HandleSingleTap(const mozilla::CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void HandleLongTap(const mozilla::CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void HandleLongTapUp(const mozilla::CSSIntPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize);
|
||||
virtual void PostDelayedTask(Task* aTask, int aDelayMs);
|
||||
virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints);
|
||||
|
||||
Reference in New Issue
Block a user