Bug 1404206 - Part 1: Smart Location Bar should have special inputmode value, mozAwesomebar. r=smaug, r=gijs

Smart Location Bar (a.k.a URL bar) has some features, loading inputted URL
directly, searching bookmark items and history items, and search inputted words
with registered search engine.

So, it does not make sense its inputmode is "url".  E.g., neither showing URL
specific software keyboard nor switching IME open state automatically for
typing URL may not be expected in most cases.

Unfortunately, there is no proper inputmode value for Smart Location Bar.
Therefore, this patch uses "mozAwesomebar" value and accepts the value only in
chrome documents.  This value should be handled by each native IME handler
properly.

MozReview-Commit-ID: 7vUnbpg91F2
This commit is contained in:
Masayuki Nakano 2017-09-29 14:44:06 +09:00
Родитель bb6e7bf9b1
Коммит 093d53d74b
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -39,7 +39,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
<html:input anonid="input"
class="autocomplete-textbox urlbar-input textbox-input"
allowevents="true"
inputmode="url"
inputmode="mozAwesomebar"
xbl:inherits="tooltiptext=inputtooltiptext,value,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey,focused,textoverflow"/>
</xul:hbox>
<xul:image anonid="urlbar-go-button"

Просмотреть файл

@ -1310,6 +1310,11 @@ IMEStateManager::SetIMEState(const IMEState& aState,
nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
context.mHTMLInputInputmode);
if (context.mHTMLInputInputmode.EqualsLiteral("mozAwesomebar") &&
!nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
// mozAwesomebar should be allowed only in chrome
context.mHTMLInputInputmode.Truncate();
}
}
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,