Bug 1257731 - Part 1. Send HaveBidiKeyboards information to content process. r=masayuki

MozReview-Commit-ID: 87J4hE79e3n

--HG--
extra : rebase_source : fbfb473ebfd28a0f19b81b8030a0dfe60bc310a9
extra : histedit_source : e8b2ab1c0da578be8170ed5380d43cb4503ab299
This commit is contained in:
Makoto Kato 2016-06-03 18:56:04 +09:00
Родитель 4c22980cdc
Коммит cadf9d8f77
8 изменённых файлов: 26 добавлений и 13 удалений

Просмотреть файл

@ -1037,18 +1037,19 @@ ContentChild::InitXPCOM()
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();
@ -1511,13 +1512,14 @@ ContentChild::RecvSpeakerManagerNotify()
}
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;
}

Просмотреть файл

@ -401,7 +401,8 @@ public:
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;

Просмотреть файл

@ -3388,6 +3388,7 @@ bool
ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
bool* aIsConnected,
bool* aIsLangRTL,
bool* aHaveBidiKeyboards,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
@ -3404,8 +3405,10 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard();
*aIsLangRTL = false;
*aHaveBidiKeyboards = false;
if (bidi) {
bidi->IsLangRTL(aIsLangRTL);
bidi->GetHaveBidiKeyboards(aHaveBidiKeyboards);
}
nsCOMPtr<nsISpellChecker> spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID));

Просмотреть файл

@ -707,6 +707,7 @@ private:
RecvGetXPCOMProcessAttributes(bool* aIsOffline,
bool* aIsConnected,
bool* aIsLangRTL,
bool* aHaveBidiKeyboards,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,

Просмотреть файл

@ -494,7 +494,7 @@ child:
* 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.
@ -702,7 +702,8 @@ parent:
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);

Просмотреть файл

@ -33,14 +33,16 @@ PuppetBidiKeyboard::IsLangRTL(bool* aIsRTL)
}
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;
}

Просмотреть файл

@ -21,12 +21,13 @@ public:
PuppetBidiKeyboard();
void SetIsLangRTL(bool aIsLangRTL);
void SetBidiKeyboardInfo(bool aIsLangRTL, bool aHaveBidiKeyboards);
private:
~PuppetBidiKeyboard();
bool mIsLangRTL;
bool mHaveBidiKeyboards;
};
} // namespace widget

Просмотреть файл

@ -127,11 +127,13 @@ WidgetUtils::SendBidiKeyboardInfoToContent()
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);
}
}