Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D5962
This commit is contained in:
Ehsan Akhgari 2018-09-15 14:38:44 -04:00
Родитель 7c90f6f4f5
Коммит ffa5ec335e
13 изменённых файлов: 64 добавлений и 40 удалений

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

@ -183,6 +183,7 @@
#include "nsIURIWithSpecialOrigin.h"
#include "nsIURL.h"
#include "nsIWebNavigation.h"
#include "nsIWidget.h"
#include "nsIWindowMediator.h"
#include "nsIXPConnect.h"
#include "nsJSUtils.h"
@ -272,7 +273,7 @@ nsIContentPolicy *nsContentUtils::sContentPolicyService;
bool nsContentUtils::sTriedToGetContentPolicy = false;
RefPtr<mozilla::intl::LineBreaker> nsContentUtils::sLineBreaker;
RefPtr<mozilla::intl::WordBreaker> nsContentUtils::sWordBreaker;
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nullptr;
StaticRefPtr<nsIBidiKeyboard> nsContentUtils::sBidiKeyboard;
uint32_t nsContentUtils::sScriptBlockerCount = 0;
uint32_t nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
AutoTArray<nsCOMPtr<nsIRunnable>, 8>* nsContentUtils::sBlockedScriptRunners = nullptr;
@ -1633,10 +1634,8 @@ nsIBidiKeyboard*
nsContentUtils::GetBidiKeyboard()
{
if (!sBidiKeyboard) {
nsresult rv = CallGetService("@mozilla.org/widget/bidikeyboard;1", &sBidiKeyboard);
if (NS_FAILED(rv)) {
sBidiKeyboard = nullptr;
}
sBidiKeyboard = nsIWidget::CreateBidiKeyboard();
MOZ_ASSERT(sBidiKeyboard);
}
return sBidiKeyboard;
}
@ -1986,7 +1985,7 @@ nsContentUtils::Shutdown()
NS_IF_RELEASE(sUUIDGenerator);
sLineBreaker = nullptr;
sWordBreaker = nullptr;
NS_IF_RELEASE(sBidiKeyboard);
sBidiKeyboard = nullptr;
delete sAtomEventTable;
sAtomEventTable = nullptr;

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

@ -25,6 +25,7 @@
#include "mozilla/CORSMode.h"
#include "mozilla/EventForwards.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TaskCategory.h"
#include "mozilla/TimeStamp.h"
#include "nsContentListDeclarations.h"
@ -3449,7 +3450,7 @@ private:
static RefPtr<mozilla::intl::LineBreaker> sLineBreaker;
static RefPtr<mozilla::intl::WordBreaker> sWordBreaker;
static nsIBidiKeyboard* sBidiKeyboard;
static mozilla::StaticRefPtr<nsIBidiKeyboard> sBidiKeyboard;
static bool sInitialized;
static uint32_t sScriptBlockerCount;

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

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "PuppetBidiKeyboard.h"
#include "nsIWidget.h"
using namespace mozilla::widget;
@ -49,3 +50,10 @@ PuppetBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
*aResult = mHaveBidiKeyboards;
return NS_OK;
}
// static
already_AddRefed<nsIBidiKeyboard>
nsIWidget::CreateBidiKeyboardContentProcess()
{
return do_AddRef(new PuppetBidiKeyboard());
}

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

@ -7,6 +7,7 @@
#include "nsBidiKeyboard.h"
#include "nsCocoaUtils.h"
#include "TextInputHandler.h"
#include "nsIWidget.h"
// This must be the last include:
#include "nsObjCExceptions.h"
@ -40,3 +41,10 @@ NS_IMETHODIMP nsBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
// not implemented yet
return NS_ERROR_NOT_IMPLEMENTED;
}
// static
already_AddRefed<nsIBidiKeyboard>
nsIWidget::CreateBidiKeyboardInner()
{
return do_AddRef(new nsBidiKeyboard());
}

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

@ -82,9 +82,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(OSXNotificationCenter, Init)
#include "nsMenuBarX.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeMenuServiceX)
#include "nsBidiKeyboard.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
#include "nsMacDockSupport.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacDockSupport)
@ -117,7 +114,6 @@ NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
@ -148,8 +144,6 @@ 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,
mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_SCREENMANAGER_CID, false, NULL, ScreenManagerConstructor,
mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor },
@ -183,8 +177,6 @@ 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::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
mozilla::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },

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

@ -8,6 +8,7 @@
#include "prlink.h"
#include "nsBidiKeyboard.h"
#include "nsIWidget.h"
#include <gtk/gtk.h>
NS_IMPL_ISUPPORTS(nsBidiKeyboard, nsIBidiKeyboard)
@ -53,3 +54,10 @@ NS_IMETHODIMP nsBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
// not implemented yet
return NS_ERROR_NOT_IMPLEMENTED;
}
// static
already_AddRefed<nsIBidiKeyboard>
nsIWidget::CreateBidiKeyboardInner()
{
return do_AddRef(new nsBidiKeyboard());
}

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

@ -31,7 +31,6 @@
#include "nsColorPicker.h"
#include "nsFilePicker.h"
#include "nsSound.h"
#include "nsBidiKeyboard.h"
#include "nsGTKToolkit.h"
#include "WakeLockListener.h"
@ -59,7 +58,6 @@ using namespace mozilla;
using namespace mozilla::widget;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
#ifdef MOZ_X11
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceGTK, nsIdleServiceGTK::GetInstance)
@ -176,7 +174,6 @@ NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
#ifdef NS_PRINTING
NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
@ -208,7 +205,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY },
#endif
{ &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
{ &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
{ &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
Module::MAIN_PROCESS_ONLY },
#ifdef NS_PRINTING
@ -242,8 +238,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY },
#endif
{ "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID,
Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
Module::MAIN_PROCESS_ONLY },
#ifdef NS_PRINTING

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

@ -2482,6 +2482,25 @@ nsIWidget::GetEditCommands(nsIWidget::NativeKeyBindingsType aType,
MOZ_ASSERT(aCommands.IsEmpty());
}
already_AddRefed<nsIBidiKeyboard>
nsIWidget::CreateBidiKeyboard()
{
if (XRE_IsContentProcess()) {
return CreateBidiKeyboardContentProcess();
} else {
return CreateBidiKeyboardInner();
}
}
#ifdef ANDROID
already_AddRefed<nsIBidiKeyboard>
nsIWidget::CreateBidiKeyboardInner()
{
// no bidi keyboard implementation
return nullptr;
}
#endif
namespace mozilla {
namespace widget {

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

@ -12,7 +12,6 @@
#include "nsDragServiceProxy.h"
#include "nsFilePickerProxy.h"
#include "nsSoundProxy.h"
#include "mozilla/widget/PuppetBidiKeyboard.h"
#include "mozilla/widget/ScreenManager.h"
using namespace mozilla;
@ -23,7 +22,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSoundProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetBidiKeyboard)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager, ScreenManager::GetAddRefedSingleton)
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
@ -31,7 +29,6 @@ NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_SOUND_CID);
NS_DEFINE_NAMED_CID(PUPPETBIDIKEYBOARD_CID);
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
@ -45,8 +42,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
Module::CONTENT_PROCESS_ONLY },
{ &kNS_SOUND_CID, false, nullptr, nsSoundProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kPUPPETBIDIKEYBOARD_CID, false, NULL, PuppetBidiKeyboardConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
Module::CONTENT_PROCESS_ONLY },
{ nullptr }
@ -59,8 +54,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/sound;1", &kNS_SOUND_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/widget/bidikeyboard;1", &kPUPPETBIDIKEYBOARD_CID,
Module::CONTENT_PROCESS_ONLY },
{ nullptr }
};

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

@ -34,6 +34,7 @@
#include "Units.h"
// forward declarations
class nsIBidiKeyboard;
class nsIRollupListener;
class imgIContainer;
class nsIContent;
@ -1746,6 +1747,9 @@ private:
static void OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure);
static already_AddRefed<nsIBidiKeyboard> CreateBidiKeyboardContentProcess();
static already_AddRefed<nsIBidiKeyboard> CreateBidiKeyboardInner();
mozilla::UniquePtr<LongTapInfo> mLongTapTouchPoint;
nsCOMPtr<nsITimer> mLongTapTimer;
static int32_t sPointerIdCounter;
@ -2133,6 +2137,8 @@ public:
virtual void RecvScreenPixels(mozilla::ipc::Shmem&& aMem, const ScreenIntSize& aSize) = 0;
#endif
static already_AddRefed<nsIBidiKeyboard> CreateBidiKeyboard();
protected:
/**
* Like GetDefaultScale, but taking into account only the system settings

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

@ -104,13 +104,6 @@
#define NS_SOUND_CID \
{ 0xb148eed2, 0x236d, 0x11d3, { 0xb3, 0x5c, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
// {9f1800ab-f428-4207-b40c-e832e77b01fc}
#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 } }

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

@ -7,6 +7,7 @@
#include <stdio.h>
#include "nsBidiKeyboard.h"
#include "WidgetUtils.h"
#include "nsIWidget.h"
#include <tchar.h>
NS_IMPL_ISUPPORTS(nsBidiKeyboard, nsIBidiKeyboard)
@ -184,3 +185,10 @@ nsBidiKeyboard::OnLayoutChange()
{
mozilla::widget::WidgetUtils::SendBidiKeyboardInfoToContent();
}
// static
already_AddRefed<nsIBidiKeyboard>
nsIWidget::CreateBidiKeyboardInner()
{
return do_AddRef(new nsBidiKeyboard());
}

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

@ -34,7 +34,6 @@
#include "nsClipboardHelper.h"
#include "nsClipboard.h"
#include "HeadlessClipboard.h"
#include "nsBidiKeyboard.h"
#include "nsDragService.h"
#include "nsTransferable.h"
#include "nsHTMLFormatConverter.h"
@ -111,7 +110,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(WindowsUIUtils)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarPreviewCallback)
#ifdef NS_PRINTING
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceWin, Init)
@ -147,7 +145,6 @@ NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTLINK_CID);
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORTCUT_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWS_UIUTILS_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
NS_DEFINE_NAMED_CID(NS_TASKBARPREVIEWCALLBACK_CID);
#ifdef NS_PRINTING
NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
@ -179,7 +176,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_WIN_JUMPLISTSHORTCUT_CID, false, nullptr, JumpListShortcutConstructor },
{ &kNS_WINDOWS_UIUTILS_CID, false, nullptr, WindowsUIUtilsConstructor },
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_TASKBARPREVIEWCALLBACK_CID, false, nullptr, TaskbarPreviewCallbackConstructor },
#ifdef NS_PRINTING
{ &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceWinConstructor, Module::MAIN_PROCESS_ONLY },
@ -211,7 +207,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID },
{ "@mozilla.org/windows-ui-utils;1", &kNS_WINDOWS_UIUTILS_CID },
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/widget/taskbar-preview-callback;1", &kNS_TASKBARPREVIEWCALLBACK_CID },
#ifdef NS_PRINTING
{ NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },