Bug 1451576 - Set dir=auto on [Browse...] button of <input type=file> r=Ehsan

The label of the button comes from the UI; it's direction should be independent
of the web content directionality. As there is no access to :-moz-locale-dir()
selectors in HTML, we'll have to rely on auto-direction here.

The alternative (or, addition to the fix here) would be adding the value of
the dir attribute to HtmlForm.properties, allowing the localizers to set
the directionality explicitly. I however don't know if that's necessary.

MozReview-Commit-ID: 5NXeLtxLXVH

--HG--
extra : rebase_source : 724eb60ccd841d2355fc17ba31af3cf4792962ef
extra : source : 91d8903ab19812f36aa1732d35d0dc203b0f6281
This commit is contained in:
Timothy Guan-tin Chien 2018-04-17 18:04:39 +08:00
Родитель 43b1059cf6
Коммит 49faa579a0
2 изменённых файлов: 3 добавлений и 1 удалений

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

@ -87,6 +87,8 @@ MakeAnonButton(nsIDocument* aDoc, const char* labelKey,
button->SetIsNativeAnonymousRoot();
button->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("button"), false);
button->SetAttr(kNameSpaceID_None, nsGkAtoms::dir,
NS_LITERAL_STRING("auto"), false);
// Set the file picking button text depending on the current locale.
nsAutoString buttonTxt;

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

@ -10,7 +10,7 @@
</html:style>
<html:div dir='rtl'>
<html:div class='file' dir='rtl'>
<html:button>Browse&#8230;</html:button><label value="No file selected."/>
<html:button dir='ltr'>Browse&#8230;</html:button><label value="No file selected."/>
</html:div>
</html:div>
</vbox>