mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1463985 - part 9: Rename EditSubAction::insertIMEText to EditSubAction::eInsertTextComingFromIME r=m_kato
MozReview-Commit-ID: 1TmryMStB7H --HG-- extra : rebase_source : 33dea12fe1ce0d5b9ea9ee13681949f288056d2a
This commit is contained in:
parent
63f1437458
commit
99a921d037
@ -45,7 +45,10 @@ enum class EditSubAction : int32_t
|
||||
// eInsertText indicates to insert some characters.
|
||||
eInsertText,
|
||||
|
||||
insertIMEText,
|
||||
// eInsertTextComingFromIME indicates to insert or update composition string
|
||||
// with new text which is new composition string or commit string.
|
||||
eInsertTextComingFromIME,
|
||||
|
||||
deleteSelection,
|
||||
setTextProperty,
|
||||
removeTextProperty,
|
||||
|
@ -371,7 +371,7 @@ HTMLEditRules::BeforeEdit(EditSubAction aEditSubAction,
|
||||
|
||||
// Remember current inline styles for deletion and normal insertion ops
|
||||
if (aEditSubAction == EditSubAction::eInsertText ||
|
||||
aEditSubAction == EditSubAction::insertIMEText ||
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
aEditSubAction == EditSubAction::deleteSelection ||
|
||||
IsStyleCachePreservingSubAction(aEditSubAction)) {
|
||||
nsCOMPtr<nsINode> selNode =
|
||||
@ -518,7 +518,7 @@ HTMLEditRules::AfterEditInner(EditSubAction aEditSubAction,
|
||||
|
||||
// merge any adjacent text nodes
|
||||
if (aEditSubAction != EditSubAction::eInsertText &&
|
||||
aEditSubAction != EditSubAction::insertIMEText) {
|
||||
aEditSubAction != EditSubAction::eInsertTextComingFromIME) {
|
||||
nsresult rv = HTMLEditorRef().CollapseAdjacentTextNodes(mDocChangeRange);
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
@ -536,7 +536,7 @@ HTMLEditRules::AfterEditInner(EditSubAction aEditSubAction,
|
||||
|
||||
// attempt to transform any unneeded nbsp's into spaces after doing various operations
|
||||
if (aEditSubAction == EditSubAction::eInsertText ||
|
||||
aEditSubAction == EditSubAction::insertIMEText ||
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
aEditSubAction == EditSubAction::deleteSelection ||
|
||||
aEditSubAction == EditSubAction::insertBreak ||
|
||||
aEditSubAction == EditSubAction::htmlPaste ||
|
||||
@ -572,7 +572,7 @@ HTMLEditRules::AfterEditInner(EditSubAction aEditSubAction,
|
||||
|
||||
// adjust selection for insert text, html paste, and delete actions
|
||||
if (aEditSubAction == EditSubAction::eInsertText ||
|
||||
aEditSubAction == EditSubAction::insertIMEText ||
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
aEditSubAction == EditSubAction::deleteSelection ||
|
||||
aEditSubAction == EditSubAction::insertBreak ||
|
||||
aEditSubAction == EditSubAction::htmlPaste ||
|
||||
@ -585,7 +585,7 @@ HTMLEditRules::AfterEditInner(EditSubAction aEditSubAction,
|
||||
|
||||
// check for any styles which were removed inappropriately
|
||||
if (aEditSubAction == EditSubAction::eInsertText ||
|
||||
aEditSubAction == EditSubAction::insertIMEText ||
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
aEditSubAction == EditSubAction::deleteSelection ||
|
||||
IsStyleCachePreservingSubAction(aEditSubAction)) {
|
||||
HTMLEditorRef().mTypeInState->UpdateSelState(&SelectionRef());
|
||||
@ -681,7 +681,7 @@ HTMLEditRules::WillDoAction(Selection* aSelection,
|
||||
|
||||
switch (aInfo.mEditSubAction) {
|
||||
case EditSubAction::eInsertText:
|
||||
case EditSubAction::insertIMEText:
|
||||
case EditSubAction::eInsertTextComingFromIME:
|
||||
UndefineCaretBidiLevel();
|
||||
return WillInsertText(aInfo.mEditSubAction, aCancel, aHandled,
|
||||
aInfo.inString, aInfo.outString,
|
||||
@ -758,7 +758,7 @@ HTMLEditRules::DidDoAction(Selection* aSelection,
|
||||
switch (aInfo.mEditSubAction) {
|
||||
case EditSubAction::eInsertText:
|
||||
case EditSubAction::insertBreak:
|
||||
case EditSubAction::insertIMEText:
|
||||
case EditSubAction::eInsertTextComingFromIME:
|
||||
return NS_OK;
|
||||
case EditSubAction::deleteSelection:
|
||||
return DidDeleteSelection();
|
||||
@ -1415,7 +1415,7 @@ HTMLEditRules::WillInsert(bool* aCancel)
|
||||
|
||||
if (mDidDeleteSelection &&
|
||||
(mTopLevelEditSubAction == EditSubAction::eInsertText ||
|
||||
mTopLevelEditSubAction == EditSubAction::insertIMEText ||
|
||||
mTopLevelEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
mTopLevelEditSubAction == EditSubAction::deleteSelection)) {
|
||||
nsresult rv = ReapplyCachedStyles();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@ -1499,7 +1499,7 @@ HTMLEditRules::WillInsertText(EditSubAction aEditSubAction,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aEditSubAction == EditSubAction::insertIMEText) {
|
||||
if (aEditSubAction == EditSubAction::eInsertTextComingFromIME) {
|
||||
// Right now the WSRunObject code bails on empty strings, but IME needs
|
||||
// the InsertTextWithTransaction() call to still happen since empty strings
|
||||
// are meaningful there.
|
||||
@ -7131,7 +7131,7 @@ HTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere,
|
||||
// we do one thing for text actions, something else entirely for other
|
||||
// actions
|
||||
if (aEditSubAction == EditSubAction::eInsertText ||
|
||||
aEditSubAction == EditSubAction::insertIMEText ||
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
aEditSubAction == EditSubAction::insertBreak ||
|
||||
aEditSubAction == EditSubAction::eDeleteText) {
|
||||
bool isSpace, isNBSP;
|
||||
@ -7380,7 +7380,7 @@ HTMLEditRules::PromoteRange(nsRange& aRange,
|
||||
}
|
||||
|
||||
if (aEditSubAction == EditSubAction::eInsertText ||
|
||||
aEditSubAction == EditSubAction::insertIMEText ||
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME ||
|
||||
aEditSubAction == EditSubAction::insertBreak ||
|
||||
aEditSubAction == EditSubAction::eDeleteText) {
|
||||
if (!startNode->IsContent() ||
|
||||
|
@ -187,8 +187,8 @@ protected:
|
||||
* This method may actually inserts text into the editor. Therefore, this
|
||||
* might cause destroying the editor.
|
||||
*
|
||||
* @param aEditSubAction Must be EditSubAction::insertIMEText or
|
||||
* EditSubAction::eInsertText.
|
||||
* @param aEditSubAction Must be EditSubAction::eInsertTextComingFromIME
|
||||
* or EditSubAction::eInsertText.
|
||||
* @param aCancel Returns true if the operation is canceled.
|
||||
* @param aHandled Returns true if the edit action is handled.
|
||||
* @param inString String to be inserted.
|
||||
|
@ -331,7 +331,7 @@ TextEditRules::WillDoAction(Selection* aSelection,
|
||||
UndefineCaretBidiLevel();
|
||||
return WillInsertBreak(aCancel, aHandled, aInfo.maxLength);
|
||||
case EditSubAction::eInsertText:
|
||||
case EditSubAction::insertIMEText:
|
||||
case EditSubAction::eInsertTextComingFromIME:
|
||||
UndefineCaretBidiLevel();
|
||||
return WillInsertText(aInfo.mEditSubAction, aCancel, aHandled,
|
||||
aInfo.inString, aInfo.outString,
|
||||
@ -681,7 +681,8 @@ TextEditRules::WillInsertText(EditSubAction aEditSubAction,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (inString->IsEmpty() && aEditSubAction != EditSubAction::insertIMEText) {
|
||||
if (inString->IsEmpty() &&
|
||||
aEditSubAction != EditSubAction::eInsertTextComingFromIME) {
|
||||
// HACK: this is a fix for bug 19395
|
||||
// I can't outlaw all empty insertions
|
||||
// because IME transaction depend on them
|
||||
@ -707,7 +708,7 @@ TextEditRules::WillInsertText(EditSubAction aEditSubAction,
|
||||
// If we're exceeding the maxlength when composing IME, we need to clean up
|
||||
// the composing text, so we shouldn't return early.
|
||||
if (truncated && outString->IsEmpty() &&
|
||||
aEditSubAction != EditSubAction::insertIMEText) {
|
||||
aEditSubAction != EditSubAction::eInsertTextComingFromIME) {
|
||||
*aCancel = true;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -743,7 +744,7 @@ TextEditRules::WillInsertText(EditSubAction aEditSubAction,
|
||||
// this has the side effect of changing all the characters in aOutString
|
||||
// to the replacement character
|
||||
if (IsPasswordEditor() &&
|
||||
aEditSubAction == EditSubAction::insertIMEText) {
|
||||
aEditSubAction == EditSubAction::eInsertTextComingFromIME) {
|
||||
RemoveIMETextFromPWBuf(start, outString);
|
||||
}
|
||||
|
||||
@ -810,7 +811,7 @@ TextEditRules::WillInsertText(EditSubAction aEditSubAction,
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (aEditSubAction == EditSubAction::insertIMEText) {
|
||||
if (aEditSubAction == EditSubAction::eInsertTextComingFromIME) {
|
||||
// Find better insertion point to insert text.
|
||||
EditorRawDOMPoint betterInsertionPoint =
|
||||
TextEditorRef().FindBetterInsertionPoint(atStartOfSelection);
|
||||
|
@ -155,8 +155,8 @@ protected:
|
||||
* This method may actually inserts text into the editor. Therefore, this
|
||||
* might cause destroying the editor.
|
||||
*
|
||||
* @param aEditSubAction Must be EditSubAction::insertIMEText or
|
||||
* EditSubAction::eInsertText.
|
||||
* @param aEditSubAction Must be EditSubAction::eInsertTextComingFromIME
|
||||
* or EditSubAction::eInsertText.
|
||||
* @param aCancel Returns true if the operation is canceled.
|
||||
* @param aHandled Returns true if the edit action is handled.
|
||||
* @param inString String to be inserted.
|
||||
@ -535,7 +535,7 @@ public:
|
||||
|
||||
EditSubAction mEditSubAction;
|
||||
|
||||
// EditSubAction::eInsertText / EditSubAction::insertIMEText
|
||||
// EditSubAction::eInsertText / EditSubAction::eInsertTextComingFromIME
|
||||
const nsAString* inString;
|
||||
nsAString* outString;
|
||||
const nsAString* outputFormat;
|
||||
|
@ -950,7 +950,9 @@ TextEditor::InsertTextAsAction(const nsAString& aStringToInsert)
|
||||
|
||||
EditSubAction editSubAction = EditSubAction::eInsertText;
|
||||
if (ShouldHandleIMEComposition()) {
|
||||
editSubAction = EditSubAction::insertIMEText;
|
||||
// So, the string must come from IME as new composition string or
|
||||
// commit string.
|
||||
editSubAction = EditSubAction::eInsertTextComingFromIME;
|
||||
}
|
||||
|
||||
AutoPlaceholderBatch batch(this, nullptr);
|
||||
|
@ -128,7 +128,7 @@ mozInlineSpellStatus::InitForEditorChange(
|
||||
}
|
||||
|
||||
bool deleted = aEditSubAction == EditSubAction::deleteSelection;
|
||||
if (aEditSubAction == EditSubAction::insertIMEText) {
|
||||
if (aEditSubAction == EditSubAction::eInsertTextComingFromIME) {
|
||||
// IME may remove the previous node if it cancels composition when
|
||||
// there is no text around the composition.
|
||||
deleted = !aPreviousNode->IsInComposedDoc();
|
||||
|
Loading…
Reference in New Issue
Block a user