Bug 1450017 - Part V, Remove rtl="true" attribute from resizer r=enndeakin+6102

This patch changes the direction context the dir=bottomend/bottomstart value
from the CSS direction property value to locale dir, with the help
from :-moz-locale-dir(rtl) selector.

The change is justified because:

- In the web content, we have since rely on the nsScrollFrame to set the
  direction explicity.
- XUL window should always render in the application locale; it should be
  fine to disregard direction property set in the local document DOM teee,
  as it is unlikely to be differ than the locale dir.

This remove the one last bit of JavaScript from the resizer binding.

MozReview-Commit-ID: AweJ5GARNUE

--HG--
extra : rebase_source : 17772435a1f9cfdbc7289eb41d69e5922ffdb302
extra : source : edfba1676e4bb74e32cc987d851f7a6b12abef3b
This commit is contained in:
Timothy Guan-tin Chien 2018-04-10 21:25:15 +08:00
Родитель f6cc388fd8
Коммит e6a0db03b8
4 изменённых файлов: 8 добавлений и 34 удалений

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

@ -81,7 +81,7 @@ function doTest() {
// now check the cursors in rtl. The bottomend resizer // now check the cursors in rtl. The bottomend resizer
// should be reversed // should be reversed
document.getElementById("bottomend").setAttribute("rtl", "true"); document.documentElement.setAttribute("localedir", "rtl");
Array.forEach(resizers, function (element) { Array.forEach(resizers, function (element) {
is(getComputedStyle(element, "").cursor, is(getComputedStyle(element, "").cursor,
element.dir == "bottomend" ? "sw-resize" : element.dir == "bottomend" ? "sw-resize" :

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

@ -11,29 +11,6 @@
<resources> <resources>
<stylesheet src="chrome://global/skin/resizer.css"/> <stylesheet src="chrome://global/skin/resizer.css"/>
</resources> </resources>
<implementation>
<constructor>
<![CDATA[
// don't do this for viewport resizers; causes a crash related to
// bugs 563665 and 581536 otherwise
if (this.parentNode == this.ownerDocument.documentElement)
return;
// if the direction is rtl, set the rtl attribute so that the
// stylesheet can use this to make the cursor appear properly
var cs = window.getComputedStyle(this);
if (cs.writingMode === undefined || cs.writingMode == "horizontal-tb") {
if (cs.direction == "rtl") {
this.setAttribute("rtl", "true");
}
} else if (cs.writingMode.endsWith("-rl")) {
// writing-modes 'vertical-rl' and 'sideways-rl' want rtl resizers,
// as they will appear at the bottom left of the element
this.setAttribute("rtl", "true");
}
]]>
</constructor>
</implementation>
</binding> </binding>
</bindings> </bindings>

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

@ -25,13 +25,11 @@ resizer[type="window"] {
display: none; display: none;
} }
resizer[rtl="true"], resizer:-moz-locale-dir(rtl) {
resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
background: url("chrome://global/skin/icons/resizer-rtl.png") no-repeat; background: url("chrome://global/skin/icons/resizer-rtl.png") no-repeat;
} }
@media (min-resolution: 2dppx) { @media (min-resolution: 2dppx) {
resizer[rtl="true"], resizer:-moz-locale-dir(rtl) {
resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
background-image: url("chrome://global/skin/icons/resizer-rtl@2x.png"); background-image: url("chrome://global/skin/icons/resizer-rtl@2x.png");
background-size: 100% 100%; background-size: 100% 100%;
} }
@ -45,8 +43,8 @@ resizer[dir="bottomstart"] {
} }
resizer[dir="bottomleft"], resizer[dir="bottomleft"],
resizer[dir="bottomstart"]:not([rtl="true"]):not(:-moz-locale-dir(rtl)), resizer[dir="bottomstart"]:not(:-moz-locale-dir(rtl)),
resizer[dir="bottomend"][rtl="true"] { resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
cursor: sw-resize; cursor: sw-resize;
} }

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

@ -13,8 +13,7 @@ resizer {
height: 15px; height: 15px;
} }
resizer[rtl="true"], resizer:-moz-locale-dir(rtl) {
resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
background: url("chrome://global/skin/icons/resizer-rtl.png") no-repeat; background: url("chrome://global/skin/icons/resizer-rtl.png") no-repeat;
} }
@ -25,8 +24,8 @@ resizer[dir="bottomstart"] {
} }
resizer[dir="bottomleft"], resizer[dir="bottomleft"],
resizer[dir="bottomstart"]:not([rtl="true"]):not(:-moz-locale-dir(rtl)), resizer[dir="bottomstart"]:not(:-moz-locale-dir(rtl)),
resizer[dir="bottomend"][rtl="true"] { resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
cursor: sw-resize; cursor: sw-resize;
} }