Bug 1400092 - Move RTL direction and aligment styling for the location bar input field to a chrome stylesheet since it doesn't need to access .anonymous-div anymore. r?gijs draft
authorDão Gottwald <dao@mozilla.com>
Fri, 15 Sep 2017 14:41:19 +0200
changeset 665458 ca3399fe0371b78411562f4305ff01a083b22b69
parent 665390 893fe1549e1e7342a66514b65960f08d40810a34
child 731782 8386d9d7d92b42e8561fbfd0ec504aea6d9e5032
push id80062
push userdgottwald@mozilla.com
push dateFri, 15 Sep 2017 12:42:00 +0000
reviewersgijs
bugs1400092
milestone57.0a1
Bug 1400092 - Move RTL direction and aligment styling for the location bar input field to a chrome stylesheet since it doesn't need to access .anonymous-div anymore. r?gijs MozReview-Commit-ID: 5qutEsTojVt
browser/base/content/browser.css
browser/base/content/urlbarBindings.xml
layout/style/res/forms.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -541,16 +541,29 @@ toolbar:not(#TabsToolbar) > #personal-bo
   width: 1px;
   min-width: 1px;
 }
 
 #urlbar {
   -moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);
 }
 
+/* Display URLs left-to-right but right aligned in RTL mode. */
+html|input.urlbar-input:-moz-locale-dir(rtl) {
+  direction: ltr !important;
+  text-align: right !important;
+}
+
+/* Make sure that the location bar's alignment in RTL mode changes according
+   to the input box direction if the user switches the text direction using
+   cmd_switchTextDirection (which applies a dir attribute to the <input>). */
+html|input.urlbar-input[dir=ltr]:-moz-locale-dir(rtl) {
+  text-align: left !important;
+}
+
 /*
  * Display visual cue that browser is under remote control by Marionette.
  * This is to help users visually distinguish a user agent session that
  * is under remote control from those used for normal browsing sessions.
  *
  * Attribute is controlled by browser.js:/gRemoteControl.
  */
 #main-window[remotecontrol] #urlbar {
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -32,17 +32,17 @@ file, You can obtain one at http://mozil
         <children includes="image|deck|stack|box">
           <xul:image class="autocomplete-icon" allowevents="true"/>
         </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 uri-element-right-align"
+                      class="autocomplete-textbox urlbar-input textbox-input"
                       allowevents="true"
                       inputmode="url"
                       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;"
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -112,30 +112,16 @@ input {
 
 input > .anonymous-div,
 input::placeholder {
   word-wrap: normal !important;
   /* Make the line-height equal to the available height */
   line-height: -moz-block-height;
 }
 
-@-moz-document url-prefix(chrome://) {
-  input.uri-element-right-align:-moz-locale-dir(rtl) {
-    direction: ltr !important;
-    text-align: right !important;
-  }
-
-  /* Make sure that the location bar's alignment in RTL mode changes according
-     to the input box direction if the user switches the text direction using
-     cmd_switchTextDirection (which applies a dir attribute to the <input>). */
-  input.uri-element-right-align[dir=ltr]:-moz-locale-dir(rtl) {
-    text-align: left !important;
-  }
-}
-
 textarea {
   margin-block-start: 1px;
   margin-block-end: 1px;
   border: 2px inset ThreeDLightShadow;
   /* The 1px inline padding is for parity with Win/IE */
   padding-inline-start: 1px;
   padding-inline-end: 1px;
   background-color: -moz-Field;