Bug 416013 - switching the text input direction should not affect emptytext. r=ehsan,gavin
authorDão Gottwald <dao@mozilla.com>
Tue, 13 Jan 2009 02:28:32 +0100
changeset 23573 b5120305d873923f8273675b7b742cc37f48a0d3
parent 23572 caf24afe46eb914c5c85e83a5addcf92ae8699ec
child 23574 7b1292782cd39c59fbe1e14986eda53a16ca7f9e
push id4614
push userdgottwald@mozilla.com
push dateTue, 13 Jan 2009 01:29:11 +0000
treeherdermozilla-central@b5120305d873 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, gavin
bugs416013
milestone1.9.2a1pre
Bug 416013 - switching the text input direction should not affect emptytext. r=ehsan,gavin
toolkit/content/widgets/textbox.xml
toolkit/content/xul.css
--- a/toolkit/content/widgets/textbox.xml
+++ b/toolkit/content/widgets/textbox.xml
@@ -200,16 +200,20 @@
 
       <constructor><![CDATA[
         var str = this.boxObject.getProperty("value");
         if (str) {
           this.inputField.value = str;
           this.boxObject.removeProperty("value");
         }
 
+        // Bindings that extend this one wouldn't inherit the
+        // chromedir attribute if it would only be set in <content>.
+        this.setAttribute("chromedir", "]]>&locale.dir;<![CDATA[");
+
         this._updateVisibleText();
         this._setNewlineHandling();
       ]]></constructor>
 
       <destructor>
         <![CDATA[
           if (this.inputField.value)
             this.boxObject.setProperty('value', this.inputField.value);
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -653,16 +653,28 @@ html|*.textbox-input {
   text-shadow: inherit;
 }
 
 html|*.textbox-textarea {
   -moz-appearance: none !important;
   text-shadow: inherit;
 }
 
+textbox[empty="true"] html|*.textbox-input ,
+textbox[empty="true"] html|*.textbox-textarea {
+  text-align: left;
+  direction: ltr;
+}
+
+textbox[empty="true"][chromedir="rtl"] html|*.textbox-input ,
+textbox[empty="true"][chromedir="rtl"] html|*.textbox-textarea {
+  text-align: right;
+  direction: rtl;
+}
+
 textbox[empty="true"] html|*.textbox-input[emptytextdelay="true"] ,
 textbox[empty="true"] html|*.textbox-textarea[emptytextdelay="true"] {
   color: transparent !important;
 }
 
 .textbox-input-box {
   -moz-binding: url("chrome://global/content/bindings/textbox.xml#input-box");
 }