Bug 1450017 - Part V, Remove rtl="true" attribute from resizer r=enndeakin+6102
authorTimothy Guan-tin Chien <timdream@gmail.com>
Tue, 10 Apr 2018 21:25:15 +0800
changeset 471958 eabdcd541092ef9974ae8ec4fa5802704f4b8722
parent 471957 407774fc7c7a3455134bfa3cad5a8c3a6ebe21ac
child 471959 d50230b89a1e8b365d98d51d1f2cefccb124ee42
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs1450017
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
layout/xul/test/window_resizer.xul
toolkit/content/widgets/resizer.xml
toolkit/themes/osx/global/resizer.css
toolkit/themes/windows/global/resizer.css
--- 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;
 }