Bug 1450017 - Part V, Remove rtl="true" attribute from resizer
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
--- a/layout/xul/test/window_resizer.xul
+++ b/layout/xul/test/window_resizer.xul
@@ -76,17 +76,17 @@ function doTest() {
Array.forEach(resizers, function (element) {
is(getComputedStyle(element, "").cursor,
element.getAttribute("expectedcursor"),
"cursor for " + element.dir);
});
// now check the cursors in rtl. The bottomend resizer
// should be reversed
- document.getElementById("bottomend").setAttribute("rtl", "true");
+ document.documentElement.setAttribute("localedir", "rtl");
Array.forEach(resizers, function (element) {
is(getComputedStyle(element, "").cursor,
element.dir == "bottomend" ? "sw-resize" :
element.getAttribute("expectedcursor"),
"cursor for " + element.dir);
});
window.close();
--- a/toolkit/content/widgets/resizer.xml
+++ b/toolkit/content/widgets/resizer.xml
@@ -6,34 +6,11 @@
<bindings id="resizerBindings"
xmlns="http://www.mozilla.org/xbl">
<binding id="resizer">
<resources>
<stylesheet src="chrome://global/skin/resizer.css"/>
</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>
</bindings>
--- a/toolkit/themes/osx/global/resizer.css
+++ b/toolkit/themes/osx/global/resizer.css
@@ -20,38 +20,36 @@ resizer {
background-size: 100% 100%;
}
}
resizer[type="window"] {
display: none;
}
-resizer[rtl="true"],
-resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
+resizer:-moz-locale-dir(rtl) {
background: url("chrome://global/skin/icons/resizer-rtl.png") no-repeat;
}
@media (min-resolution: 2dppx) {
- resizer[rtl="true"],
- resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
+ resizer:-moz-locale-dir(rtl) {
background-image: url("chrome://global/skin/icons/resizer-rtl@2x.png");
background-size: 100% 100%;
}
}
resizer[dir="left"],
resizer[dir="bottomleft"],
resizer[dir="bottomstart"] {
transform: scaleX(-1);
}
resizer[dir="bottomleft"],
-resizer[dir="bottomstart"]:not([rtl="true"]):not(:-moz-locale-dir(rtl)),
-resizer[dir="bottomend"][rtl="true"] {
+resizer[dir="bottomstart"]:not(:-moz-locale-dir(rtl)),
+resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
cursor: sw-resize;
}
resizer[dir="top"],
resizer[dir="bottom"] {
cursor: ns-resize;
}
--- a/toolkit/themes/windows/global/resizer.css
+++ b/toolkit/themes/windows/global/resizer.css
@@ -8,30 +8,29 @@ resizer {
-moz-appearance: resizer;
background: url("chrome://global/skin/icons/resizer.png") no-repeat;
background-size: 100% 100%;
cursor: se-resize;
width: 15px;
height: 15px;
}
-resizer[rtl="true"],
-resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
+resizer:-moz-locale-dir(rtl) {
background: url("chrome://global/skin/icons/resizer-rtl.png") no-repeat;
}
resizer[dir="left"],
resizer[dir="bottomleft"],
resizer[dir="bottomstart"] {
transform: scaleX(-1);
}
resizer[dir="bottomleft"],
-resizer[dir="bottomstart"]:not([rtl="true"]):not(:-moz-locale-dir(rtl)),
-resizer[dir="bottomend"][rtl="true"] {
+resizer[dir="bottomstart"]:not(:-moz-locale-dir(rtl)),
+resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
cursor: sw-resize;
}
resizer[dir="top"],
resizer[dir="bottom"] {
cursor: ns-resize;
}