Make dir=rtl reverse layout direction in horizontal orientation only. Bug 750551, r=dholbert
authorSimon Montagu <smontagu@smontagu.org>
Mon, 07 May 2012 12:17:41 -0700
changeset 93398 cab8af0ca0407acb480255690836d058306aa517
parent 93397 14c53b0ff2e7ccba94f8ceced90ef3276f253668
child 93399 4acd1e285cc4dfbb4fd64290574ef4eb7a5d99dd
push id22634
push useremorley@mozilla.com
push dateTue, 08 May 2012 09:48:43 +0000
treeherdermozilla-central@e4f9e2eab6b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs750551
milestone15.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
Make dir=rtl reverse layout direction in horizontal orientation only. Bug 750551, r=dholbert
layout/xul/base/src/nsBoxFrame.cpp
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -513,23 +513,28 @@ nsBoxFrame::GetInitialDirection(bool& aI
 
   // Now check the style system to see if we should invert aIsNormal.
   const nsStyleXUL* boxInfo = GetStyleXUL();
   if (boxInfo->mBoxDirection == NS_STYLE_BOX_DIRECTION_REVERSE)
     aIsNormal = !aIsNormal; // Invert our direction.
   
   // Now see if we have an attribute.  The attribute overrides
   // the style system value.
-  static nsIContent::AttrValuesArray strings[] =
-    {&nsGkAtoms::reverse, &nsGkAtoms::ltr, &nsGkAtoms::rtl, nsnull};
-  PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir,
-      strings, eCaseMatters);
-  if (index >= 0) {
-    bool values[] = {!aIsNormal, true, false};
-    aIsNormal = values[index];
+  if (IsHorizontal()) {
+    static nsIContent::AttrValuesArray strings[] =
+      {&nsGkAtoms::reverse, &nsGkAtoms::ltr, &nsGkAtoms::rtl, nsnull};
+    PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir,
+        strings, eCaseMatters);
+    if (index >= 0) {
+      bool values[] = {!aIsNormal, true, false};
+      aIsNormal = values[index];
+    }
+  } else if (GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
+                                       nsGkAtoms::reverse, eCaseMatters)) {
+    aIsNormal = !aIsNormal;
   }
 }
 
 /* Returns true if it was set.
  */
 bool
 nsBoxFrame::GetInitialEqualSize(bool& aEqualSize)
 {