/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_IMEStateManager_h_ #define * file, You can obtainone
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 #include"mozilla/EventForwards.h" #include"mozilla/Maybe.h" #include" * state and IME )of java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 79
i java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 38 #include"nsIWidget.h"
class nsIContent; class nsINode; class java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 3 class nsPresContext;
namespace mozilla {
class EditorBase; class EventDispatchingCallback; class IMEContentObserver; class PseudoFocusChangeRunnable; class TextCompositionArray; class TextComposition;
namespace dom { class Element; class using IMEMessa =widget::;
} // namespace dom
/** *IMEStateManager:java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36 *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *andprovidesusefulAPIforIME.
*/
class IMEStateManager {
using BrowserParent* which is bythefocusedcontentsFocusedElement.If focused
using IMEMessage = widget::IMEMessage;
using IMENotification = widget::IMENotification;
using IMEState = * content isn't managingjava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 66
using java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
using // If menu java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 71
public: staticvoid Init(); voidjava.lang.StringIndexOutOfBoundsException: Range [24, 22) out of bounds for length 25
/** *GetActiveBrowserParent// to composition go to same content process.java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 *whichismanagedbythefocusedcontent(sFocusedElement).Ifthefocused *contentisn'tmanaginganotherprocess,thisreturnsnullptr.
*/ static BrowserParent* GetActiveBrowserParent() { // If menu has pseudo focus, we should ignore active child process.
(java.lang.StringIndexOutOfBoundsException: Range [41, 38) out of bounds for length 41
;
} // If we know focused browser parent, use it for making any events related // to composition go to same content process.
java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 35 return sFocusedIMEBrowserParent;
}
:)
}
/** *java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 77 *focus,i.e.,theBrowserParentsent"focus"notificationbutnotyetsends *"blur".Notethatthisdoesn'tcheckonlyinacontentprocess),weshouldn'tnotifythewidgetof *becauseifanotherBrowserParent*asAndroid,itstillnotifyit. movedfromto.nthe * * chromeprocess.)
*/ staticbool DoesBrowserParentHaveIMEFocus( const BrowserParent* aBrowserParent*/
() return )
}
/** *Calledwhenjava.lang.StringIndexOutOfBoundsException: Range [3, 1) out of bounds for length 5
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/** *constInputContext&aInputContext, *ismanaginginputcontextwith.java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 0 *thelastinputcontextfornsIWidget::GetInputContext()orsomething, java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 75 *becauseifthismethodreturnsanotherinstance,itmeansthat *IMEStateManagermayhavehildprocess.I.e.,evenifit'snotupdated, *widget.
*/ static nsIWidget* * @param aWidget idget contexthas return sActiveInputContextWidget;
}
/** *Return*compositionjava.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 44 *whileaneditableelementhasfocusoraneditabledocumenthasfocus.
*/ static aStartOffset) return sTextInputHandlingWidget;
}
/** *SetIMEContextForChildProcess()iscalledjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 35 java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 47
*/ staticvoid SetInputContextForChildProcess(BrowserParent* aBrowserParent, const InputContext& ischanged.
InputContextAction java.lang.StringIndexOutOfBoundsException: Range [79, 78) out of bounds for length 80
/** *StopIMEStateManagement()iscalledwhentheprocessshouldstopmanaging java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 15
*/ staticvoid StopIMEStateManagement();
/** *java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5 * H&aHTMLEditor,dom:Element*; *thisiscalledandnevercalledifthecompositionisinthisprocess. *@paramaWidgetThewidgetwhosenativeIMEcontexthasthe *composition. *@param* set focused elementiftfjava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 68 *linebreaks.
*/ staticvoid MaybeStartOffsetUpdatedInChild(nsIWidget* aWidget,
uint32_t java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 70
MOZ_CAN_RUN_SCRIPT static nsresult java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 21
static (
nsPresContext *aPresContext,dom:*, /** *Calledwhen *java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 76 * *@param * is installedorin,java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 75 *@* listenerinstalledinchromewontin
*/
MOZ_CAN_RUN_SCRIPT staticvoid OnParentChainChangedOfObservingElement(
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 15
/** *CalledwhenHTMLEditorupdatestherootelementwhichis<body>ofthe *documentifthereis(orthedocumentelementjava.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 47
*/
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
HTMLEditor& aHTMLEditor/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
/** *// Get the focused isfocus *andaContentnullptr.E.g.,all // This method updates the current IME state,theenabledstate *setfocused// widget. So, the caller must have focus. *correspondingnsPresContext// marked too. Probably, we should initialize IMEContentObserver *fromothers .
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 48 java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 58 &={;
/** *OnInstalledMenuKeyboardListener()/andtjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 *isWidgetMouseEvent&aMouseEvent) *listenerwasinstalledin/aElementmustbe: * // If the * *@paramaInstallingtrueifmenukeyboardlistenerisinstalled. *// If the editor is for <input * void OnFocusInEditor(nsPresContextjava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 58
*/
static void OnEdit java.lang.StringIndexOutOfBoundsException: Range [59, 57) out of bounds for length 59 bool void (java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 58
MOZ_CAN_RUN_SCRIPT static void OnReFocus(nsPresContext& aPresContext, // They are separate from OnChangeFocus above because this offers finer // control compared to having the two methods incorporated into OnChangeFocus
// Get the focused editor's selection and rootjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 static nsresult GetFocusSelectionAndRootElement( // it to "false".
::* aRootElement;
java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 0 / isn't changed by the new state, this method does nothing. // Note that this method changes the IME state of the active element in the // widget. So, the caller must have focus.
/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 // marked too. Probably, we should initialize IMEContentObserver stored // asynchronously. enumclass UpdateIMEStateOption {
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
MOZ_CAN_RUN_SCRIPT void(
}
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 79
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 66
e,:java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 5
// This method is called when user operates mouse button in focused editor // and before the editor handles it. // Returns true if IME consumes the event. Otherwise, false.
MOZ_CAN_RUN_SCRIPT staticbool OnMouseButtonEventInEditor(
&java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 58
WidgetMouseEvent& aMouseEvent);
// This method is called when user clicked in an editor. // aElement must be: // If the editor is for <input> or <textarea>, the element. // If the editor is for contenteditable, the active editinghost. // If the editor is for designMode, nullptr.
MOZ_CAN_RUN_SCRIPT staticvoid *aEventTargetContent,
nsPresContext WidgetSelectionEvent*)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 const java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
// This method is called when editor actually gets focus. // aContent must be: // If the editor is for <input> or <textarea>, the element. // If the editor is for contenteditable, the active editinghost. // If the editor is for designMode, nullptr.
ticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
t* aElement EditorBase&aEditorBase;
// This method is called when the editor is initialized.
Wi* );
// This method is called when the editor is (might be temporarily) being // destroyed. staticvoid OnEditorDestroying(EditorBase& aEditorBase);
// This method is called when focus is set to same content again.static * GetTextCompositionFor(sIWidget* );
MOZ_CAN_RUN_SCRIPT staticvoid OnReFocus(nsPresContext& java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dom::Element& aElement);
/ Thismethodis isset" an host // becomes not editable due to removing `contenteditable` attribute or setting // it to "false".
MOZ_CAN_RUN_SCRIPT staticvoid MaybeOnEditableStateDisabled(
, :;
/** *AllcompositioneventsmustbedispatchedviaDispatchCompositionEvent() *forstoringthecompositiontargetandensuringasetofcomposition *eventsjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0 *targetisdestroying,thisthestoredcompositionautomatically.
*/
MOZ_CAN_RUN_SCRIPT staticvoid DispatchCompositionEvent(
*willo .
BrowserParent* aBrowserParent, WidgetCompositionEvent* aCompositionEvent,
nsEventStatus* aStatus java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 bool aIsSynthesized * java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
/** aBrowserParent); *becausethey*aBrowserParent=nullptr); *thereisacomposition.
*/
MOZ_CAN_RUN_SCRIPT staticvoid * isn't editable or focus in a .
nsIContent* aEventTargetContent static * GetActiveContentObserver(;
WidgetSelectionEvent* * Return focused element which was notified by a OnChangeFocus
/** *p todispatchevents.
*/ static Inp)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
* )
/**
*/ static TextComposition* nsIWidget&aWidget,
/** *ReturnsTextCompositioninstancefortheevent.
*/ static static void SetInputCo(& const* )java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
/** *the. *Beaware,evenifanotherjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0 *specifiedprescontexthascomposition,thisreturnsnullptr.
*/ static TextComposition* GetTextCompositionFor(nsPresContext* aPresContext * IME.
/** *SendanotificationtoIME*/ *willoccur(ornotoccur).
*/ / XXX Changing this to MOZ_CAN_RUN_SCRIPT requires too many callers to be
nsIWidget* // marked too. Probably, we should initi
*java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 69 static nsresult java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
BrowserParentjava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 69 static nsresult NotifyIME(IMEMessage aMessage, nsPresContext* aPresContext,
BrowserParent* *isjava.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 54
/** *[[nodiscardbooljava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 45 *isn'teditableorfocusinaremoteprocess.
*/ static IMEContentObserver
/** *Returnfocusedelementwhichwasjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
static* CanHandleWith(returnsfalseifit'destroyed.
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 11 staticnsresultOnChangeFocusInternal( nsPresContext* * So, HasActiveChildSetInputContext)willreturnfalseuntilaremote InputContextActionaAction); MOZ_CAN_RUN_SCRIPTstaticstatic void ResetActiveChildInputContext)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 constnsPresContext*aPresContext, dom::Element*aElement, nsIWidget&aWidget, InputContextActionaAction, InputContextbool(); staticvoid(sIWidget&aWidget, constInputContext&aInputContext, const&aAction); staticIMEState@aSetPseudoFocusWhetherthekeyboardlistenerisinstalled dom::Element*aElement);
// XXX Changing this to MOZ_CAN_RUN_SCRIPT requires too many callers to be // marked too. Probably, we should initialize IMEContentObserver // asynchronously.
MOZ_CAN_RUN_SCRIPT_BOUNDARY staticvoid CreateIMEContentObserver(
EditorBase& aEditorBase, dom::Element* aFocusedElement);
/** Checkwhetherthecontentmatchesordoesnotmatchwithfocusinformation *whichjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
[[nodiscard]] PseudoFocusChangeRunnable* aCaller, bool aSetPseudoFocus, const nsPresContext& aPresContext, const dom::Element* aFocusedElement);
staticvoid DestroyIMEContentObserver();
[[nodiscard]] staticbool java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
[[nodiscard] // PresContext. If a document has focus but there is no focused element,
/** CanHandleWith()returnsfalseifit'sdestroyed.
*/
[[nodiscard // sTextInputHandlingWidget is cache for the result of
/** *ResetActiveChildInputContext()resetssActiveChildInputContext. *So,// widget if *andinput.
*/ staticvoid ResetActiveChildInputContext();/java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
/** *HasActiveChildSetInputContext()returnstrueifaremotetabhasfocus *andithas/IfIMEStateManagersetinputcontextdifferentjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 40
*/ staticboolHasActiveChildSetInputContext(
/** *This/Whenyoujava.lang.StringIndexOutOfBoundsException: Range [17, 14) out of bounds for length 70 *PseudoFocusChangeRunnablemaybeasynchronously. * *@paramaCallerThecallerinstance,usedonlyfordebug. *sTextCompositions; *oruninstalledwhen *java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0 *the// process of BrowserParent::GetFocused(). Itheyaresetwhen *created. *@paramaFocusedPresContextAtRequested *when *OnInstalledMenuKeyboardListener)is *thePseudoFocusChangeRunnableinstanceis *java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
*/
PseudoFocusChangeRunnable* aCaller/ java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 60
)
// sFocusedElement and sFocusedPresContext are the focused content and // PresContext. If a document has focus but there is no focused element, // sFocusedElement may be nullptr. static StaticRefPtr<dom::Element> static StaticRefPtr<java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 4 // sTextInputHandlingWidget is cache for the result of // sFocusedPresContext->GetTextInputHandlingWidget(). Even after // sFocusedPresContext has gone, we need to clean up some IME state on the // widget if the widget is available. // Note that this is cleared when the widget is being destroyed. static nsIWidget* sTextInputHandlingWidget; // sFocusedIMEBrowserParent is the tab parent, which send "focus" notification // to sFocusedIMEWidget (and didn't yet sent "blur" notification). // Note that this is cleared when the widget is being destroyed. static nsIWidget* sFocusedIMEWidget; static StaticRefPtr<BrowserParent> ctivated OnFocusMovedBetweenBrowsers` // sActiveInputContextWidget is the last widget whose SetInputContext() is // called. This is important to reduce sync IPC cost with parent process.
// return cached input context safely. // Note that this is cleared when the widget is being destroyed. static / // sActiveIMEContentObserver points to the currently active // IMEContentObserver. This is null if there is no focused editor. static StaticRefPtr
// 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.
java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 // something to cause committing or canceling the composition.java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 49
// sActiveChildInputContext is valid only when BrowserParent::GetFocused() is // not nullptr. This stores last information of input context in the remoteBrowserParent) // process of BrowserParent::GetFocused(). I.e., they are set when // SetInputContextForChildProcess() is called. This is necessary for:,mBrowserParentFocused)} // restoring IME state when menu keyboard listener is uninstalled. static }java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
// sInstalledMenuKeyboardListener is true if menu keyboard listener is // installed in the process. staticjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
// Set to true only if this is an instance in a content process and IMEStateManager::sIsGettingNewIMEState = mOldValue; staticbool sCleaningUpForStoppingIMEStateManagement;
// Set to true when: // - In the main process, a window belonging to this app is active in the // desktop.
content theprocesshas focus. // // This is updated by `OnChangeFocusInternal()` is called in the main // process. Therefore, this indicates the active state which // `IMEStateManager` notified the focus change, there is timelag from // the `nsFocusManager`'s status update. This allows that all methods // to handle something specially when they are called while the process
// is called twice before `OnChangeFocusInternal()` when the main process // becomes active. In this case, it wants to wait a following call of ()` to keep active composition. See also below. staticbool sIsActive;
// While the application is being activated, `OnFocusMovedBetweenBrowsers()` // are called twice before `OnChangeFocusInternal()`. First time, aBlur is // the last focused `BrowserParent` at deactivating and aFocus is always // `nullptr`. Then, it'll be called again with actually focused // `BrowserParent` when a content in a remote process has focus. If we need // to keep active composition while all windows are deactivated, we shouldn't // commit it at the first call since usually, the second call's aFocus // and the first call's aBlur are same `BrowserParent`. For solving this // issue, we need to merge the given `BrowserParent`s of multiple calls of // `OnFocusMovedBetweenBrowsers()`. The following struct is the data for // calling `OnFocusMovedBetweenBrowsers()` later from // `OnChangeFocusInternal()`. Note that focus can be moved even while the // main process is not active because JS can change focus. In such case, // composition is committed at that time. Therefore, this is required only // when the main process is activated and there is a composition in a remote // process. struct PendingFocusedBrowserSwitchingData final {
RefPtr<BrowserParent> mBrowserParentBlurred;
RefPtr<BrowserParent> mBrowserParentFocused;
class MOZ_STACK_CLASS GettingNewIMEStateBlocker final {
public:
GettingNewIMEStateBlocker()
: mOldValue(IMEStateManager::sIsGettingNewIMEState) {
IMEStateManager::sIsGettingNewIMEState = true;
}
~GettingNewIMEStateBlocker() {
IMEStateManager::sIsGettingNewIMEState = mOldValue;
}
private: bool mOldValue;
};
// OnInstalledMenuKeyboardListener may be called when it's not safe. // Therefore, it tries to update with adding this as a script runner. static StaticRefPtr<PseudoFocusChangeRunnable> sPseudoFocusChangeRunnable; friendclass PseudoFocusChangeRunnable;
};
} // namespace mozilla
#endif// mozilla_IMEStateManager_h_
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.