зеркало из https://github.com/mozilla/gecko-dev.git
Bug 966395 - Use a puppet bidi keyboard in child processes. r=mrbkap/masayuki
--HG-- extra : rebase_source : c6a1c731d8a2c8c3964e59582dfd8e8e59e1b79f
This commit is contained in:
Родитель
6a403049ae
Коммит
3389fe5c01
|
@ -154,6 +154,8 @@
|
|||
#include "mozilla/net/NeckoMessageUtils.h"
|
||||
#include "mozilla/RemoteSpellCheckEngineChild.h"
|
||||
|
||||
#include "PuppetBidiKeyboard.h"
|
||||
|
||||
using namespace base;
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::docshell;
|
||||
|
@ -168,6 +170,7 @@ using namespace mozilla::ipc;
|
|||
using namespace mozilla::layers;
|
||||
using namespace mozilla::net;
|
||||
using namespace mozilla::jsipc;
|
||||
using namespace mozilla::widget;
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
using namespace mozilla::system;
|
||||
#endif
|
||||
|
@ -677,8 +680,9 @@ ContentChild::InitXPCOM()
|
|||
if (NS_FAILED(svc->RegisterListener(mConsoleListener)))
|
||||
NS_WARNING("Couldn't register console listener for child process");
|
||||
|
||||
bool isOffline;
|
||||
SendGetXPCOMProcessAttributes(&isOffline);
|
||||
bool isOffline, isLangRTL;
|
||||
SendGetXPCOMProcessAttributes(&isOffline, &isLangRTL);
|
||||
RecvBidiKeyboardNotify(isLangRTL);
|
||||
RecvSetOffline(isOffline);
|
||||
|
||||
DebugOnly<FileUpdateDispatcher*> observer = FileUpdateDispatcher::GetSingleton();
|
||||
|
@ -940,6 +944,18 @@ ContentChild::RecvSpeakerManagerNotify()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static CancelableTask* sFirstIdleTask;
|
||||
|
||||
static void FirstIdle(void)
|
||||
|
|
|
@ -251,6 +251,8 @@ public:
|
|||
|
||||
virtual bool RecvSpeakerManagerNotify() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvBidiKeyboardNotify(const bool& isLangRTL) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvNotifyVisited(const URIParams& aURI) MOZ_OVERRIDE;
|
||||
// auto remove when alertfinished is received.
|
||||
nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
|
||||
|
|
|
@ -125,6 +125,8 @@
|
|||
#include "prio.h"
|
||||
#include "private/pprio.h"
|
||||
|
||||
#include "nsIBidiKeyboard.h"
|
||||
|
||||
#if defined(ANDROID) || defined(LINUX)
|
||||
#include "nsSystemInfo.h"
|
||||
#endif
|
||||
|
@ -2604,13 +2606,20 @@ ContentParent::RecvGetProcessAttributes(uint64_t* aId,
|
|||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline)
|
||||
ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline, bool* aIsLangRTL)
|
||||
{
|
||||
nsCOMPtr<nsIIOService> io(do_GetIOService());
|
||||
NS_ASSERTION(io, "No IO service?");
|
||||
DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed getting offline?");
|
||||
|
||||
nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard();
|
||||
|
||||
*aIsLangRTL = false;
|
||||
if (bidi) {
|
||||
bidi->IsLangRTL(aIsLangRTL);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ private:
|
|||
virtual bool RecvGetProcessAttributes(uint64_t* aId,
|
||||
bool* aIsForApp,
|
||||
bool* aIsForBrowser) MOZ_OVERRIDE;
|
||||
virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline) MOZ_OVERRIDE;
|
||||
virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline, bool* aIsLangRTL) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -365,6 +365,12 @@ child:
|
|||
|
||||
async SpeakerManagerNotify();
|
||||
|
||||
/**
|
||||
* Communication between the PuppetBidiKeyboard and the actual
|
||||
* BidiKeyboard hosted by the parent
|
||||
*/
|
||||
async BidiKeyboardNotify(bool isLangRTL);
|
||||
|
||||
async DataStoreNotify(uint32_t aAppId, nsString aName,
|
||||
nsString aManifestURL);
|
||||
|
||||
|
@ -457,7 +463,7 @@ parent:
|
|||
sync GetProcessAttributes()
|
||||
returns (uint64_t id, bool isForApp, bool isForBrowser);
|
||||
sync GetXPCOMProcessAttributes()
|
||||
returns (bool isOffline);
|
||||
returns (bool isOffline, bool isLangRTL);
|
||||
|
||||
sync CreateChildProcess(IPCTabContext context,
|
||||
ProcessPriority priority)
|
||||
|
|
|
@ -1116,6 +1116,8 @@ private:
|
|||
// We cannot access to the NSInputManager during we aren't active, so, the
|
||||
// focused handler can have an IME transaction even if we are deactive.
|
||||
static IMEInputHandler* sFocusedIMEHandler;
|
||||
|
||||
static bool sCachedIsForRTLLangage;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "nsCocoaUtils.h"
|
||||
#include "WidgetUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
|
||||
#ifdef __LP64__
|
||||
#include "ComplexTextInputPanel.h"
|
||||
|
@ -2230,6 +2232,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector)
|
|||
******************************************************************************/
|
||||
|
||||
bool IMEInputHandler::sStaticMembersInitialized = false;
|
||||
bool IMEInputHandler::sCachedIsForRTLLangage = false;
|
||||
CFStringRef IMEInputHandler::sLatestIMEOpenedModeInputSourceID = nullptr;
|
||||
IMEInputHandler* IMEInputHandler::sFocusedIMEHandler = nullptr;
|
||||
|
||||
|
@ -2318,6 +2321,20 @@ IMEInputHandler::OnCurrentTextInputSourceChange(CFNotificationCenterRef aCenter,
|
|||
sLastTIS = newTIS;
|
||||
}
|
||||
#endif // #ifdef PR_LOGGING
|
||||
|
||||
/**
|
||||
* When the direction is changed, all the children are notified.
|
||||
* No need to treat the initial case separately because it is covered
|
||||
* by the general case (sCachedIsForRTLLangage is initially false)
|
||||
*/
|
||||
if (sCachedIsForRTLLangage != tis.IsForRTLLanguage()) {
|
||||
nsTArray<dom::ContentParent*> children;
|
||||
dom::ContentParent::GetAll(children);
|
||||
for (uint32_t i = 0; i < children.Length(); i++) {
|
||||
unused << children[i]->SendBidiKeyboardNotify(tis.IsForRTLLanguage());
|
||||
}
|
||||
sCachedIsForRTLLangage = tis.IsForRTLLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -12,6 +12,7 @@ XPIDL_MODULE = 'widget_cocoa'
|
|||
|
||||
EXPORTS += [
|
||||
'mozView.h',
|
||||
'nsBidiKeyboard.h',
|
||||
'nsChangeObserver.h',
|
||||
'nsCocoaFeatures.h',
|
||||
'nsCocoaUtils.h',
|
||||
|
|
|
@ -136,7 +136,8 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
|||
{ &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor },
|
||||
{ &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY },
|
||||
{ &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor },
|
||||
{ &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY },
|
||||
{ &kNS_THEMERENDERER_CID, false, NULL, nsNativeThemeCocoaConstructor },
|
||||
{ &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerCocoaConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY },
|
||||
|
@ -176,7 +177,8 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
|||
{ "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
|
||||
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY },
|
||||
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID },
|
||||
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY },
|
||||
{ "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID },
|
||||
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY },
|
||||
|
|
|
@ -109,6 +109,9 @@
|
|||
#define NS_BIDIKEYBOARD_CID \
|
||||
{ 0x9f1800ab, 0xf428, 0x4207, { 0xb4, 0x0c, 0xe8, 0x32, 0xe7, 0x7b, 0x01, 0xfc } }
|
||||
|
||||
#define PUPPETBIDIKEYBOARD_CID \
|
||||
{ 0x689e2586, 0x0344, 0x40b2, {0x83, 0x75, 0x13, 0x67, 0x2d, 0x3b, 0x71, 0x9a } }
|
||||
|
||||
#define NS_SCREENMANAGER_CID \
|
||||
{ 0xc401eb80, 0xf9ea, 0x11d3, { 0xbb, 0x6f, 0xe7, 0x32, 0xb7, 0x3e, 0xbe, 0x7c } }
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PuppetBidiKeyboard.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
NS_IMPL_ISUPPORTS(PuppetBidiKeyboard, nsIBidiKeyboard)
|
||||
|
||||
PuppetBidiKeyboard::PuppetBidiKeyboard() : nsIBidiKeyboard()
|
||||
{
|
||||
}
|
||||
|
||||
PuppetBidiKeyboard::~PuppetBidiKeyboard()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetBidiKeyboard::Reset()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetBidiKeyboard::IsLangRTL(bool* aIsRTL)
|
||||
{
|
||||
*aIsRTL = mIsLangRTL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
PuppetBidiKeyboard::SetIsLangRTL(bool aIsLangRTL)
|
||||
{
|
||||
mIsLangRTL = aIsLangRTL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
|
||||
{
|
||||
// not implemented yet
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_widget_PuppetBidiKeyboard_h_
|
||||
#define mozilla_widget_PuppetBidiKeyboard_h_
|
||||
|
||||
#include "nsIBidiKeyboard.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class PuppetBidiKeyboard MOZ_FINAL : public nsIBidiKeyboard
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIBIDIKEYBOARD
|
||||
|
||||
PuppetBidiKeyboard();
|
||||
|
||||
void SetIsLangRTL(bool aIsLangRTL);
|
||||
|
||||
private:
|
||||
~PuppetBidiKeyboard();
|
||||
|
||||
bool mIsLangRTL;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_widget_PuppetBidiKeyboard_h_
|
|
@ -11,6 +11,10 @@ EXPORTS += [
|
|||
'GfxInfoCollector.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.widget += [
|
||||
'PuppetBidiKeyboard.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'ContentHelper.cpp',
|
||||
'GfxDriverInfo.cpp',
|
||||
|
@ -36,6 +40,7 @@ UNIFIED_SOURCES += [
|
|||
'nsScreenManagerProxy.cpp',
|
||||
'nsTransferable.cpp',
|
||||
'nsXPLookAndFeel.cpp',
|
||||
'PuppetBidiKeyboard.cpp',
|
||||
'PuppetWidget.cpp',
|
||||
'ScreenProxy.cpp',
|
||||
'WidgetUtils.cpp',
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
#include "nsColorPickerProxy.h"
|
||||
#include "nsFilePickerProxy.h"
|
||||
#include "nsScreenManagerProxy.h"
|
||||
#include "PuppetBidiKeyboard.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
#ifndef MOZ_B2G
|
||||
|
||||
|
@ -20,11 +22,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetBidiKeyboard)
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
|
||||
NS_DEFINE_NAMED_CID(PUPPETBIDIKEYBOARD_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{ &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardProxyConstructor,
|
||||
|
@ -35,6 +39,8 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
|||
Module::CONTENT_PROCESS_ONLY },
|
||||
{ &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerProxyConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY },
|
||||
{ &kPUPPETBIDIKEYBOARD_CID, false, NULL, PuppetBidiKeyboardConstructor,
|
||||
mozilla::Module::CONTENT_PROCESS_ONLY },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
|
@ -43,6 +49,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
|||
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::CONTENT_PROCESS_ONLY },
|
||||
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
|
||||
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::CONTENT_PROCESS_ONLY },
|
||||
{ "@mozilla.org/widget/bidikeyboard;1", &kPUPPETBIDIKEYBOARD_CID, Module::CONTENT_PROCESS_ONLY },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче