зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1711626 - Don't set InputType.TYPE_TEXT_FLAG_CAP_SENTENCES for some types. r=geckoview-reviewers,agi
Actually, we set auto-capitalize flag if current `<input>` element isn't text due to bug 871884. Most 3rd party keyboard ignores this flag if it is password. But Samsung's default keyboard uses this flag even if this is password. So we shouldn't set auto-capitalize flag if `<input>` element is password. Also, we also set this on `type=email` and `type=url`. But when I check Chrome behaviour, they don't set this flag on these types. So I would like not to set this flag to these types too. Differential Revision: https://phabricator.services.mozilla.com/D115677
This commit is contained in:
Родитель
fdcc651230
Коммит
19830e553c
|
@ -17,6 +17,8 @@
|
|||
<input type="PassWord" id="pass2" maxlength="8" value="foo">
|
||||
<input type="button" id="button1" value="foo"/>
|
||||
<input type="checkbox" id="checkbox1"/>
|
||||
<input type="search" id="search1">
|
||||
<input type="url" id="url1">
|
||||
<input type="hidden" id="hidden1" value="foo"/>
|
||||
|
||||
<iframe id="iframe"></iframe>
|
||||
|
|
|
@ -1185,7 +1185,7 @@ class AccessibilityTest : BaseSessionTest() {
|
|||
waitForInitialFocus()
|
||||
|
||||
assertThat("Initial auto-fill count should match",
|
||||
countAutoFillNodes(), equalTo(14))
|
||||
countAutoFillNodes(), equalTo(18))
|
||||
assertThat("Password auto-fill count should match",
|
||||
countAutoFillNodes({ it.isPassword }), equalTo(4))
|
||||
|
||||
|
@ -1199,7 +1199,7 @@ class AccessibilityTest : BaseSessionTest() {
|
|||
mainSession.goBack()
|
||||
waitForInitialFocus()
|
||||
assertThat("Should have auto-fill fields again",
|
||||
countAutoFillNodes(), equalTo(14))
|
||||
countAutoFillNodes(), equalTo(18))
|
||||
assertThat("Should not have focused field",
|
||||
countAutoFillNodes({ it.isFocused }), equalTo(0))
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ class AutofillDelegateTest : BaseSessionTest() {
|
|||
})
|
||||
|
||||
assertThat("Initial auto-fill count should match",
|
||||
countAutofillNodes(), equalTo(14))
|
||||
countAutofillNodes(), equalTo(16))
|
||||
|
||||
// Now wait for the nodes to clear.
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
|
@ -301,7 +301,7 @@ class AutofillDelegateTest : BaseSessionTest() {
|
|||
}
|
||||
})
|
||||
assertThat("Should have auto-fill fields again",
|
||||
countAutofillNodes(), equalTo(14))
|
||||
countAutofillNodes(), equalTo(16))
|
||||
assertThat("Should not have focused field",
|
||||
countAutofillNodes({ it.focused }), equalTo(0))
|
||||
|
||||
|
@ -325,9 +325,9 @@ class AutofillDelegateTest : BaseSessionTest() {
|
|||
// Hidden elements are ignored.
|
||||
// TODO: Is this actually correct? Should the whole focused branch be
|
||||
// visible or just the nodes as described above?
|
||||
assertThat("Should have seven visible nodes",
|
||||
assertThat("Should have nine visible nodes",
|
||||
countAutofillNodes({ node -> node.visible }),
|
||||
equalTo(6))
|
||||
equalTo(8))
|
||||
|
||||
mainSession.evaluateJS("document.querySelector('#pass2').blur()")
|
||||
sessionRule.waitUntilCalled(object : Callbacks.AutofillDelegate {
|
||||
|
|
|
@ -790,6 +790,44 @@ class TextInputDelegateTest : BaseSessionTest() {
|
|||
}))
|
||||
}
|
||||
|
||||
@WithDisplay(width = 512, height = 512) // Child process updates require having a display.
|
||||
@Test fun editorInfo_defaultByInputType() {
|
||||
assumeThat("type attribute is input element only", id, equalTo("#input"))
|
||||
// Disable this with WebRender due to unexpected abort by mozilla::gl::GLContext::fTexSubImage2D
|
||||
// (Bug 1706688, Bug 1710060 and etc)
|
||||
assumeThat(sessionRule.env.isWebrender and sessionRule.env.isDebugBuild, equalTo(false))
|
||||
|
||||
mainSession.textInput.view = View(InstrumentationRegistry.getInstrumentation().targetContext)
|
||||
mainSession.loadTestPath(FORMS_HTML_PATH)
|
||||
mainSession.waitForPageStop()
|
||||
|
||||
for (inputType in listOf("#email1", "#pass1", "#search1", "#tel1", "#url1")) {
|
||||
mainSession.evaluateJS("document.querySelector('$inputType').focus()")
|
||||
mainSession.waitUntilCalled(GeckoSession.TextInputDelegate::class, "restartInput")
|
||||
|
||||
val editorInfo = EditorInfo()
|
||||
mainSession.textInput.onCreateInputConnection(editorInfo)
|
||||
assertThat("EditorInfo.inputType of $inputType", editorInfo.inputType, equalTo(
|
||||
when (inputType) {
|
||||
"#email1" -> InputType.TYPE_CLASS_TEXT or
|
||||
InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
||||
"#pass1" -> InputType.TYPE_CLASS_TEXT or
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD
|
||||
"#search1" -> InputType.TYPE_CLASS_TEXT or
|
||||
InputType.TYPE_TEXT_FLAG_AUTO_CORRECT or
|
||||
InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE or
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
|
||||
"#tel1" -> InputType.TYPE_CLASS_PHONE
|
||||
"#url1" -> InputType.TYPE_CLASS_TEXT or
|
||||
InputType.TYPE_TEXT_VARIATION_URI
|
||||
else -> 0
|
||||
}))
|
||||
|
||||
mainSession.evaluateJS("document.querySelector('$inputType').blur()")
|
||||
mainSession.waitUntilCalled(GeckoSession.TextInputDelegate::class, "restartInput")
|
||||
}
|
||||
}
|
||||
|
||||
@WithDisplay(width = 512, height = 512) // Child process updates require having a display.
|
||||
@Test fun editorInfo_enterKeyHint() {
|
||||
// no way to set enterkeyhint on designmode.
|
||||
|
|
|
@ -1723,8 +1723,11 @@ import android.view.inputmethod.EditorInfo;
|
|||
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||
} else if (autocapitalize.equals("words")) {
|
||||
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
|
||||
} else if (!typeHint.equalsIgnoreCase("text") && modeHint.length() == 0) {
|
||||
} else if (modeHint.length() == 0 &&
|
||||
(outAttrs.inputType & InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0 &&
|
||||
!typeHint.equalsIgnoreCase("text")) {
|
||||
// auto-capitalized mode is the default for types other than text (bug 871884)
|
||||
// except to password, url and email.
|
||||
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче