Skip to content

Commit

Permalink
Updated inputBlockId handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Nov 16, 2014
1 parent 1c82b87 commit 0d7df7b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion embedding/embedlite/PEmbedLiteView.ipdl
Expand Up @@ -47,7 +47,7 @@ child:
UpdateFrame(FrameMetrics frame) compress;
HandleDoubleTap(nsIntPoint point);
HandleSingleTap(nsIntPoint point);
HandleLongTap(nsIntPoint point, uint64_t aInputBlockId);
HandleLongTap(nsIntPoint point, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
AcknowledgeScrollUpdate(ViewID aScrollId, uint32_t aScrollGeneration);
HandleTextEvent(nsString commit, nsString preEdit);
HandleKeyPressEvent(int domKeyCode, int gmodifiers, int charCode);
Expand Down
7 changes: 2 additions & 5 deletions embedding/embedlite/embedthread/EmbedContentController.cpp
Expand Up @@ -70,10 +70,7 @@ void EmbedContentController::HandleSingleTap(const CSSPoint& aPoint, int32_t aMo
}
}

void EmbedContentController::HandleLongTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId)
void EmbedContentController::HandleLongTap(const CSSPoint& aPoint, int32_t aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId)
{
if (MessageLoop::current() != mUILoop) {
// We have to send this message from the "UI thread" (main
Expand All @@ -84,7 +81,7 @@ void EmbedContentController::HandleLongTap(const CSSPoint& aPoint,
return;
}
if (mRenderFrame && !GetListener()->HandleLongTap(nsIntPoint(aPoint.x, aPoint.y))) {
unused << mRenderFrame->SendHandleLongTap(nsIntPoint(aPoint.x, aPoint.y), aInputBlockId);
unused << mRenderFrame->SendHandleLongTap(nsIntPoint(aPoint.x, aPoint.y), aGuid, aInputBlockId);
}
}

Expand Down
4 changes: 2 additions & 2 deletions embedding/embedlite/embedthread/EmbedContentController.h
Expand Up @@ -46,10 +46,10 @@ class EmbedContentController : public mozilla::layers::GeckoContentController
bool HitTestAPZC(mozilla::ScreenIntPoint& aPoint);
void TransformCoordinateToGecko(const mozilla::ScreenIntPoint& aPoint,
LayoutDeviceIntPoint* aRefPointOut);
void ContentReceivedTouch(const ScrollableLayerGuid& aGuid, bool aPreventDefault);
void ContentReceivedTouch(const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId, bool aPreventDefault);
nsEventStatus ReceiveInputEvent(InputData& aEvent,
mozilla::layers::ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId);
uint64_t* aInputBlockId);

mozilla::layers::APZCTreeManager* GetManager() { return mAPZC; }

Expand Down
15 changes: 10 additions & 5 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadChild.cpp
Expand Up @@ -82,6 +82,7 @@ EmbedLiteViewThreadChild::EmbedLiteViewThreadChild(const uint32_t& aId, const ui
, mViewResized(false)
, mDispatchSynthMouseEvents(true)
, mIMEComposing(false)
, mPendingTouchPreventedBlockId(0)
{
LOGT("id:%u, parentID:%u", aId, parentId);
AddRef();
Expand Down Expand Up @@ -696,7 +697,7 @@ EmbedLiteViewThreadChild::RecvHandleSingleTap(const nsIntPoint& aPoint)
}

bool
EmbedLiteViewThreadChild::RecvHandleLongTap(const nsIntPoint& aPoint, const uint64_t& aInputBlockId)
EmbedLiteViewThreadChild::RecvHandleLongTap(const nsIntPoint& aPoint, const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId)
{
for (unsigned int i = 0; i < mControllerListeners.Length(); i++) {
mControllerListeners[i]->HandleLongTap(CSSIntPoint(aPoint.x, aPoint.y), 0, ScrollableLayerGuid(0, 0, 0), aInputBlockId);
Expand All @@ -708,14 +709,17 @@ EmbedLiteViewThreadChild::RecvHandleLongTap(const nsIntPoint& aPoint, const uint
mHelper->DispatchMessageManagerMessage(NS_LITERAL_STRING("Gesture:LongTap"), data);
}

bool eventHandled = false;
if (sHandleDefaultAZPC.longTap) {
RecvMouseEvent(NS_LITERAL_STRING("contextmenu"), aPoint.x, aPoint.y,
eventHandled = RecvMouseEvent(NS_LITERAL_STRING("contextmenu"), aPoint.x, aPoint.y,
2 /* Right button */,
1 /* Click count */,
0 /* Modifiers */,
false /* Ignore root scroll frame */);
}

SendContentReceivedTouch(aGuid, aInputBlockId, eventHandled);

return true;
}

Expand Down Expand Up @@ -838,7 +842,7 @@ EmbedLiteViewThreadChild::RecvMouseEvent(const nsString& aType,
const bool& aIgnoreRootScrollFrame)
{
if (!mWebBrowser) {
return true;
return false;
}

nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNavigation);
Expand All @@ -850,7 +854,7 @@ EmbedLiteViewThreadChild::RecvMouseEvent(const nsString& aType,
utils->SendMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers,
aIgnoreRootScrollFrame, 0, 0, false, 4, &ignored);

return true;
return !ignored;
}

bool
Expand All @@ -863,8 +867,9 @@ EmbedLiteViewThreadChild::RecvInputDataTouchEvent(const ScrollableLayerGuid& aGu
nsCOMPtr<nsPIDOMWindow> outerWindow = do_GetInterface(mWebNavigation);
nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();
if (innerWindow && innerWindow->HasTouchEventListeners()) {
SendContentReceivedTouch(aGuid, aInputBlockId, nsIPresShell::gPreventMouseEvents);
SendContentReceivedTouch(aGuid, mPendingTouchPreventedBlockId, nsIPresShell::gPreventMouseEvents);
}
mPendingTouchPreventedBlockId = aInputBlockId;
static bool sDispatchMouseEvents;
static bool sDispatchMouseEventsCached = false;
if (!sDispatchMouseEventsCached) {
Expand Down
5 changes: 4 additions & 1 deletion embedding/embedlite/embedthread/EmbedLiteViewThreadChild.h
Expand Up @@ -83,7 +83,9 @@ class EmbedLiteViewThreadChild : public PEmbedLiteViewChild,
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
virtual bool RecvHandleDoubleTap(const nsIntPoint& aPoint);
virtual bool RecvHandleSingleTap(const nsIntPoint& aPoint);
virtual bool RecvHandleLongTap(const nsIntPoint& aPoint, const uint64_t& aInputBlockId);
virtual bool RecvHandleLongTap(const nsIntPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId);
virtual bool RecvAcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration);
virtual bool RecvMouseEvent(const nsString& aType,
const float& aX,
Expand Down Expand Up @@ -139,6 +141,7 @@ class EmbedLiteViewThreadChild : public PEmbedLiteViewChild,
nsRefPtr<TabChildHelper> mHelper;
bool mDispatchSynthMouseEvents;
bool mIMEComposing;
uint64_t mPendingTouchPreventedBlockId;
CancelableTask* mInitWindowTask;

nsDataHashtable<nsStringHashKey, bool/*start with key*/> mRegisteredMessages;
Expand Down
7 changes: 4 additions & 3 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadParent.cpp
Expand Up @@ -430,7 +430,8 @@ EmbedLiteViewThreadParent::ReceiveInputEvent(const mozilla::InputData& aEvent)
{
if (mController->GetManager()) {
ScrollableLayerGuid guid;
mController->ReceiveInputEvent(const_cast<mozilla::InputData&>(aEvent), &guid, nullptr);
uint64_t outInputBlockId;
mController->ReceiveInputEvent(const_cast<mozilla::InputData&>(aEvent), &guid, &outInputBlockId);
if (aEvent.mInputType == MULTITOUCH_INPUT) {
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
LayoutDeviceIntPoint lpt;
Expand All @@ -443,9 +444,9 @@ EmbedLiteViewThreadParent::ReceiveInputEvent(const mozilla::InputData& aEvent)
translatedEvent.mTouches.AppendElement(newData);
}
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_MOVE) {
unused << SendInputDataTouchMoveEvent(guid, translatedEvent, 0);
unused << SendInputDataTouchMoveEvent(guid, translatedEvent, outInputBlockId);
} else {
unused << SendInputDataTouchEvent(guid, translatedEvent, 0);
unused << SendInputDataTouchEvent(guid, translatedEvent, outInputBlockId);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion embedding/embedlite/embedthread/EmbedLiteViewThreadParent.h
Expand Up @@ -90,7 +90,9 @@ class EmbedLiteViewThreadParent : public PEmbedLiteViewParent,
const ViewID& aViewId,
const CSSRect& aRect);
virtual bool RecvSetBackgroundColor(const nscolor& aColor);
virtual bool RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId, const bool& aPreventDefault);
virtual bool RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const bool& aPreventDefault);

// IME
virtual bool RecvGetInputContext(int32_t* aIMEEnabled,
Expand Down

0 comments on commit 0d7df7b

Please sign in to comment.