Bug 1094434 - Render resizer appropriately for vertical-lr and vertical-rl writing modes. r=roc
☠☠ backed out by eb4d49f980d5 ☠ ☠
authorJonathan Kew <jkew@mozilla.com>
Thu, 13 Nov 2014 08:58:06 +0000
changeset 215490 e36492ae23a67530e0e12dc810971bffe251b797
parent 215489 acb19a80d5f7a2588d195041abe4e25bd9520aed
child 215491 13167bb74be0eafadf1b2a002a1e8ccdb756c684
push id27817
push usercbook@mozilla.com
push dateThu, 13 Nov 2014 15:21:11 +0000
treeherdermozilla-central@ae27ae77e32f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1094434
milestone36.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 1094434 - Render resizer appropriately for vertical-lr and vertical-rl writing modes. r=roc
layout/xul/nsResizerFrame.cpp
toolkit/content/widgets/resizer.xml
widget/nsNativeTheme.cpp
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -497,31 +497,38 @@ nsResizerFrame::GetDirection()
 
   static const Direction directions[] =
     {{-1, -1}, {0, -1}, {1, -1},
      {-1,  0},          {1,  0},
      {-1,  1}, {0,  1}, {1,  1},
      {-1,  1},          {1,  1}
     };
 
-  if (!GetContent())
+  if (!GetContent()) {
     return directions[0]; // default: topleft
+  }
 
   int32_t index = GetContent()->FindAttrValueIn(kNameSpaceID_None,
                                                 nsGkAtoms::dir,
                                                 strings, eCaseMatters);
-  if(index < 0)
+  if (index < 0) {
     return directions[0]; // default: topleft
-  else if (index >= 8 && StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
+  }
+
+  if (index >= 8) {
     // Directions 8 and higher are RTL-aware directions and should reverse the
     // horizontal component if RTL.
-    Direction direction = directions[index];
-    direction.mHorizontal *= -1;
-    return direction;
+    WritingMode wm = GetWritingMode();
+    if (!(wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR())) {
+      Direction direction = directions[index];
+      direction.mHorizontal *= -1;
+      return direction;
+    }
   }
+
   return directions[index];
 }
 
 void
 nsResizerFrame::MouseClicked(nsPresContext* aPresContext,
                              WidgetMouseEvent* aEvent)
 {
   // Execute the oncommand event handler.
--- a/toolkit/content/widgets/resizer.xml
+++ b/toolkit/content/widgets/resizer.xml
@@ -16,18 +16,24 @@
       <![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 direction = window.getComputedStyle(this, "").direction;
-        if (direction == "rtl") {
-          this.setAttribute("rtl", "true");
+        var cs = window.getComputedStyle(this, "");
+        if (cs.writingMode == "horizontal-tb") {;
+          if (cs.direction == "rtl") {
+            this.setAttribute("rtl", "true");
+          }
+        } else {
+          if (cs.writingMode == "vertical-rl") {
+            this.setAttribute("rtl", "true");
+          }
         }
       ]]>
       </constructor>
     </implementation>
   </binding>
 
 </bindings>
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -376,17 +376,21 @@ nsNativeTheme::IsDisabled(nsIFrame* aFra
   // be counted as true.
   return content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
                               NS_LITERAL_STRING("true"), eCaseMatters);
 }
 
 bool
 nsNativeTheme::IsFrameRTL(nsIFrame* aFrame)
 {
-  return aFrame && aFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
+  if (!aFrame) {
+    return false;
+  }
+  WritingMode wm = aFrame->GetWritingMode();
+  return !(wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR());
 }
 
 bool
 nsNativeTheme::IsHTMLContent(nsIFrame *aFrame)
 {
   if (!aFrame) {
     return false;
   }