Bug 1306644 - Have TabParent call TakeFocusForClickFromTap rather than doing it over a sync IPC roundtrip. r=dvander
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 30 Sep 2016 15:03:42 -0400
changeset 316089 9eb7d99a0bb26a885ab865f245934caad0b4aec7
parent 316088 1c8ed959072ab9eb66ca02ad77003a33dd210a5f
child 316090 dd46c03a458c5054e5930a75b7ec0a3da5e9e359
push id30759
push userphilringnalda@gmail.com
push dateSat, 01 Oct 2016 06:25:09 +0000
treeherdermozilla-central@fcc62bbf09ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1306644
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1306644 - Have TabParent call TakeFocusForClickFromTap rather than doing it over a sync IPC roundtrip. r=dvander MozReview-Commit-ID: 4anzBR6YoA
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
layout/ipc/PRenderFrame.ipdl
layout/ipc/RenderFrameParent.cpp
layout/ipc/RenderFrameParent.h
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1773,30 +1773,24 @@ TabChild::RecvHandleTap(const GeckoConte
   if (!presShell->GetPresContext()) {
     return true;
   }
   CSSToLayoutDeviceScale scale(presShell->GetPresContext()->CSSToDevPixelScale());
   CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint / scale, aGuid);
 
   switch (aType) {
   case GeckoContentController::TapType::eSingleTap:
-    if (mRemoteFrame) {
-      mRemoteFrame->SendTakeFocusForClickFromTap();
-    }
     if (mGlobal && mTabChildGlobal) {
       mAPZEventState->ProcessSingleTap(point, scale, aModifiers, aGuid, 1);
     }
     break;
   case GeckoContentController::TapType::eDoubleTap:
     HandleDoubleTap(point, aModifiers, aGuid);
     break;
   case GeckoContentController::TapType::eSecondTap:
-    if (mRemoteFrame) {
-      mRemoteFrame->SendTakeFocusForClickFromTap();
-    }
     if (mGlobal && mTabChildGlobal) {
       mAPZEventState->ProcessSingleTap(point, scale, aModifiers, aGuid, 2);
     }
     break;
   case GeckoContentController::TapType::eLongTap:
     if (mGlobal && mTabChildGlobal) {
       mAPZEventState->ProcessLongTap(presShell, point, scale, aModifiers, aGuid,
           aInputBlockId);
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1691,16 +1691,20 @@ TabParent::SendHandleTap(TapType aType,
                          const LayoutDevicePoint& aPoint,
                          Modifiers aModifiers,
                          const ScrollableLayerGuid& aGuid,
                          uint64_t aInputBlockId)
 {
   if (mIsDestroyed) {
     return false;
   }
+  if ((aType == TapType::eSingleTap || aType == TapType::eSecondTap) &&
+      GetRenderFrame()) {
+    GetRenderFrame()->TakeFocusForClickFromTap();
+  }
   LayoutDeviceIntPoint offset = GetChildProcessOffset();
   return PBrowserParent::SendHandleTap(aType, aPoint + offset, aModifiers, aGuid,
       aInputBlockId);
 }
 
 bool
 TabParent::RecvSyncMessage(const nsString& aMessage,
                            const ClonedMessageData& aData,
--- a/layout/ipc/PRenderFrame.ipdl
+++ b/layout/ipc/PRenderFrame.ipdl
@@ -27,15 +27,13 @@ sync protocol PRenderFrame
 {
     manager PBrowser;
 
 parent:
     async NotifyCompositorTransaction();
 
     async UpdateHitRegion(nsRegion aRegion);
 
-    sync TakeFocusForClickFromTap();
-
     async __delete__();
 };
 
 } // namespace layout
 } // namespace mozilla
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -321,23 +321,16 @@ RenderFrameParent::TakeFocusForClickFrom
   if (!element) {
     return;
   }
   fm->SetFocus(element, nsIFocusManager::FLAG_BYMOUSE |
                         nsIFocusManager::FLAG_BYTOUCH |
                         nsIFocusManager::FLAG_NOSCROLL);
 }
 
-bool
-RenderFrameParent::RecvTakeFocusForClickFromTap()
-{
-  TakeFocusForClickFromTap();
-  return true;
-}
-
 void
 RenderFrameParent::EnsureLayersConnected()
 {
   RefPtr<LayerManager> lm = GetFrom(mFrameLoader);
   if (!lm) {
     return;
   }
 
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -88,18 +88,16 @@ public:
 
 protected:
   void ActorDestroy(ActorDestroyReason why) override;
 
   virtual bool RecvNotifyCompositorTransaction() override;
 
   virtual bool RecvUpdateHitRegion(const nsRegion& aRegion) override;
 
-  virtual bool RecvTakeFocusForClickFromTap() override;
-
 private:
   void TriggerRepaint();
   void DispatchEventForPanZoomController(const InputEvent& aEvent);
 
   uint64_t GetLayerTreeId() const;
 
   // When our child frame is pushing transactions directly to the
   // compositor, this is the ID of its layer tree in the compositor's