Bug 1177943 - Part 5. Add IPC for e10s support. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 01 Apr 2016 15:06:29 +0900
changeset 346487 b19dab7bacaa4426d1bf2bd27e8d770d44a913f4
parent 346486 1a7d78de79a42ef33bad7b498d8ccc1c13c96c14
child 517461 b63bb7d86f48362ebb7511df243288675f8fe285
push id14395
push userm_kato@ga2.so-net.ne.jp
push dateFri, 01 Apr 2016 06:23:11 +0000
reviewersmasayuki
bugs1177943
milestone48.0a1
Bug 1177943 - Part 5. Add IPC for e10s support. r?masayuki Implement LookUpDictionary to PuppetWidget and PBrowser for e10s. MozReview-Commit-ID: 44SrfuLJoCF
dom/ipc/PBrowser.ipdl
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
widget/PuppetWidget.cpp
widget/PuppetWidget.h
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -62,16 +62,17 @@ using mozilla::WritingMode from "mozilla
 using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
 using nsIWidget::TouchPointerState from "nsIWidget.h";
 using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
 using class mozilla::dom::ipc::StructuredCloneData from "ipc/IPCMessageUtils.h";
 using mozilla::EventMessage from "mozilla/EventForwards.h";
 using nsEventStatus from "mozilla/EventForwards.h";
 using nsSizeMode from "nsIWidgetListener.h";
 using mozilla::widget::CandidateWindowPosition from "ipc/nsGUIEventIPC.h";
+using mozilla::FontRange from "ipc/nsGUIEventIPC.h";
 
 namespace mozilla {
 namespace dom {
 
 struct NativeKeyBinding
 {
   CommandInt[] singleLineCommands;
   CommandInt[] multiLineCommands;
@@ -424,16 +425,27 @@ parent:
      * Brings up the auth prompt dialog.
      * Called when this is the PBrowserParent for a nested remote iframe.
      * aCallbackId corresponds to an nsIAuthPromptCallback that lives in the
      * root process.  It will be passed back to the root process with either the
      * OnAuthAvailable or OnAuthCancelled message.
      */
     async AsyncAuthPrompt(nsCString uri, nsString realm, uint64_t aCallbackId);
 
+    /**
+     * Look up dictionary by selected word for OSX
+     *
+     * @param aText       The word to look up
+     * @param aFontRange  Text decoration of aText
+     * @param aIsVertical true if vertical layout
+     * @param aPoint      Top-left point of the word
+     */
+    async LookUpDictionary(nsString aText, FontRange[] aFontRanges,
+                           bool aIsVertical, LayoutDeviceIntPoint aPoint);
+
     async __delete__();
 
     async ReplyKeyEvent(WidgetKeyboardEvent event);
 
     async DispatchAfterKeyboardEvent(WidgetKeyboardEvent event);
 
     sync RequestNativeKeyBindings(WidgetKeyboardEvent event)
         returns (MaybeNativeKeyBinding bindings);
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3324,16 +3324,32 @@ TabParent::AudioChannelChangeNotificatio
     if (window == win) {
       break;
     }
 
     window = win;
   }
 }
 
+bool
+TabParent::RecvLookUpDictionary(const nsString& aText,
+                                nsTArray<FontRange>&& aFontRangeArray,
+                                const bool& aIsVertical,
+                                const LayoutDeviceIntPoint& aPoint)
+{
+  nsCOMPtr<nsIWidget> widget = GetWidget();
+  if (!widget) {
+    return true;
+  }
+
+  widget->LookUpDictionary(aText, aFontRangeArray, aIsVertical,
+                           aPoint - GetChildProcessOffset());
+  return true;
+}
+
 NS_IMETHODIMP
 FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
 {
   nsAuthInformationHolder* holder =
     static_cast<nsAuthInformationHolder*>(aAuthInfo);
 
   if (!net::gNeckoChild->SendOnAuthAvailable(mCallbackId,
                                              holder->User(),
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -249,16 +249,22 @@ public:
                                    const nsString& aType,
                                    const nsString& aInputmode,
                                    const nsString& aActionHint,
                                    const int32_t& aCause,
                                    const int32_t& aFocusChange) override;
 
   virtual bool RecvRequestFocus(const bool& aCanRaise) override;
 
+  virtual bool RecvLookUpDictionary(
+                 const nsString& aText,
+                 nsTArray<mozilla::FontRange>&& aFontRangeArray,
+                 const bool& aIsVertical,
+                 const LayoutDeviceIntPoint& aPoint) override;
+
   virtual bool
   RecvEnableDisableCommands(const nsString& aAction,
                             nsTArray<nsCString>&& aEnabledCommands,
                             nsTArray<nsCString>&& aDisabledCommands) override;
 
   virtual bool
   RecvSetCursor(const uint32_t& aValue, const bool& aForce) override;
 
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -1417,16 +1417,30 @@ PuppetWidget::ZoomToRect(const uint32_t&
 {
   if (!mTabChild) {
     return;
   }
 
   mTabChild->ZoomToRect(aPresShellId, aViewId, aRect, aFlags);
 }
 
+void
+PuppetWidget::LookUpDictionary(
+                const nsString& aText,
+                const nsTArray<mozilla::FontRange>& aFontRangeArray,
+                const bool aIsVertical,
+                const LayoutDeviceIntPoint& aPoint)
+{
+  if (!mTabChild) {
+    return;
+  }
+
+  mTabChild->SendLookUpDictionary(aText, aFontRangeArray, aIsVertical, aPoint);
+}
+
 bool
 PuppetWidget::HasPendingInputEvent()
 {
   if (!mTabChild) {
     return false;
   }
 
   static const IPC::Message::msgid_t kInputEvents[] = {
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -257,16 +257,22 @@ public:
 
   virtual void ZoomToRect(const uint32_t& aPresShellId,
                           const FrameMetrics::ViewID& aViewId,
                           const CSSRect& aRect,
                           const uint32_t& aFlags) override;
 
   virtual bool HasPendingInputEvent() override;
 
+  virtual void LookUpDictionary(
+                 const nsString& aText,
+                 const nsTArray<mozilla::FontRange>& aFontRangeArray,
+                 const bool aIsVertical,
+                 const LayoutDeviceIntPoint& aPoint) override;
+
 protected:
   virtual nsresult NotifyIMEInternal(
                      const IMENotification& aIMENotification) override;
 
 private:
   nsresult Paint();
 
   void SetChild(PuppetWidget* aChild);