Bug 842158 - Make <input type=range> honor the 'direction' property. r=dholbert.
authorJonathan Watt <jwatt@jwatt.org>
Sun, 17 Feb 2013 21:40:26 +0000
changeset 132060 841077d27df82a4723a0f2b79e652779835f9e8d
parent 132059 fe1aa97b77a6e9de2aaf56733c9d77f87473d7e0
child 132061 16ff7211d7b22aebc9004d51f4a81f46257858a4
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs842158
milestone21.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 842158 - Make <input type=range> honor the 'direction' property. r=dholbert.
layout/forms/nsRangeFrame.cpp
layout/reftests/forms/input/range/input-range-direction-unthemed-1-ref.html
layout/reftests/forms/input/range/input-range-direction-unthemed-1.html
layout/reftests/forms/input/range/reftest.list
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -264,16 +264,19 @@ nsRangeFrame::ReflowAnonymousContent(nsP
 
     // Find the x/y position of the thumb frame such that it will be positioned
     // as described above. These coordinates are with respect to the
     // nsRangeFrame's border-box.
     nscoord thumbX, thumbY;
 
     if (isHorizontal) {
       thumbX = NSToCoordRound(rangeFrameContentBoxWidth * valueAsFraction);
+      if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
+        thumbX = rangeFrameContentBoxWidth - thumbX;
+      }
       thumbY = rangeFrameContentBoxHeight / 2;
     } else {
       thumbX = rangeFrameContentBoxWidth / 2;
       // For vertical range zero is at the bottom, so subtract from height:
       thumbY = rangeFrameContentBoxHeight -
                  NSToCoordRound(rangeFrameContentBoxHeight * valueAsFraction);
     }
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/input/range/input-range-direction-unthemed-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <input type='range' value=30 style="-moz-appearance:none;">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/input/range/input-range-direction-unthemed-1.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+  <!-- Test: that direction:rtl behaves connectly -->
+  <body>
+    <input type='range' value=70 style="-moz-appearance:none; direction:rtl;">
+  </body>
+</html>
--- a/layout/reftests/forms/input/range/reftest.list
+++ b/layout/reftests/forms/input/range/reftest.list
@@ -9,8 +9,11 @@ default-preferences pref(dom.experimenta
 # dynamic type changes:
 == input-to-range-from-other-type-unthemed-1.html input-to-range-from-other-type-unthemed-1-ref.html
 == input-from-range-to-other-type-unthemed-1.html input-from-range-to-other-type-unthemed-1-ref.html
 
 # for different values:
 != input-range-different-fraction-of-range-unthemed-1.html input-range-different-fraction-of-range-unthemed-1-notref.html
 == input-range-same-fraction-of-range-unthemed-1.html input-range-same-fraction-of-range-unthemed-1-ref.html
 
+# 'direction' property:
+== input-range-direction-unthemed-1.html input-range-direction-unthemed-1-ref.html
+