зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a00513981ecf (bug 1792515) for causing bug 1792767 CLOSED TREE
This commit is contained in:
Родитель
af9020d76a
Коммит
8df3106ce1
|
@ -2226,7 +2226,7 @@ nsDOMWindowUtils::GetFocusedInputMode(nsAString& aInputMode) {
|
|||
if (!widget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
aInputMode = widget->GetInputContext().mHTMLInputMode;
|
||||
aInputMode = widget->GetInputContext().mHTMLInputInputmode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1475,21 +1475,21 @@ MOZ_CAN_RUN_SCRIPT static void GetActionHint(const IMEState& aState,
|
|||
aActionHint.AssignLiteral("go");
|
||||
}
|
||||
|
||||
static void GetInputMode(const IMEState& aState, const nsIContent& aContent,
|
||||
nsAString& aInputMode) {
|
||||
static void GetInputmode(const IMEState& aState, const nsIContent& aContent,
|
||||
nsAString& aInputmode) {
|
||||
if (aState.IsEditable() &&
|
||||
(StaticPrefs::dom_forms_inputmode() ||
|
||||
nsContentUtils::IsChromeDoc(aContent.OwnerDoc()))) {
|
||||
aContent.AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
|
||||
aInputMode);
|
||||
aInputmode);
|
||||
if (aContent.IsHTMLElement(nsGkAtoms::input) &&
|
||||
aInputMode.EqualsLiteral("mozAwesomebar")) {
|
||||
aInputmode.EqualsLiteral("mozAwesomebar")) {
|
||||
if (!nsContentUtils::IsChromeDoc(aContent.OwnerDoc())) {
|
||||
// mozAwesomebar should be allowed only in chrome
|
||||
aInputMode.Truncate();
|
||||
aInputmode.Truncate();
|
||||
}
|
||||
} else {
|
||||
ToLowerCase(aInputMode);
|
||||
ToLowerCase(aInputmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1565,7 +1565,7 @@ void IMEStateManager::SetIMEState(const IMEState& aState,
|
|||
if (focusedElement && focusedElement->IsHTMLElement()) {
|
||||
GetInputType(aState, *focusedElement, context.mHTMLInputType);
|
||||
GetActionHint(aState, *focusedElement, context.mActionHint);
|
||||
GetInputMode(aState, *focusedElement, context.mHTMLInputMode);
|
||||
GetInputmode(aState, *focusedElement, context.mHTMLInputInputmode);
|
||||
GetAutocapitalize(aState, *focusedElement, context,
|
||||
context.mAutocapitalize);
|
||||
}
|
||||
|
|
|
@ -241,8 +241,8 @@ std::ostream& operator<<(std::ostream& aStream,
|
|||
std::ostream& operator<<(std::ostream& aStream, const InputContext& aContext) {
|
||||
aStream << "{ mIMEState=" << aContext.mIMEState
|
||||
<< ", mOrigin=" << aContext.mOrigin << ", mHTMLInputType=\""
|
||||
<< aContext.mHTMLInputType << "\", mHTMLInputMode=\""
|
||||
<< aContext.mHTMLInputMode << "\", mActionHint=\""
|
||||
<< aContext.mHTMLInputType << "\", mHTMLInputInputmode=\""
|
||||
<< aContext.mHTMLInputInputmode << "\", mActionHint=\""
|
||||
<< aContext.mActionHint << "\", mAutocapitalize=\""
|
||||
<< aContext.mAutocapitalize << "\", mMayBeIMEUnaware="
|
||||
<< (aContext.mMayBeIMEUnaware ? "true" : "false")
|
||||
|
|
|
@ -415,7 +415,7 @@ struct InputContext final {
|
|||
void ShutDown() {
|
||||
mURI = nullptr;
|
||||
mHTMLInputType.Truncate();
|
||||
mHTMLInputMode.Truncate();
|
||||
mHTMLInputInputmode.Truncate();
|
||||
mActionHint.Truncate();
|
||||
mAutocapitalize.Truncate();
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ struct InputContext final {
|
|||
// input type and inputmode are supported by Windows IME API, GTK
|
||||
// IME API and Android IME API
|
||||
mHTMLInputType != aOldContext.mHTMLInputType ||
|
||||
mHTMLInputMode != aOldContext.mHTMLInputMode ||
|
||||
mHTMLInputInputmode != aOldContext.mHTMLInputInputmode ||
|
||||
#endif
|
||||
#if defined(ANDROID) || defined(MOZ_WIDGET_GTK)
|
||||
// autocapitalize is supported by Android IME API and GTK IME API
|
||||
|
@ -469,8 +469,8 @@ struct InputContext final {
|
|||
/* The type of the input if the input is a html input field */
|
||||
nsString mHTMLInputType;
|
||||
|
||||
// The value of the inputmode
|
||||
nsString mHTMLInputMode;
|
||||
/* The type of the inputmode */
|
||||
nsString mHTMLInputInputmode;
|
||||
|
||||
/* A hint for the action that is performed when the input is submitted */
|
||||
nsString mActionHint;
|
||||
|
|
|
@ -1452,10 +1452,10 @@ GeckoEditableSupport::GetIMENotificationRequests() {
|
|||
}
|
||||
|
||||
static bool ShouldKeyboardDismiss(const nsAString& aInputType,
|
||||
const nsAString& aInputMode) {
|
||||
const nsAString& aInputmode) {
|
||||
// Some input type uses the prompt to input value. So it is unnecessary to
|
||||
// show software keyboard.
|
||||
return aInputMode.EqualsLiteral("none") || aInputType.EqualsLiteral("date") ||
|
||||
return aInputmode.EqualsLiteral("none") || aInputType.EqualsLiteral("date") ||
|
||||
aInputType.EqualsLiteral("time") ||
|
||||
aInputType.EqualsLiteral("month") ||
|
||||
aInputType.EqualsLiteral("week") ||
|
||||
|
@ -1478,7 +1478,7 @@ void GeckoEditableSupport::SetInputContext(const InputContext& aContext,
|
|||
|
||||
if (mInputContext.mIMEState.mEnabled != IMEEnabled::Disabled &&
|
||||
!ShouldKeyboardDismiss(mInputContext.mHTMLInputType,
|
||||
mInputContext.mHTMLInputMode) &&
|
||||
mInputContext.mHTMLInputInputmode) &&
|
||||
aAction.UserMightRequestOpenVKB()) {
|
||||
// Don't reset keyboard when we should simply open the vkb
|
||||
mEditable->NotifyIME(EditableListener::NOTIFY_IME_OPEN_VKB);
|
||||
|
@ -1514,10 +1514,10 @@ void GeckoEditableSupport::NotifyIMEContext(const InputContext& aContext,
|
|||
? EditableListener::IME_FOCUS_NOT_CHANGED
|
||||
: 0);
|
||||
|
||||
mEditable->NotifyIMEContext(static_cast<int32_t>(aContext.mIMEState.mEnabled),
|
||||
aContext.mHTMLInputType, aContext.mHTMLInputMode,
|
||||
aContext.mActionHint, aContext.mAutocapitalize,
|
||||
flags);
|
||||
mEditable->NotifyIMEContext(
|
||||
static_cast<int32_t>(aContext.mIMEState.mEnabled),
|
||||
aContext.mHTMLInputType, aContext.mHTMLInputInputmode,
|
||||
aContext.mActionHint, aContext.mAutocapitalize, flags);
|
||||
}
|
||||
|
||||
InputContext GeckoEditableSupport::GetInputContext() {
|
||||
|
|
|
@ -1348,15 +1348,15 @@ void IMContextWrapper::SetInputPurposeAndInputHints() {
|
|||
purpose = GTK_INPUT_PURPOSE_PHONE;
|
||||
} else if (inputType.EqualsLiteral("number")) {
|
||||
purpose = GTK_INPUT_PURPOSE_NUMBER;
|
||||
} else if (mInputContext.mHTMLInputMode.EqualsLiteral("decimal")) {
|
||||
} else if (mInputContext.mHTMLInputInputmode.EqualsLiteral("decimal")) {
|
||||
purpose = GTK_INPUT_PURPOSE_NUMBER;
|
||||
} else if (mInputContext.mHTMLInputMode.EqualsLiteral("email")) {
|
||||
} else if (mInputContext.mHTMLInputInputmode.EqualsLiteral("email")) {
|
||||
purpose = GTK_INPUT_PURPOSE_EMAIL;
|
||||
} else if (mInputContext.mHTMLInputMode.EqualsLiteral("numeric")) {
|
||||
} else if (mInputContext.mHTMLInputInputmode.EqualsLiteral("numeric")) {
|
||||
purpose = GTK_INPUT_PURPOSE_DIGITS;
|
||||
} else if (mInputContext.mHTMLInputMode.EqualsLiteral("tel")) {
|
||||
} else if (mInputContext.mHTMLInputInputmode.EqualsLiteral("tel")) {
|
||||
purpose = GTK_INPUT_PURPOSE_PHONE;
|
||||
} else if (mInputContext.mHTMLInputMode.EqualsLiteral("url")) {
|
||||
} else if (mInputContext.mHTMLInputInputmode.EqualsLiteral("url")) {
|
||||
purpose = GTK_INPUT_PURPOSE_URL;
|
||||
}
|
||||
// Search by type and inputmode isn't supported on GTK.
|
||||
|
@ -1365,7 +1365,7 @@ void IMContextWrapper::SetInputPurposeAndInputHints() {
|
|||
|
||||
// Although GtkInputHints is enum type, value is bit field.
|
||||
gint hints = GTK_INPUT_HINT_NONE;
|
||||
if (mInputContext.mHTMLInputMode.EqualsLiteral("none")) {
|
||||
if (mInputContext.mHTMLInputInputmode.EqualsLiteral("none")) {
|
||||
hints |= GTK_INPUT_HINT_INHIBIT_OSK;
|
||||
}
|
||||
|
||||
|
|
|
@ -813,7 +813,7 @@ struct ParamTraits<mozilla::widget::InputContext> {
|
|||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mIMEState);
|
||||
WriteParam(aWriter, aParam.mHTMLInputType);
|
||||
WriteParam(aWriter, aParam.mHTMLInputMode);
|
||||
WriteParam(aWriter, aParam.mHTMLInputInputmode);
|
||||
WriteParam(aWriter, aParam.mActionHint);
|
||||
WriteParam(aWriter, aParam.mAutocapitalize);
|
||||
WriteParam(aWriter, aParam.mOrigin);
|
||||
|
@ -826,7 +826,7 @@ struct ParamTraits<mozilla::widget::InputContext> {
|
|||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mIMEState) &&
|
||||
ReadParam(aReader, &aResult->mHTMLInputType) &&
|
||||
ReadParam(aReader, &aResult->mHTMLInputMode) &&
|
||||
ReadParam(aReader, &aResult->mHTMLInputInputmode) &&
|
||||
ReadParam(aReader, &aResult->mActionHint) &&
|
||||
ReadParam(aReader, &aResult->mAutocapitalize) &&
|
||||
ReadParam(aReader, &aResult->mOrigin) &&
|
||||
|
|
|
@ -1869,7 +1869,7 @@ bool TSFTextStore::Init(nsWindow* aWidget, const InputContext& aContext) {
|
|||
}
|
||||
|
||||
mInPrivateBrowsing = aContext.mInPrivateBrowsing;
|
||||
SetInputScope(aContext.mHTMLInputType, aContext.mHTMLInputMode);
|
||||
SetInputScope(aContext.mHTMLInputType, aContext.mHTMLInputInputmode);
|
||||
|
||||
if (aContext.mURI) {
|
||||
// We don't need the document URL if it fails, let's ignore the error.
|
||||
|
@ -3917,13 +3917,13 @@ bool TSFTextStore::ShouldSetInputScopeOfURLBarToDefault() {
|
|||
}
|
||||
|
||||
void TSFTextStore::SetInputScope(const nsString& aHTMLInputType,
|
||||
const nsString& aHTMLInputMode) {
|
||||
const nsString& aHTMLInputInputMode) {
|
||||
mInputScopes.Clear();
|
||||
|
||||
// IME may refer only first input scope, but we will append inputmode's
|
||||
// input scopes too like Chrome since IME may refer it.
|
||||
IMEHandler::AppendInputScopeFromType(aHTMLInputType, mInputScopes);
|
||||
IMEHandler::AppendInputScopeFromInputMode(aHTMLInputMode, mInputScopes);
|
||||
IMEHandler::AppendInputScopeFromInputmode(aHTMLInputInputMode, mInputScopes);
|
||||
|
||||
if (mInPrivateBrowsing) {
|
||||
mInputScopes.AppendElement(IS_PRIVATE);
|
||||
|
@ -6700,7 +6700,7 @@ void TSFTextStore::SetInputContext(nsWindow* aWidget,
|
|||
RefPtr<TSFTextStore> textStore(sEnabledTextStore);
|
||||
textStore->mInPrivateBrowsing = aContext.mInPrivateBrowsing;
|
||||
textStore->SetInputScope(aContext.mHTMLInputType,
|
||||
aContext.mHTMLInputMode);
|
||||
aContext.mHTMLInputInputmode);
|
||||
if (aContext.mURI) {
|
||||
nsAutoCString spec;
|
||||
if (NS_SUCCEEDED(aContext.mURI->GetSpec(spec))) {
|
||||
|
|
|
@ -382,7 +382,7 @@ class TSFTextStore final : public ITextStoreACP,
|
|||
HRESULT HandleRequestAttrs(DWORD aFlags, ULONG aFilterCount,
|
||||
const TS_ATTRID* aFilterAttrs);
|
||||
void SetInputScope(const nsString& aHTMLInputType,
|
||||
const nsString& aHTMLInputMode);
|
||||
const nsString& aHTMLInputInputMode);
|
||||
|
||||
// Creates native caret over our caret. This method only works on desktop
|
||||
// application. Otherwise, this does nothing.
|
||||
|
|
|
@ -425,7 +425,7 @@ void IMEHandler::SetInputContext(nsWindow* aWindow, InputContext& aInputContext,
|
|||
// FYI: If there is no composition, this call will do nothing.
|
||||
NotifyIME(aWindow, IMENotification(REQUEST_TO_COMMIT_COMPOSITION));
|
||||
|
||||
if (aInputContext.mHTMLInputMode.EqualsLiteral("none")) {
|
||||
if (aInputContext.mHTMLInputInputmode.EqualsLiteral("none")) {
|
||||
IMEHandler::MaybeDismissOnScreenKeyboard(aWindow, Sync::Yes);
|
||||
} else if (aAction.UserMightRequestOpenVKB()) {
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow, aInputContext);
|
||||
|
@ -453,7 +453,7 @@ void IMEHandler::SetInputContext(nsWindow* aWindow, InputContext& aInputContext,
|
|||
} else {
|
||||
// Set at least InputScope even when TextStore is not available.
|
||||
SetInputScopeForIMM32(aWindow, aInputContext.mHTMLInputType,
|
||||
aInputContext.mHTMLInputMode,
|
||||
aInputContext.mHTMLInputInputmode,
|
||||
aInputContext.mInPrivateBrowsing);
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ void IMEHandler::OnKeyboardLayoutChanged() {
|
|||
// static
|
||||
void IMEHandler::SetInputScopeForIMM32(nsWindow* aWindow,
|
||||
const nsAString& aHTMLInputType,
|
||||
const nsAString& aHTMLInputMode,
|
||||
const nsAString& aHTMLInputInputmode,
|
||||
bool aInPrivateBrowsing) {
|
||||
if (sIsInTSFMode || !sSetInputScopes || aWindow->Destroyed()) {
|
||||
return;
|
||||
|
@ -581,7 +581,7 @@ void IMEHandler::SetInputScopeForIMM32(nsWindow* aWindow,
|
|||
// IME may refer only first input scope, but we will append inputmode's
|
||||
// input scopes since IME may refer it like Chrome.
|
||||
AppendInputScopeFromType(aHTMLInputType, scopes);
|
||||
AppendInputScopeFromInputMode(aHTMLInputMode, scopes);
|
||||
AppendInputScopeFromInputmode(aHTMLInputInputmode, scopes);
|
||||
|
||||
if (aInPrivateBrowsing) {
|
||||
scopes.AppendElement(IS_PRIVATE);
|
||||
|
@ -597,9 +597,9 @@ void IMEHandler::SetInputScopeForIMM32(nsWindow* aWindow,
|
|||
}
|
||||
|
||||
// static
|
||||
void IMEHandler::AppendInputScopeFromInputMode(const nsAString& aHTMLInputMode,
|
||||
void IMEHandler::AppendInputScopeFromInputmode(const nsAString& aInputmode,
|
||||
nsTArray<InputScope>& aScopes) {
|
||||
if (aHTMLInputMode.EqualsLiteral("mozAwesomebar")) {
|
||||
if (aInputmode.EqualsLiteral("mozAwesomebar")) {
|
||||
// Even if Awesomebar has focus, user may not input URL directly.
|
||||
// However, on-screen keyboard for URL should be shown because it has
|
||||
// some useful additional keys like ".com" and they are not hindrances
|
||||
|
@ -627,19 +627,19 @@ void IMEHandler::AppendInputScopeFromInputMode(const nsAString& aHTMLInputMode,
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/dev/interaction.html#attr-inputmode
|
||||
if (aHTMLInputMode.EqualsLiteral("url")) {
|
||||
if (aInputmode.EqualsLiteral("url")) {
|
||||
if (!aScopes.Contains(IS_SEARCH)) {
|
||||
aScopes.AppendElement(IS_URL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (aHTMLInputMode.EqualsLiteral("email")) {
|
||||
if (aInputmode.EqualsLiteral("email")) {
|
||||
if (!aScopes.Contains(IS_EMAIL_SMTPEMAILADDRESS)) {
|
||||
aScopes.AppendElement(IS_EMAIL_SMTPEMAILADDRESS);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (aHTMLInputMode.EqualsLiteral("tel")) {
|
||||
if (aInputmode.EqualsLiteral("tel")) {
|
||||
if (!aScopes.Contains(IS_TELEPHONE_FULLTELEPHONENUMBER)) {
|
||||
aScopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER);
|
||||
}
|
||||
|
@ -648,19 +648,19 @@ void IMEHandler::AppendInputScopeFromInputMode(const nsAString& aHTMLInputMode,
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (aHTMLInputMode.EqualsLiteral("numeric")) {
|
||||
if (aInputmode.EqualsLiteral("numeric")) {
|
||||
if (!aScopes.Contains(IS_DIGITS)) {
|
||||
aScopes.AppendElement(IS_DIGITS);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (aHTMLInputMode.EqualsLiteral("decimal")) {
|
||||
if (aInputmode.EqualsLiteral("decimal")) {
|
||||
if (!aScopes.Contains(IS_NUMBER)) {
|
||||
aScopes.AppendElement(IS_NUMBER);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (aHTMLInputMode.EqualsLiteral("search")) {
|
||||
if (aInputmode.EqualsLiteral("search")) {
|
||||
if (NeedsSearchInputScope() && !aScopes.Contains(IS_SEARCH)) {
|
||||
aScopes.AppendElement(IS_SEARCH);
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ bool IMEHandler::IsOnScreenKeyboardSupported() {
|
|||
// static
|
||||
void IMEHandler::MaybeShowOnScreenKeyboard(nsWindow* aWindow,
|
||||
const InputContext& aInputContext) {
|
||||
if (aInputContext.mHTMLInputMode.EqualsLiteral("none")) {
|
||||
if (aInputContext.mHTMLInputInputmode.EqualsLiteral("none")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ class IMEHandler final {
|
|||
/**
|
||||
* Append InputScope values from inputmode string.
|
||||
*/
|
||||
static void AppendInputScopeFromInputMode(const nsAString& aHTMLInputMode,
|
||||
static void AppendInputScopeFromInputmode(const nsAString& aInputmode,
|
||||
nsTArray<InputScope>& aScopes);
|
||||
|
||||
/**
|
||||
|
@ -196,7 +196,7 @@ class IMEHandler final {
|
|||
static decltype(SetInputScopes)* sSetInputScopes;
|
||||
static void SetInputScopeForIMM32(nsWindow* aWindow,
|
||||
const nsAString& aHTMLInputType,
|
||||
const nsAString& aHTMLInputMode,
|
||||
const nsAString& aHTMLInputInputmode,
|
||||
bool aInPrivateBrowsing);
|
||||
static bool sIsInTSFMode;
|
||||
// If sIMMEnabled is false, any IME messages are not handled in TSF mode.
|
||||
|
|
Загрузка…
Ссылка в новой задаче