diff --git a/layout/style/forms.css b/layout/style/forms.css index 37384341898..1f8ae788e3c 100644 --- a/layout/style/forms.css +++ b/layout/style/forms.css @@ -430,6 +430,12 @@ input[type="file"] > xul|label { color: inherit; font-size: inherit; letter-spacing: inherit; + + /* + * Force the text to have LTR directionality. Otherwise filenames containing + * RTL characters will be reordered with chaotic results. + */ + direction: ltr !important; } /* button part of file selector */ @@ -440,6 +446,14 @@ input[type="file"] > input[type="button"] { cursor: inherit; } +/* Try to make RTL look nicer. */ +/* TODO: use text-align: match-parent when bug 645642 is fixed. */ +input[type="file"]:-moz-dir(rtl) > xul|label { + -moz-padding-start: 0px; + padding-right: 5px; + text-align: right; +} + /* radio buttons */ input[type="radio"] { -moz-appearance: radio; @@ -623,16 +637,6 @@ optgroup:before { text-overflow: inherit; } - /* - * Force the text control child of file input controls to have left-to-right - * directionality. Otherwise filenames containing right-to-left characters - * will be reordered with chaotic results. - */ -input[type="file"] > xul|label { - direction: ltr !important; - text-align: inherit; -} - /** * Set default style for invalid elements. */