Bug 978023 part.3 Rename nsIMEStateManager to mozilla::IMEStateManager r=smaug

--HG--
rename : dom/events/nsIMEStateManager.cpp => dom/events/IMEStateManager.cpp
rename : dom/events/nsIMEStateManager.h => dom/events/IMEStateManager.h
This commit is contained in:
Masayuki Nakano 2014-03-08 10:20:07 +09:00
parent ea63027a08
commit 8bbf9836fa
18 changed files with 152 additions and 145 deletions

View File

@ -41,6 +41,7 @@
#include "mozilla/dom/TextDecoder.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/Likely.h"
#include "mozilla/MouseEvents.h"
@ -122,7 +123,6 @@
#include "nsILineBreaker.h"
#include "nsILoadContext.h"
#include "nsILoadGroup.h"
#include "nsIMEStateManager.h"
#include "nsIMIMEService.h"
#include "nsINode.h"
#include "nsINodeInfo.h"
@ -4324,7 +4324,7 @@ nsContentUtils::DestroyAnonymousContent(nsCOMPtr<Element>* aElement)
void
nsContentUtils::NotifyInstalledMenuKeyboardListener(bool aInstalling)
{
nsIMEStateManager::OnInstalledMenuKeyboardListener(aInstalling);
IMEStateManager::OnInstalledMenuKeyboardListener(aInstalling);
}
static bool SchemeIs(nsIURI* aURI, const char* aScheme)

View File

@ -24,7 +24,6 @@
#include "nsFrameTraversal.h"
#include "nsEventDispatcher.h"
#include "nsEventStateManager.h"
#include "nsIMEStateManager.h"
#include "nsIWebNavigation.h"
#include "nsCaret.h"
#include "nsIBaseWindow.h"
@ -41,6 +40,7 @@
#include "mozilla/ContentEvents.h"
#include "mozilla/dom/Element.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
@ -933,8 +933,8 @@ nsFocusManager::WindowHidden(nsIDOMWindow* aWindow)
nsPresContext* focusedPresContext =
presShell ? presShell->GetPresContext() : nullptr;
nsIMEStateManager::OnChangeFocus(focusedPresContext, nullptr,
GetFocusMoveActionCause(0));
IMEStateManager::OnChangeFocus(focusedPresContext, nullptr,
GetFocusMoveActionCause(0));
if (presShell) {
SetCaretVisible(presShell, false, nullptr);
}
@ -1529,8 +1529,8 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear,
nsPresContext* focusedPresContext =
mActiveWindow ? presShell->GetPresContext() : nullptr;
nsIMEStateManager::OnChangeFocus(focusedPresContext, nullptr,
GetFocusMoveActionCause(0));
IMEStateManager::OnChangeFocus(focusedPresContext, nullptr,
GetFocusMoveActionCause(0));
// now adjust the actual focus, by clearing the fields in the focus manager
// and in the window.
@ -1746,12 +1746,12 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
// document and then the window.
if (aIsNewDocument) {
nsIDocument* doc = aWindow->GetExtantDoc();
// The focus change should be notified to nsIMEStateManager from here if
// The focus change should be notified to IMEStateManager from here if
// the focused content is a designMode editor since any content won't
// receive focus event.
if (doc && doc->HasFlag(NODE_IS_EDITABLE)) {
nsIMEStateManager::OnChangeFocus(presShell->GetPresContext(), nullptr,
GetFocusMoveActionCause(aFlags));
IMEStateManager::OnChangeFocus(presShell->GetPresContext(), nullptr,
GetFocusMoveActionCause(aFlags));
}
if (doc)
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
@ -1796,8 +1796,8 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
}
}
nsIMEStateManager::OnChangeFocus(presContext, aContent,
GetFocusMoveActionCause(aFlags));
IMEStateManager::OnChangeFocus(presContext, aContent,
GetFocusMoveActionCause(aFlags));
// as long as this focus wasn't because a window was raised, update the
// commands
@ -1810,8 +1810,8 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
aContent, aFlags & FOCUSMETHOD_MASK,
aWindowRaised, isRefocus);
} else {
nsIMEStateManager::OnChangeFocus(presContext, nullptr,
GetFocusMoveActionCause(aFlags));
IMEStateManager::OnChangeFocus(presContext, nullptr,
GetFocusMoveActionCause(aFlags));
if (!aWindowRaised) {
aWindow->UpdateCommands(NS_LITERAL_STRING("focus"));
}
@ -1834,8 +1834,8 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
}
nsPresContext* presContext = presShell->GetPresContext();
nsIMEStateManager::OnChangeFocus(presContext, nullptr,
GetFocusMoveActionCause(aFlags));
IMEStateManager::OnChangeFocus(presContext, nullptr,
GetFocusMoveActionCause(aFlags));
if (!aWindowRaised)
aWindow->UpdateCommands(NS_LITERAL_STRING("focus"));

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "IMEContentObserver.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/dom/Element.h"
#include "nsAutoPtr.h"
#include "nsAsyncDOMEvent.h"
@ -17,7 +18,6 @@
#include "nsIDOMDocument.h"
#include "nsIDOMRange.h"
#include "nsIFrame.h"
#include "nsIMEStateManager.h"
#include "nsINode.h"
#include "nsIPresShell.h"
#include "nsISelectionController.h"
@ -50,8 +50,7 @@ IMEContentObserver::Init(nsIWidget* aWidget,
nsIContent* aContent)
{
mWidget = aWidget;
mEditableNode =
nsIMEStateManager::GetRootEditableNode(aPresContext, aContent);
mEditableNode = IMEStateManager::GetRootEditableNode(aPresContext, aContent);
if (!mEditableNode) {
return;
}
@ -94,7 +93,7 @@ IMEContentObserver::Init(nsIWidget* aWidget,
}
NS_ENSURE_TRUE_VOID(mRootContent);
if (nsIMEStateManager::IsTestingIME()) {
if (IMEStateManager::IsTestingIME()) {
nsIDocument* doc = aPresContext->Document();
(new nsAsyncDOMEvent(doc, NS_LITERAL_STRING("MozIMEFocusIn"),
false, false))->RunDOMEventWhenSafe();
@ -103,7 +102,7 @@ IMEContentObserver::Init(nsIWidget* aWidget,
aWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_FOCUS));
// NOTIFY_IME_OF_FOCUS might cause recreating IMEContentObserver
// instance via nsIMEStateManager::UpdateIMEState(). So, this
// instance via IMEStateManager::UpdateIMEState(). So, this
// instance might already have been destroyed, check it.
if (!mRootContent) {
return;
@ -148,7 +147,7 @@ IMEContentObserver::Destroy()
// If CreateTextStateManager failed, mRootContent will be null,
// and we should not call NotifyIME(IMENotification(NOTIFY_IME_OF_BLUR))
if (mRootContent) {
if (nsIMEStateManager::IsTestingIME() && mEditableNode) {
if (IMEStateManager::IsTestingIME() && mEditableNode) {
nsIDocument* doc = mEditableNode->OwnerDoc();
(new nsAsyncDOMEvent(doc, NS_LITERAL_STRING("MozIMEFocusOut"),
false, false))->RunDOMEventWhenSafe();
@ -187,8 +186,8 @@ IMEContentObserver::IsManaging(nsPresContext* aPresContext,
if (!mRootContent->IsInDoc()) {
return false; // the focused editor has already been reframed.
}
return mEditableNode == nsIMEStateManager::GetRootEditableNode(aPresContext,
aContent);
return mEditableNode == IMEStateManager::GetRootEditableNode(aPresContext,
aContent);
}
bool
@ -198,7 +197,7 @@ IMEContentObserver::IsEditorHandlingEventForComposition() const
return false;
}
nsRefPtr<TextComposition> composition =
nsIMEStateManager::GetTextCompositionFor(mWidget);
IMEStateManager::GetTextCompositionFor(mWidget);
if (!composition) {
return false;
}

View File

@ -4,7 +4,7 @@
* 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 "nsIMEStateManager.h"
#include "mozilla/IMEStateManager.h"
#include "IMEContentObserver.h"
#include "HTMLInputElement.h"
@ -28,22 +28,23 @@
#include "TextComposition.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::widget;
namespace mozilla {
nsIContent* nsIMEStateManager::sContent = nullptr;
nsPresContext* nsIMEStateManager::sPresContext = nullptr;
bool nsIMEStateManager::sInstalledMenuKeyboardListener = false;
bool nsIMEStateManager::sIsTestingIME = false;
using namespace dom;
using namespace widget;
nsIContent* IMEStateManager::sContent = nullptr;
nsPresContext* IMEStateManager::sPresContext = nullptr;
bool IMEStateManager::sInstalledMenuKeyboardListener = false;
bool IMEStateManager::sIsTestingIME = false;
// sActiveIMEContentObserver points to the currently active IMEContentObserver.
// sActiveIMEContentObserver is null if there is no focused editor.
IMEContentObserver* nsIMEStateManager::sActiveIMEContentObserver = nullptr;
TextCompositionArray* nsIMEStateManager::sTextCompositions = nullptr;
IMEContentObserver* IMEStateManager::sActiveIMEContentObserver = nullptr;
TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
void
nsIMEStateManager::Shutdown()
IMEStateManager::Shutdown()
{
MOZ_ASSERT(!sTextCompositions || !sTextCompositions->Length());
delete sTextCompositions;
@ -51,7 +52,7 @@ nsIMEStateManager::Shutdown()
}
nsresult
nsIMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
{
NS_ENSURE_ARG_POINTER(aPresContext);
@ -86,8 +87,8 @@ nsIMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
}
nsresult
nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
nsIContent* aContent)
IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
nsIContent* aContent)
{
NS_ENSURE_ARG_POINTER(aPresContext);
@ -146,18 +147,18 @@ nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
}
nsresult
nsIMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction::Cause aCause)
IMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction::Cause aCause)
{
InputContextAction action(aCause);
return OnChangeFocusInternal(aPresContext, aContent, action);
}
nsresult
nsIMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction aAction)
IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction aAction)
{
bool focusActuallyChanging =
(sContent != aContent || sPresContext != aPresContext);
@ -229,7 +230,7 @@ nsIMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
}
void
nsIMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
{
sInstalledMenuKeyboardListener = aInstalling;
@ -240,9 +241,9 @@ nsIMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
}
void
nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent)
IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent)
{
if (sPresContext != aPresContext || sContent != aContent) {
return;
@ -279,8 +280,8 @@ nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
}
void
nsIMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
nsIContent* aContent)
IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
nsIContent* aContent)
{
if (sPresContext != aPresContext || sContent != aContent) {
return;
@ -299,8 +300,8 @@ nsIMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
}
void
nsIMEStateManager::UpdateIMEState(const IMEState &aNewIMEState,
nsIContent* aContent)
IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
nsIContent* aContent)
{
if (!sPresContext) {
NS_WARNING("ISM doesn't know which editor has focus");
@ -343,8 +344,8 @@ nsIMEStateManager::UpdateIMEState(const IMEState &aNewIMEState,
}
IMEState
nsIMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
nsIContent* aContent)
IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
nsIContent* aContent)
{
// On Printing or Print Preview, we don't need IME.
if (aPresContext->Type() == nsPresContext::eContext_PrintPreview ||
@ -378,7 +379,8 @@ public:
}
NS_IMETHOD Run() {
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (observerService) {
nsAutoString state;
state.AppendInt(mState);
@ -392,10 +394,10 @@ private:
};
void
nsIMEStateManager::SetIMEState(const IMEState &aState,
nsIContent* aContent,
nsIWidget* aWidget,
InputContextAction aAction)
IMEStateManager::SetIMEState(const IMEState& aState,
nsIContent* aContent,
nsIWidget* aWidget,
InputContextAction aAction)
{
NS_ENSURE_TRUE_VOID(aWidget);
@ -476,7 +478,7 @@ nsIMEStateManager::SetIMEState(const IMEState &aState,
}
void
nsIMEStateManager::EnsureTextCompositionArray()
IMEStateManager::EnsureTextCompositionArray()
{
if (sTextCompositions) {
return;
@ -485,11 +487,11 @@ nsIMEStateManager::EnsureTextCompositionArray()
}
void
nsIMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
nsEventStatus* aStatus,
nsDispatchingCallback* aCallBack)
IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
nsEventStatus* aStatus,
nsDispatchingCallback* aCallBack)
{
MOZ_ASSERT(aEvent->eventStructType == NS_COMPOSITION_EVENT ||
aEvent->eventStructType == NS_TEXT_EVENT);
@ -532,8 +534,8 @@ nsIMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
// static
nsresult
nsIMEStateManager::NotifyIME(IMEMessage aMessage,
nsIWidget* aWidget)
IMEStateManager::NotifyIME(IMEMessage aMessage,
nsIWidget* aWidget)
{
NS_ENSURE_TRUE(aWidget, NS_ERROR_INVALID_ARG);
@ -619,8 +621,8 @@ nsIMEStateManager::NotifyIME(IMEMessage aMessage,
// static
nsresult
nsIMEStateManager::NotifyIME(IMEMessage aMessage,
nsPresContext* aPresContext)
IMEStateManager::NotifyIME(IMEMessage aMessage,
nsPresContext* aPresContext)
{
NS_ENSURE_TRUE(aPresContext, NS_ERROR_INVALID_ARG);
@ -632,7 +634,7 @@ nsIMEStateManager::NotifyIME(IMEMessage aMessage,
}
bool
nsIMEStateManager::IsEditable(nsINode* node)
IMEStateManager::IsEditable(nsINode* node)
{
if (node->IsEditable()) {
return true;
@ -645,8 +647,8 @@ nsIMEStateManager::IsEditable(nsINode* node)
}
nsINode*
nsIMEStateManager::GetRootEditableNode(nsPresContext* aPresContext,
nsIContent* aContent)
IMEStateManager::GetRootEditableNode(nsPresContext* aPresContext,
nsIContent* aContent)
{
if (aContent) {
nsINode* root = nullptr;
@ -666,14 +668,14 @@ nsIMEStateManager::GetRootEditableNode(nsPresContext* aPresContext,
}
bool
nsIMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
IMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
{
switch (aWidget->GetInputContext().mIMEState.mEnabled) {
case widget::IMEState::ENABLED:
case widget::IMEState::PASSWORD:
case IMEState::ENABLED:
case IMEState::PASSWORD:
return true;
case widget::IMEState::PLUGIN:
case widget::IMEState::DISABLED:
case IMEState::PLUGIN:
case IMEState::DISABLED:
return false;
default:
MOZ_CRASH("Unknown IME enable state");
@ -681,7 +683,7 @@ nsIMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
}
void
nsIMEStateManager::DestroyTextStateManager()
IMEStateManager::DestroyTextStateManager()
{
if (!sActiveIMEContentObserver) {
return;
@ -693,7 +695,7 @@ nsIMEStateManager::DestroyTextStateManager()
}
void
nsIMEStateManager::CreateIMEContentObserver()
IMEStateManager::CreateIMEContentObserver()
{
if (sActiveIMEContentObserver) {
NS_WARNING("text state observer has been there already");
@ -728,8 +730,8 @@ nsIMEStateManager::CreateIMEContentObserver()
}
nsresult
nsIMEStateManager::GetFocusSelectionAndRoot(nsISelection** aSelection,
nsIContent** aRootContent)
IMEStateManager::GetFocusSelectionAndRoot(nsISelection** aSelection,
nsIContent** aRootContent)
{
if (!sActiveIMEContentObserver) {
return NS_ERROR_NOT_AVAILABLE;
@ -740,7 +742,7 @@ nsIMEStateManager::GetFocusSelectionAndRoot(nsISelection** aSelection,
// static
already_AddRefed<TextComposition>
nsIMEStateManager::GetTextCompositionFor(nsIWidget* aWidget)
IMEStateManager::GetTextCompositionFor(nsIWidget* aWidget)
{
if (!sTextCompositions) {
return nullptr;
@ -752,9 +754,11 @@ nsIMEStateManager::GetTextCompositionFor(nsIWidget* aWidget)
// static
already_AddRefed<TextComposition>
nsIMEStateManager::GetTextCompositionFor(WidgetGUIEvent* aEvent)
IMEStateManager::GetTextCompositionFor(WidgetGUIEvent* aEvent)
{
MOZ_ASSERT(aEvent->AsCompositionEvent() || aEvent->AsTextEvent(),
"aEvent has to be WidgetCompositionEvent or WidgetTextEvent");
return GetTextCompositionFor(aEvent->widget);
}
} // namespace mozilla

View File

@ -3,8 +3,8 @@
* 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 nsIMEStateManager_h__
#define nsIMEStateManager_h__
#ifndef mozilla_IMEStateManager_h_
#define mozilla_IMEStateManager_h_
#include "mozilla/EventForwards.h"
#include "nsIWidget.h"
@ -18,23 +18,23 @@ class nsPresContext;
class nsISelection;
namespace mozilla {
class IMEContentObserver;
class TextCompositionArray;
class TextComposition;
} // namespace mozilla
/*
* IME state manager
/**
* IMEStateManager manages InputContext (e.g., active editor type, IME enabled
* state and IME open state) of nsIWidget instances, manages IMEContentObserver
* and provides useful API for IME.
*/
class nsIMEStateManager
class IMEStateManager
{
friend class nsTextStateManager;
protected:
typedef mozilla::widget::IMEMessage IMEMessage;
typedef mozilla::widget::IMEState IMEState;
typedef mozilla::widget::InputContext InputContext;
typedef mozilla::widget::InputContextAction InputContextAction;
typedef widget::IMEMessage IMEMessage;
typedef widget::IMEState IMEState;
typedef widget::InputContext InputContext;
typedef widget::InputContextAction InputContextAction;
public:
static void Shutdown();
@ -92,14 +92,14 @@ public:
*/
static void DispatchCompositionEvent(nsINode* aEventTargetNode,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
WidgetEvent* aEvent,
nsEventStatus* aStatus,
nsDispatchingCallback* aCallBack);
/**
* Get TextComposition from widget.
*/
static already_AddRefed<mozilla::TextComposition>
static already_AddRefed<TextComposition>
GetTextCompositionFor(nsIWidget* aWidget);
/**
@ -108,8 +108,8 @@ public:
* @param aEvent Should be a composition event or a text event which is
* being dispatched.
*/
static already_AddRefed<mozilla::TextComposition>
GetTextCompositionFor(mozilla::WidgetGUIEvent* aEvent);
static already_AddRefed<TextComposition>
GetTextCompositionFor(WidgetGUIEvent* aEvent);
/**
* Send a notification to IME. It depends on the IME or platform spec what
@ -146,13 +146,15 @@ protected:
static bool sInstalledMenuKeyboardListener;
static bool sIsTestingIME;
static mozilla::IMEContentObserver* sActiveIMEContentObserver;
static IMEContentObserver* sActiveIMEContentObserver;
// All active compositions in the process are stored by this array.
// When you get an item of this array and use it, please be careful.
// The instances in this array can be destroyed automatically if you do
// something to cause committing or canceling the composition.
static mozilla::TextCompositionArray* sTextCompositions;
static TextCompositionArray* sTextCompositions;
};
#endif // nsIMEStateManager_h__
} // namespace mozilla
#endif // mozilla_IMEStateManager_h_

View File

@ -10,9 +10,9 @@
#include "nsEventDispatcher.h"
#include "nsIContent.h"
#include "nsIEditor.h"
#include "nsIMEStateManager.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/MiscEvents.h"
#include "mozilla/TextEvents.h"
@ -145,7 +145,7 @@ nsresult
TextComposition::NotifyIME(IMEMessage aMessage)
{
NS_ENSURE_TRUE(mPresContext, NS_ERROR_NOT_AVAILABLE);
return nsIMEStateManager::NotifyIME(aMessage, mPresContext);
return IMEStateManager::NotifyIME(aMessage, mPresContext);
}
void
@ -231,23 +231,23 @@ TextComposition::CompositionEventDispatcher::Run()
handler.OnQuerySelectedText(&selectedText);
NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
compStart.data = selectedText.mReply.mString;
nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&compStart, &status, nullptr);
IMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&compStart, &status, nullptr);
break;
}
case NS_COMPOSITION_UPDATE:
case NS_COMPOSITION_END: {
WidgetCompositionEvent compEvent(true, mEventMessage, mWidget);
compEvent.data = mData;
nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&compEvent, &status, nullptr);
IMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&compEvent, &status, nullptr);
break;
}
case NS_TEXT_TEXT: {
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
textEvent.theText = mData;
nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&textEvent, &status, nullptr);
IMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&textEvent, &status, nullptr);
break;
}
default:

View File

@ -20,10 +20,11 @@
class nsDispatchingCallback;
class nsIEditor;
class nsIMEStateManager;
namespace mozilla {
class IMEStateManager;
/**
* TextComposition represents a text composition. This class stores the
* composition event target and its presContext. At dispatching the event via
@ -32,7 +33,7 @@ namespace mozilla {
class TextComposition MOZ_FINAL
{
friend class ::nsIMEStateManager;
friend class IMEStateManager;
NS_INLINE_DECL_REFCOUNTING(TextComposition)
@ -71,7 +72,7 @@ public:
bool MatchesNativeContext(nsIWidget* aWidget) const;
/**
* This is called when nsIMEStateManager stops managing the instance.
* This is called when IMEStateManager stops managing the instance.
*/
void Destroy();
@ -145,7 +146,7 @@ public:
private:
// This class holds nsPresContext weak. This instance shouldn't block
// destroying it. When the presContext is being destroyed, it's notified to
// nsIMEStateManager::OnDestroyPresContext(), and then, it destroy
// IMEStateManager::OnDestroyPresContext(), and then, it destroy
// this instance.
nsPresContext* mPresContext;
nsCOMPtr<nsINode> mNode;
@ -252,7 +253,7 @@ private:
* DispatchCompositionEventRunnable() dispatches a composition or text event
* to the content. Be aware, if you use this method, nsPresShellEventCB
* isn't used. That means that nsIFrame::HandleEvent() is never called.
* WARNING: The instance which is managed by nsIMEStateManager may be
* WARNING: The instance which is managed by IMEStateManager may be
* destroyed by this method call.
*
* @param aEventMessage Must be one of composition event or text event.
@ -270,7 +271,7 @@ private:
* Managing with array is enough because only one composition is typically
* there. Even if user switches native IME context, it's very rare that
* second or more composition is started.
* It's assumed that this is used by nsIMEStateManager for storing all active
* It's assumed that this is used by IMEStateManager for storing all active
* compositions in the process. If the instance is it, each TextComposition
* in the array can be destroyed by calling some methods of itself.
*/

View File

@ -27,6 +27,7 @@ EXPORTS += [
]
EXPORTS.mozilla += [
'IMEStateManager.h',
'InternalMutationEvent.h',
]
@ -78,6 +79,7 @@ UNIFIED_SOURCES += [
'EventTarget.cpp',
'FocusEvent.cpp',
'IMEContentObserver.cpp',
'IMEStateManager.cpp',
'KeyboardEvent.cpp',
'MessageEvent.cpp',
'MouseEvent.cpp',
@ -91,7 +93,6 @@ UNIFIED_SOURCES += [
'nsEventDispatcher.cpp',
'nsEventListenerManager.cpp',
'nsEventListenerService.cpp',
'nsIMEStateManager.cpp',
'nsJSEventListener.cpp',
'nsPaintRequest.cpp',
'PointerEvent.cpp',

View File

@ -24,9 +24,9 @@
#include "nsISelectionPrivate.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsIMEStateManager.h"
#include "nsIObjectFrame.h"
#include "mozilla/dom/Element.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/TextEvents.h"
#include <algorithm>
@ -1096,9 +1096,9 @@ nsContentEventHandler::OnSelectionEvent(WidgetSelectionEvent* aEvent)
// Get selection to manipulate
// XXX why do we need to get them from ISM? This method should work fine
// without ISM.
nsresult rv = nsIMEStateManager::
GetFocusSelectionAndRoot(getter_AddRefs(mSelection),
getter_AddRefs(mRootContent));
nsresult rv =
IMEStateManager::GetFocusSelectionAndRoot(getter_AddRefs(mSelection),
getter_AddRefs(mRootContent));
if (rv != NS_ERROR_NOT_AVAILABLE) {
NS_ENSURE_SUCCESS(rv, rv);
} else {

View File

@ -69,7 +69,7 @@ public:
// FlatText means the text that is generated from DOM tree. The BR elements
// are replaced to native linefeeds. Other elements are ignored.
// Get the offset in FlatText of the range. (also used by nsIMEStateManager)
// Get the offset in FlatText of the range. (also used by IMEContentObserver)
static nsresult GetFlatTextOffsetOfRange(nsIContent* aRootContent,
nsINode* aNode,
int32_t aNodeOffset,

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Attributes.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/MiscEvents.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MouseEvents.h"
@ -17,7 +18,6 @@
#include "nsCOMPtr.h"
#include "nsEventStateManager.h"
#include "nsFocusManager.h"
#include "nsIMEStateManager.h"
#include "nsContentEventHandler.h"
#include "nsIContent.h"
#include "nsINodeInfo.h"
@ -3765,7 +3765,7 @@ nsEventStateManager::IsTargetCrossProcess(WidgetGUIEvent* aEvent)
void
nsEventStateManager::NotifyDestroyPresContext(nsPresContext* aPresContext)
{
nsIMEStateManager::OnDestroyPresContext(aPresContext);
IMEStateManager::OnDestroyPresContext(aPresContext);
if (mHoverContent) {
// Bug 70855: Presentation is going away, possibly for a reframe.
// Reset the hover state so that if we're recreating the presentation,
@ -5176,7 +5176,7 @@ nsEventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent
element->LeaveLink(element->GetPresContext());
}
nsIMEStateManager::OnRemoveContent(mPresContext, aContent);
IMEStateManager::OnRemoveContent(mPresContext, aContent);
// inform the focus manager that the content is being removed. If this
// content is focused, the focus will be removed without firing events.

View File

@ -25,6 +25,7 @@
#include "mozFlushType.h" // for mozFlushType::Flush_Frames
#include "mozISpellCheckingEngine.h"
#include "mozInlineSpellChecker.h" // for mozInlineSpellChecker
#include "mozilla/IMEStateManager.h" // for IMEStateManager
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/Selection.h" // for Selection, etc
#include "mozilla/Services.h" // for GetObserverService
@ -75,7 +76,6 @@
#include "nsIFrame.h" // for nsIFrame
#include "nsIHTMLDocument.h" // for nsIHTMLDocument
#include "nsIInlineSpellChecker.h" // for nsIInlineSpellChecker, etc
#include "nsIMEStateManager.h" // for nsIMEStateManager
#include "nsNameSpaceManager.h" // for kNameSpaceID_None, etc
#include "nsINode.h" // for nsINode, etc
#include "nsIObserverService.h" // for nsIObserverService
@ -315,7 +315,7 @@ nsEditor::PostCreate()
rv = GetPreferredIMEState(&newState);
NS_ENSURE_SUCCESS(rv, NS_OK);
nsCOMPtr<nsIContent> content = GetFocusedContentForIME();
nsIMEStateManager::UpdateIMEState(newState, content);
IMEStateManager::UpdateIMEState(newState, content);
}
return NS_OK;
}
@ -496,7 +496,7 @@ nsEditor::SetFlags(uint32_t aFlags)
// NOTE: When the enabled state isn't going to be modified, this method
// is going to do nothing.
nsCOMPtr<nsIContent> content = GetFocusedContentForIME();
nsIMEStateManager::UpdateIMEState(newState, content);
IMEStateManager::UpdateIMEState(newState, content);
}
}
@ -2016,10 +2016,10 @@ nsEditor::EnsureComposition(mozilla::WidgetGUIEvent* aEvent)
return;
}
// The compositionstart event must cause creating new TextComposition
// instance at being dispatched by nsIMEStateManager.
mComposition = nsIMEStateManager::GetTextCompositionFor(aEvent);
// instance at being dispatched by IMEStateManager.
mComposition = IMEStateManager::GetTextCompositionFor(aEvent);
if (!mComposition) {
MOZ_CRASH("nsIMEStateManager doesn't return proper composition");
MOZ_CRASH("IMEStateManager doesn't return proper composition");
}
mComposition->StartHandlingComposition(this);
}
@ -2095,10 +2095,10 @@ nsEditor::ForceCompositionEnd()
// Linux. Currently, nsGtkIMModule can know the timing of the cursor move,
// so, the latter meaning should be gone.
// XXX This may commit a composition in another editor.
return nsIMEStateManager::NotifyIME(NOTIFY_IME_OF_CURSOR_POS_CHANGED, pc);
return IMEStateManager::NotifyIME(NOTIFY_IME_OF_CURSOR_POS_CHANGED, pc);
}
return nsIMEStateManager::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, pc);
return IMEStateManager::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, pc);
}
NS_IMETHODIMP

View File

@ -770,7 +770,7 @@ public:
// Get the focused content, if we're focused. Returns null otherwise.
virtual already_AddRefed<nsIContent> GetFocusedContent();
// Get the focused content for the argument of some nsIMEStateManager's
// Get the focused content for the argument of some IMEStateManager's
// methods.
virtual already_AddRefed<nsIContent> GetFocusedContentForIME();

View File

@ -4,6 +4,7 @@
* 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 "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/IMEStateManager.h" // for IMEStateManager
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/TextEvents.h" // for WidgetCompositionEvent
#include "mozilla/dom/Element.h" // for Element
@ -38,7 +39,6 @@
#include "nsIFocusManager.h" // for nsIFocusManager
#include "nsIFormControl.h" // for nsIFormControl, etc
#include "nsIHTMLEditor.h" // for nsIHTMLEditor
#include "nsIMEStateManager.h" // for nsIMEStateManager
#include "nsINativeKeyBindings.h" // for nsINativeKeyBindings
#include "nsINode.h" // for nsINode, ::NODE_IS_EDITABLE, etc
#include "nsIPlaintextEditor.h" // for nsIPlaintextEditor, etc
@ -570,7 +570,7 @@ nsEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
nsPresContext* presContext =
presShell ? presShell->GetPresContext() : nullptr;
if (presContext && currentDoc) {
nsIMEStateManager::OnClickInEditor(presContext,
IMEStateManager::OnClickInEditor(presContext,
currentDoc->HasFlag(NODE_IS_EDITABLE) ? nullptr : focusedContent,
mouseEvent);
}
@ -954,7 +954,7 @@ nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
nsCOMPtr<nsIPresShell> ps = GetPresShell();
NS_ENSURE_TRUE(ps, NS_OK);
nsCOMPtr<nsIContent> focusedContent = mEditor->GetFocusedContentForIME();
nsIMEStateManager::OnFocusInEditor(ps->GetPresContext(), focusedContent);
IMEStateManager::OnFocusInEditor(ps->GetPresContext(), focusedContent);
return NS_OK;
}

View File

@ -24,6 +24,7 @@
#include "prlog.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/Likely.h"
@ -73,7 +74,6 @@
#include "nsIDOMHTMLDocument.h"
#include "nsFrameManager.h"
#include "nsEventStateManager.h"
#include "nsIMEStateManager.h"
#include "nsXPCOM.h"
#include "nsILayoutHistoryState.h"
#include "nsILineIterator.h" // for ScrollContentIntoView
@ -7254,7 +7254,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
if (eventTarget) {
if (aEvent->eventStructType == NS_COMPOSITION_EVENT ||
aEvent->eventStructType == NS_TEXT_EVENT) {
nsIMEStateManager::DispatchCompositionEvent(eventTarget,
IMEStateManager::DispatchCompositionEvent(eventTarget,
mPresContext, aEvent, aStatus, eventCBPtr);
} else {
nsEventDispatcher::Dispatch(eventTarget, mPresContext,

View File

@ -122,7 +122,7 @@ using namespace mozilla::system;
#include "nsCookieService.h"
#include "nsApplicationCacheService.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "nsIMEStateManager.h"
#include "mozilla/IMEStateManager.h"
#include "nsDocument.h"
#include "mozilla/dom/HTMLVideoElement.h"
@ -307,7 +307,7 @@ nsLayoutStatics::Shutdown()
txMozillaXSLTProcessor::Shutdown();
Attr::Shutdown();
nsEventListenerManager::Shutdown();
nsIMEStateManager::Shutdown();
IMEStateManager::Shutdown();
nsComputedDOMStyle::Shutdown();
nsCSSParser::Shutdown();
nsCSSRuleProcessor::Shutdown();

View File

@ -481,7 +481,7 @@ struct SizeConstraints {
nsIntSize mMaxSize;
};
// IMEMessage is shared by nsIMEStateManager and TextComposition.
// IMEMessage is shared by IMEStateManager and TextComposition.
// XXX Negative values are used in Android...
enum IMEMessage MOZ_ENUM_TYPE(int8_t)
{

View File

@ -14,12 +14,12 @@
#endif
#include "mozilla/dom/TabChild.h"
#include "mozilla/Hal.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/layers/CompositorChild.h"
#include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/TextEvents.h"
#include "PuppetWidget.h"
#include "nsIWidgetListener.h"
#include "nsIMEStateManager.h"
#include "TextComposition.h"
using namespace mozilla::dom;
@ -493,7 +493,7 @@ PuppetWidget::NotifyIMEOfUpdateComposition()
NS_ENSURE_TRUE(mTabChild, NS_ERROR_FAILURE);
nsRefPtr<TextComposition> textComposition =
nsIMEStateManager::GetTextCompositionFor(this);
IMEStateManager::GetTextCompositionFor(this);
NS_ENSURE_TRUE(textComposition, NS_ERROR_FAILURE);
nsEventStatus status;