Bug 1257731 - Part 1. Send HaveBidiKeyboards information to content process. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 03 Jun 2016 18:56:04 +0900
changeset 301214 7660b0e9e5dccdff9aa2272e3ad9cec46ed0437c
parent 301213 9c34a1f781d95fc255187762aa795728169f9a04
child 301215 18fb01dd992011e007996ae2fc6e1e8c1ee96408
push id78257
push userm_kato@ga2.so-net.ne.jp
push dateThu, 09 Jun 2016 06:17:12 +0000
treeherdermozilla-inbound@18fb01dd9920 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1257731
milestone50.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 1257731 - Part 1. Send HaveBidiKeyboards information to content process. r=masayuki MozReview-Commit-ID: 87J4hE79e3n
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
widget/PuppetBidiKeyboard.cpp
widget/PuppetBidiKeyboard.h
widget/WidgetUtils.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1032,28 +1032,29 @@ ContentChild::InitXPCOM()
     NS_WARNING("Couldn't acquire console service");
     return;
   }
 
   mConsoleListener = new ConsoleListener(this);
   if (NS_FAILED(svc->RegisterListener(mConsoleListener)))
     NS_WARNING("Couldn't register console listener for child process");
 
-  bool isOffline, isLangRTL;
+  bool isOffline, isLangRTL, haveBidiKeyboards;
   bool isConnected;
   ClipboardCapabilities clipboardCaps;
   DomainPolicyClone domainPolicy;
   StructuredCloneData initialData;
 
   SendGetXPCOMProcessAttributes(&isOffline, &isConnected,
-                                &isLangRTL, &mAvailableDictionaries,
+                                &isLangRTL, &haveBidiKeyboards,
+                                &mAvailableDictionaries,
                                 &clipboardCaps, &domainPolicy, &initialData);
   RecvSetOffline(isOffline);
   RecvSetConnectivity(isConnected);
-  RecvBidiKeyboardNotify(isLangRTL);
+  RecvBidiKeyboardNotify(isLangRTL, haveBidiKeyboards);
 
   // Create the CPOW manager as soon as possible.
   SendPJavaScriptConstructor();
 
   if (domainPolicy.active()) {
     nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
     MOZ_ASSERT(ssm);
     ssm->ActivateDomainPolicyInternal(getter_AddRefs(mPolicy));
@@ -1506,23 +1507,24 @@ ContentChild::RecvSpeakerManagerNotify()
     service->Notify();
   }
   return true;
 #endif
   return false;
 }
 
 bool
-ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL)
+ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL,
+                                     const bool& aHaveBidiKeyboards)
 {
   // bidi is always of type PuppetBidiKeyboard* (because in the child, the only
   // possible implementation of nsIBidiKeyboard is PuppetBidiKeyboard).
   PuppetBidiKeyboard* bidi = static_cast<PuppetBidiKeyboard*>(nsContentUtils::GetBidiKeyboard());
   if (bidi) {
-    bidi->SetIsLangRTL(aIsLangRTL);
+    bidi->SetBidiKeyboardInfo(aIsLangRTL, aHaveBidiKeyboards);
   }
   return true;
 }
 
 static CancelableRunnable* sFirstIdleTask;
 
 static void FirstIdle(void)
 {
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -396,17 +396,18 @@ public:
   virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override;
 
   virtual bool RecvSetOffline(const bool& offline) override;
 
   virtual bool RecvSetConnectivity(const bool& connectivity) override;
 
   virtual bool RecvSpeakerManagerNotify() override;
 
-  virtual bool RecvBidiKeyboardNotify(const bool& isLangRTL) override;
+  virtual bool RecvBidiKeyboardNotify(const bool& isLangRTL,
+                                      const bool& haveBidiKeyboards) override;
 
   virtual bool RecvNotifyVisited(const URIParams& aURI) override;
 
   // auto remove when alertfinished is received.
   nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
 
   virtual bool RecvSystemMemoryAvailable(const uint64_t& aGetterId,
                                          const uint32_t& aMemoryAvailable) override;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3383,34 +3383,37 @@ ContentParent::RecvGetProcessAttributes(
 
   return true;
 }
 
 bool
 ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
                                              bool* aIsConnected,
                                              bool* aIsLangRTL,
+                                             bool* aHaveBidiKeyboards,
                                              InfallibleTArray<nsString>* dictionaries,
                                              ClipboardCapabilities* clipboardCaps,
                                              DomainPolicyClone* domainPolicy,
                                              StructuredCloneData* aInitialData)
 {
   nsCOMPtr<nsIIOService> io(do_GetIOService());
   MOZ_ASSERT(io, "No IO service?");
   DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
   MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?");
 
   rv = io->GetConnectivity(aIsConnected);
   MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?");
 
   nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard();
 
   *aIsLangRTL = false;
+  *aHaveBidiKeyboards = false;
   if (bidi) {
     bidi->IsLangRTL(aIsLangRTL);
+    bidi->GetHaveBidiKeyboards(aHaveBidiKeyboards);
   }
 
   nsCOMPtr<nsISpellChecker> spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID));
   MOZ_ASSERT(spellChecker, "No spell checker?");
 
   spellChecker->GetDictionaryList(dictionaries);
 
   nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1"));
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -702,16 +702,17 @@ private:
   virtual bool RecvGetProcessAttributes(ContentParentId* aCpId,
                                         bool* aIsForApp,
                                         bool* aIsForBrowser) override;
 
   virtual bool
   RecvGetXPCOMProcessAttributes(bool* aIsOffline,
                                 bool* aIsConnected,
                                 bool* aIsLangRTL,
+                                bool* aHaveBidiKeyboards,
                                 InfallibleTArray<nsString>* dictionaries,
                                 ClipboardCapabilities* clipboardCaps,
                                 DomainPolicyClone* domainPolicy,
                                 StructuredCloneData* initialData) override;
 
   virtual bool
   DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) override;
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -489,17 +489,17 @@ child:
                                bool minimizeMemoryUsage, MaybeFileDesc DMDFile);
 
     async SpeakerManagerNotify();
 
     /**
      * Communication between the PuppetBidiKeyboard and the actual
      * BidiKeyboard hosted by the parent
      */
-    async BidiKeyboardNotify(bool isLangRTL);
+    async BidiKeyboardNotify(bool isLangRTL, bool haveBidiKeyboards);
 
     /**
      * Dump this process's GC and CC logs to the provided files.
      *
      * For documentation on the other args, see dumpGCAndCCLogsToFile in
      * nsIMemoryInfoDumper.idl
      */
     async PCycleCollectWithLogs(bool dumpAllTraces,
@@ -697,17 +697,18 @@ parent:
      * |isForBrowser|, we're loading <browser>.  When |!isForApp &&
      * !isForBrowser|, we're probably loading <xul:browser remote>.
      *
      * Keep the return values in sync with PBrowser()!
      */
     sync GetProcessAttributes()
         returns (ContentParentId cpId, bool isForApp, bool isForBrowser);
     sync GetXPCOMProcessAttributes()
-        returns (bool isOffline, bool isConnected, bool isLangRTL, nsString[] dictionaries,
+        returns (bool isOffline, bool isConnected, bool isLangRTL,
+                 bool haveBidiKeyboards, nsString[] dictionaries,
                  ClipboardCapabilities clipboardCaps,
                  DomainPolicyClone domainPolicy,
                  StructuredCloneData initialData);
 
     sync CreateChildProcess(IPCTabContext context,
                             ProcessPriority priority,
                             TabId openerTabId)
         returns (ContentParentId cpId, bool isForApp, bool isForBrowser, TabId tabId);
--- a/widget/PuppetBidiKeyboard.cpp
+++ b/widget/PuppetBidiKeyboard.cpp
@@ -28,19 +28,21 @@ PuppetBidiKeyboard::Reset()
 NS_IMETHODIMP
 PuppetBidiKeyboard::IsLangRTL(bool* aIsRTL)
 {
   *aIsRTL = mIsLangRTL;
   return NS_OK;
 }
 
 void
-PuppetBidiKeyboard::SetIsLangRTL(bool aIsLangRTL)
+PuppetBidiKeyboard::SetBidiKeyboardInfo(bool aIsLangRTL,
+                                        bool aHaveBidiKeyboards)
 {
   mIsLangRTL = aIsLangRTL;
+  mHaveBidiKeyboards = aHaveBidiKeyboards;
 }
 
 NS_IMETHODIMP
 PuppetBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
 {
-  // not implemented yet
-  return NS_ERROR_NOT_IMPLEMENTED;
+  *aResult = mHaveBidiKeyboards;
+  return NS_OK;
 }
--- a/widget/PuppetBidiKeyboard.h
+++ b/widget/PuppetBidiKeyboard.h
@@ -16,20 +16,21 @@ namespace widget {
 class PuppetBidiKeyboard final : public nsIBidiKeyboard
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIBIDIKEYBOARD
 
   PuppetBidiKeyboard();
 
-  void SetIsLangRTL(bool aIsLangRTL);
+  void SetBidiKeyboardInfo(bool aIsLangRTL, bool aHaveBidiKeyboards);
 
 private:
   ~PuppetBidiKeyboard();
 
   bool mIsLangRTL;
+  bool mHaveBidiKeyboards;
 };
 
 } // namespace widget
 } // namespace mozilla
 
 #endif // mozilla_widget_PuppetBidiKeyboard_h_
--- a/widget/WidgetUtils.cpp
+++ b/widget/WidgetUtils.cpp
@@ -122,18 +122,20 @@ WidgetUtils::SendBidiKeyboardInfoToConte
   if (!bidiKeyboard) {
     return;
   }
 
   bool rtl;
   if (NS_FAILED(bidiKeyboard->IsLangRTL(&rtl))) {
     return;
   }
+  bool bidiKeyboards = false;
+  bidiKeyboard->GetHaveBidiKeyboards(&bidiKeyboards);
 
   nsTArray<dom::ContentParent*> children;
   dom::ContentParent::GetAll(children);
   for (uint32_t i = 0; i < children.Length(); i++) {
-    Unused << children[i]->SendBidiKeyboardNotify(rtl);
+    Unused << children[i]->SendBidiKeyboardNotify(rtl, bidiKeyboards);
   }
 }
 
 } // namespace widget
 } // namespace mozilla