Bug 1094434 - Render resizer appropriately for vertical-lr and vertical-rl writing modes. r=roc
authorJonathan Kew <jkew@mozilla.com>
Thu, 13 Nov 2014 13:24:00 +0000
changeset 215503 4a65cacf8a371b99bb0dd97fdff24f27ff9ff913
parent 215502 f77efca402c2b12116350e599a8c029ce78ebfc6
child 215504 9772eacfaf03838045d8e036970512e08d0d8b87
push id27818
push userryanvm@gmail.com
push dateThu, 13 Nov 2014 20:19:09 +0000
treeherdermozilla-central@292ed84594c1 [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 === undefined || 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;
   }