Backed out changeset f03a850e3f53 (bug 1596296) for mochitest failures on test_popupanchor.xhtml.
authorCosmin Sabou <csabou@mozilla.com>
Fri, 15 Nov 2019 15:22:45 +0200
changeset 502162 53c096b278f5888d8b7590786628b0634a80ed2f
parent 502161 5ea9ed99c555bc7e07a8dfc9dfbbdb6eaa77c6e4
child 502163 0c93e34bc1f3b2e56d53a48ff6d6c09b083c8bba
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1596296
milestone72.0a1
backs outf03a850e3f537a33d65889797230222b305f7f7f
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
Backed out changeset f03a850e3f53 (bug 1596296) for mochitest failures on test_popupanchor.xhtml.
browser/components/places/content/places-menupopup.js
layout/xul/nsBoxFrame.cpp
toolkit/content/tests/chrome/test_richlistbox.xhtml
toolkit/content/widgets/panel.js
toolkit/content/xul.css
--- a/browser/components/places/content/places-menupopup.js
+++ b/browser/components/places/content/places-menupopup.js
@@ -668,20 +668,20 @@
           arrowbox.pack = "start";
         }
         arrowbox.style.transform = "translate(0, " + -offset + "px)";
 
         // The assigned side stays the same regardless of direction.
         let isRTL = this.matches(":-moz-locale-dir(rtl)");
 
         if (position.indexOf("start_") == 0) {
-          container.style.mozBoxDirection = "reverse";
+          container.dir = "reverse";
           this.setAttribute("side", isRTL ? "left" : "right");
         } else {
-          container.style.removeProperty("-moz-box-direction");
+          container.dir = "";
           this.setAttribute("side", isRTL ? "right" : "left");
         }
       } else if (
         position.indexOf("before_") == 0 ||
         position.indexOf("after_") == 0
       ) {
         container.orient = "";
         arrowbox.orient = "";
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -410,39 +410,46 @@ void nsBoxFrame::GetInitialDirection(boo
   if (!GetContent()) return;
 
   if (IsXULHorizontal()) {
     // For horizontal boxes only, we initialize our value based off the CSS
     // 'direction' property. This means that BiDI users will end up with
     // horizontally inverted chrome.
     aIsNormal = (StyleVisibility()->mDirection ==
                  NS_STYLE_DIRECTION_LTR);  // If text runs RTL then so do we.
-    if (GetContent()->IsElement()) {
-      Element* element = GetContent()->AsElement();
-
-      // Now see if we have an attribute. The attribute overrides
-      // the style system 'direction' property.
-      static Element::AttrValuesArray strings[] = {nsGkAtoms::ltr,
-                                                   nsGkAtoms::rtl, nullptr};
-      int32_t index = element->FindAttrValueIn(
-          kNameSpaceID_None, nsGkAtoms::dir, strings, eCaseMatters);
-      if (index >= 0) {
-        bool values[] = {true, false};
-        aIsNormal = values[index];
-      }
-    }
-  } else {
+  } else
     aIsNormal = true;  // Assume a normal direction in the vertical case.
-  }
 
   // Now check the style system to see if we should invert aIsNormal.
   const nsStyleXUL* boxInfo = StyleXUL();
   if (boxInfo->mBoxDirection == StyleBoxDirection::Reverse) {
     aIsNormal = !aIsNormal;  // Invert our direction.
   }
+
+  if (!GetContent()->IsElement()) {
+    return;
+  }
+
+  Element* element = GetContent()->AsElement();
+
+  // Now see if we have an attribute.  The attribute overrides
+  // the style system value.
+  if (IsXULHorizontal()) {
+    static Element::AttrValuesArray strings[] = {
+        nsGkAtoms::reverse, nsGkAtoms::ltr, nsGkAtoms::rtl, nullptr};
+    int32_t index = element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir,
+                                             strings, eCaseMatters);
+    if (index >= 0) {
+      bool values[] = {!aIsNormal, true, false};
+      aIsNormal = values[index];
+    }
+  } else if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
+                                  nsGkAtoms::reverse, eCaseMatters)) {
+    aIsNormal = !aIsNormal;
+  }
 }
 
 /* Returns true if it was set.
  */
 bool nsBoxFrame::GetInitialEqualSize(bool& aEqualSize) {
   // see if we are a vertical or horizontal box.
   if (!GetContent() || !GetContent()->IsElement()) return false;
 
--- a/toolkit/content/tests/chrome/test_richlistbox.xhtml
+++ b/toolkit/content/tests/chrome/test_richlistbox.xhtml
@@ -38,17 +38,17 @@ function test_richlistbox()
   richListBox.firstChild.nextSibling.id = "list-box-first";
   richListBox.lastChild.previousSibling.id = "list-box-last";
 
   var count = richListBox.itemCount;
   richListBox.focus();
 
   // Test that dir="reverse" is ignored and behaves the same as dir="normal".
   for (let dir of ["reverse", "normal"]) {
-    richListBox.style.mozBoxDirection = dir;
+    richListBox.dir = dir;
     richListBox.selectedIndex = 0;
     sendKey("DOWN");
     is(richListBox.currentIndex, 1, "Selection should move to the next item");
     sendKey("UP");
     is(richListBox.currentIndex, 0, "Selection should move to the previous item");
     sendKey("END");
     is(richListBox.currentIndex, count - 1, "Selection should move to the last item");
     sendKey("HOME");
--- a/toolkit/content/widgets/panel.js
+++ b/toolkit/content/widgets/panel.js
@@ -131,20 +131,20 @@
           arrowbox.pack = "start";
         }
         arrowbox.style.transform = "translate(0, " + -offset + "px)";
 
         // The assigned side stays the same regardless of direction.
         var isRTL = window.getComputedStyle(this).direction == "rtl";
 
         if (position.indexOf("start_") == 0) {
-          container.style.mozBoxDirection = "reverse";
+          container.dir = "reverse";
           this.setAttribute("side", isRTL ? "left" : "right");
         } else {
-          container.style.removeProperty("-moz-box-direction");
+          container.dir = "";
           this.setAttribute("side", isRTL ? "right" : "left");
         }
       } else if (
         position.indexOf("before_") == 0 ||
         position.indexOf("after_") == 0
       ) {
         container.orient = "";
         arrowbox.orient = "";
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -561,16 +561,18 @@ tabmodalprompt {
 
 @supports -moz-bool-pref("layout.css.emulate-moz-box-with-flex") {
   /* Support common XUL attributes in the emulated flex mode so we can
      test the browser in this configuration without mass-changing existing
      markup and CSS. */
   [orient="vertical"] { -moz-box-orient: vertical; }
   [orient="horizontal"] { -moz-box-orient: horizontal; }
 
+  [dir="reverse"] { -moz-box-direction: reverse; }
+
   [align="start"] { -moz-box-align: start; }
   [align="center"] { -moz-box-align: center; }
   [align="end"] { -moz-box-align: end; }
   [align="baseline"] { -moz-box-align: baseline; }
   [align="stretch"] { -moz-box-align: stretch; }
 
   [pack="start"] { -moz-box-pack: start; }
   [pack="center"] { -moz-box-pack: center; }