Bug 1404206 - Part 1: Smart Location Bar should have special inputmode value, mozAwesomebar. r=smaug, r=gijs
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 29 Sep 2017 14:44:06 +0900
changeset 1311822 c5af9e7f8e360b76a8b11bafe16fad858a5317a3
parent 1311821 52a87a609fcb45416dfd14a0879a32f6702a3ead
child 1311823 3f0a70dd5077071808a3830a232fe4c65eb44c29
push id225897
push useropettay@mozilla.com
push dateWed, 04 Oct 2017 19:25:01 +0000
treeherdertry@2f2f41234c44 [default view] [failures only]
reviewerssmaug, gijs
bugs1404206
milestone58.0a1
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
browser/base/content/urlbarBindings.xml
dom/events/IMEStateManager.cpp
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -34,17 +34,17 @@ file, You can obtain one at http://mozil
         </children>
         <xul:hbox anonid="textbox-input-box"
                   class="textbox-input-box urlbar-input-box"
                   flex="1" xbl:inherits="tooltiptext=inputtooltiptext">
           <children/>
           <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"
                    class="urlbar-go-button urlbar-icon"
                    onclick="gURLBar.handleCommand(event);"
                    tooltiptext="&goEndCap.tooltip;"
                    xbl:inherits="pageproxystate,parentfocused=focused,usertyping"/>
         <xul:dropmarker anonid="historydropmarker"
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1305,16 +1305,21 @@ IMEStateManager::SetIMEState(const IMESt
     } else {
       context.mHTMLInputType.Assign(nsGkAtoms::textarea->GetUTF16String());
     }
 
     if (sInputModeSupported ||
         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,
                       context.mActionHint);
 
     // Get the input content corresponding to the focused node,
     // which may be an anonymous child of the input content.
     nsIContent* inputContent = aContent->FindFirstNonChromeOnlyAccessContent();