Bug 1177943 - Part 5. Add IPC for e10s support. r=masayuki
Implement LookUpDictionary to PuppetWidget and PBrowser for e10s.
MozReview-Commit-ID: 44SrfuLJoCF
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -66,16 +66,17 @@ using mozilla::layers::TouchBehaviorFlag
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 class mozilla::NativeEventData from "ipc/nsGUIEventIPC.h";
+using mozilla::FontRange from "ipc/nsGUIEventIPC.h";
namespace mozilla {
namespace dom {
struct NativeKeyBinding
{
CommandInt[] singleLineCommands;
CommandInt[] multiLineCommands;
@@ -456,16 +457,26 @@ 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
+ */
+ async LookUpDictionary(nsString aText, FontRange[] aFontRangeArray,
+ 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
@@ -3374,16 +3374,32 @@ TabParent::RecvGetTabCount(uint32_t* aVa
uint32_t tabCount;
nsresult rv = xulBrowserWindow->GetTabCount(&tabCount);
NS_ENSURE_SUCCESS(rv, true);
*aValue = tabCount;
return true;
}
+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
@@ -272,16 +272,22 @@ public:
const NativeEventData& aKeyEventData,
bool aIsConsumed) override;
virtual bool RecvOnWindowedPluginKeyEvent(
const NativeEventData& aKeyEventData) 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
@@ -1424,16 +1424,30 @@ PuppetWidget::ZoomToRect(const uint32_t&
{
if (!mTabChild) {
return;
}
mTabChild->ZoomToRect(aPresShellId, aViewId, aRect, aFlags);
}
+void
+PuppetWidget::LookUpDictionary(
+ const nsAString& aText,
+ const nsTArray<mozilla::FontRange>& aFontRangeArray,
+ const bool aIsVertical,
+ const LayoutDeviceIntPoint& aPoint)
+{
+ if (!mTabChild) {
+ return;
+ }
+
+ mTabChild->SendLookUpDictionary(nsString(aText), aFontRangeArray, aIsVertical, aPoint);
+}
+
bool
PuppetWidget::HasPendingInputEvent()
{
if (!mTabChild) {
return false;
}
bool ret = false;
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -265,16 +265,22 @@ public:
virtual bool HasPendingInputEvent() override;
void HandledWindowedPluginKeyEvent(const NativeEventData& aKeyEventData,
bool aIsConsumed);
virtual nsresult OnWindowedPluginKeyEvent(
const NativeEventData& aKeyEventData,
nsIKeyEventInPluginCallback* aCallback) override;
+ virtual void LookUpDictionary(
+ const nsAString& aText,
+ const nsTArray<mozilla::FontRange>& aFontRangeArray,
+ const bool aIsVertical,
+ const LayoutDeviceIntPoint& aPoint) override;
+
protected:
virtual nsresult NotifyIMEInternal(
const IMENotification& aIMENotification) override;
// PuppetWidgets do not create compositors.
widget::CompositorWidgetProxy* NewCompositorWidgetProxy() override {
MOZ_ASSERT_UNREACHABLE("PuppetWidgets should not have widget proxies");
return nullptr;