Bug 1257731 - Part 1. Send HaveBidiKeyboards information to content process. r=masayuki
MozReview-Commit-ID: 87J4hE79e3n
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1031,28 +1031,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));
@@ -1505,23 +1506,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
@@ -390,17 +390,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
@@ -3382,34 +3382,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
@@ -486,17 +486,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,
@@ -694,17 +694,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