Fix mixed directional DOM Range tests from bug 396392. Bug 525788, r=roc
authorSimon Montagu <smontagu@smontagu.org>
Sun, 03 Jan 2010 00:46:38 -0800
changeset 36826 1b0db40fe73ba603e0d10a90cea69e8579269d91
parent 36825 cf7c0f378068eb022775bc03a8601ba82dea7f84
child 36827 26672e99e0087c0e1057f160f7a302d49f2abbbd
push id11000
push usersmontagu@mozilla.com
push dateSun, 03 Jan 2010 08:53:48 +0000
treeherdermozilla-central@26672e99e008 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs396392, 525788
milestone1.9.3a1pre
Fix mixed directional DOM Range tests from bug 396392. Bug 525788, r=roc
content/base/test/test_range_bounds.html
--- a/content/base/test/test_range_bounds.html
+++ b/content/base/test/test_range_bounds.html
@@ -154,37 +154,75 @@ function doTest(){
         widthPerchar, spanInSecondPRect.top, spanInSecondPRect.bottom,
         spanInSecondPRect.width + 4*widthPerchar, spanInSecondPRect.height],
       rectList:[[spanInSecondPRect.left - 3*widthPerchar, spanInSecondPRect.left,
         spanInSecondPRect.top, spanInSecondPRect.bottom, 3 * widthPerchar,
         spanInSecondPRect.height],
 	spanInSecondPRect,
 	[spanInSecondPRect.right, spanInSecondPRect.right + widthPerchar,
           spanInSecondPRect.top, spanInSecondPRect.bottom, widthPerchar,
-          spanInSecondPRect.height]]},
-    {name:'spanAcrossLines',range:[spanInSecondDiv.firstChild, 1, spanInSecondDiv.firstChild, 30],
-      rect: spanInSecondDivRect,
-      rectList:[[spanInSecondDivRectList[0].left+widthPerchar,
+          spanInSecondPRect.height]]}
+  ];
+  testcases.forEach(runATest);
+
+  // testcases that have different ranges in LTR and RTL
+  var directionDependentTestcases;
+  if (isLTR) {
+    directionDependentTestcases = [
+      {name:'spanAcrossLines',range:[spanInSecondDiv.firstChild, 1, spanInSecondDiv.firstChild, 30],
+       rect: spanInSecondDivRect,
+       rectList:[[spanInSecondDivRectList[0].left+widthPerchar,
         spanInSecondDivRectList[0].right, spanInSecondDivRectList[0].top,
 	spanInSecondDivRectList[0].bottom, spanInSecondDivRectList[0].width - widthPerchar,
 	spanInSecondDivRectList[0].height],
 	spanInSecondDivRectList[1],
 	[spanInSecondDivRectList[2].left,
 	spanInSecondDivRectList[2].right - 4 * widthPerchar, spanInSecondDivRectList[2].top,
 	spanInSecondDivRectList[2].bottom, 
 	spanInSecondDivRectList[2].width - 4 * widthPerchar,
 	spanInSecondDivRectList[2].height]]},
-    {name:'textAcrossLines',range:[thirdDiv.firstChild, 13, thirdDiv.firstChild, 28],
-      rect: [spanInSecondDivRectList[1].left, spanInSecondDivRectList[1].right,
-        spanInSecondDivRectList[1].top + secondDivRect.height, 
-        spanInSecondDivRectList[1].bottom + secondDivRect.height,
-        spanInSecondDivRectList[1].width, spanInSecondDivRectList[1].height]}
-    
-  ];
-  testcases.forEach(runATest);
+      {name:'textAcrossLines',range:[thirdDiv.firstChild, 13, thirdDiv.firstChild, 28],
+        rect: [spanInSecondDivRectList[1].left, spanInSecondDivRectList[1].right,
+          spanInSecondDivRectList[1].top + secondDivRect.height, 
+          spanInSecondDivRectList[1].bottom + secondDivRect.height,
+          spanInSecondDivRectList[1].width, spanInSecondDivRectList[1].height]}
+    ];
+  } else {
+    directionDependentTestcases = [
+      {name:'spanAcrossLines',range:[spanInSecondDiv.firstChild, 1, spanInSecondDiv.firstChild, 30],
+       rect: spanInSecondDivRect,
+       rectList:[[spanInSecondDivRectList[0].left+widthPerchar,
+        spanInSecondDivRectList[0].right, spanInSecondDivRectList[0].top,
+	spanInSecondDivRectList[0].bottom, spanInSecondDivRectList[0].width - widthPerchar,
+	spanInSecondDivRectList[0].height],
+	spanInSecondDivRectList[1],
+	spanInSecondDivRectList[2],
+	spanInSecondDivRectList[3],
+	[spanInSecondDivRectList[4].left,
+	spanInSecondDivRectList[4].right - 4 * widthPerchar,
+        spanInSecondDivRectList[4].top,
+	spanInSecondDivRectList[4].bottom, 
+	spanInSecondDivRectList[4].width - 4 * widthPerchar,
+	spanInSecondDivRectList[4].height]]},
+      {name:'textAcrossLines',range:[thirdDiv.firstChild, 13, thirdDiv.firstChild, 28],
+        rect: [spanInSecondDivRectList[2].left, spanInSecondDivRectList[2].right,
+          spanInSecondDivRectList[2].top + secondDivRect.height, 
+          spanInSecondDivRectList[2].bottom + secondDivRect.height,
+	       spanInSecondDivRectList[2].width, spanInSecondDivRectList[2].height],
+       rectList:[[spanInSecondDivRectList[2].left, spanInSecondDivRectList[2].right,
+          spanInSecondDivRectList[2].top + secondDivRect.height, 
+          spanInSecondDivRectList[2].bottom + secondDivRect.height,
+          spanInSecondDivRectList[2].width, spanInSecondDivRectList[2].height],
+          [spanInSecondDivRectList[2].left, spanInSecondDivRectList[2].left,
+          spanInSecondDivRectList[2].top + secondDivRect.height, 
+          spanInSecondDivRectList[2].bottom + secondDivRect.height,
+          0, spanInSecondDivRectList[2].height]]}
+     ];
+  }
+  directionDependentTestcases.forEach(runATest);
 }
 function testMixedDir(){
   var root = document.getElementById('mixeddir');
   var firstSpan = root.firstElementChild, firstSpanRect=firstSpan.getBoundingClientRect(),
       firstSpanRectList = firstSpan.getClientRects();
   runATest({name:'mixeddir',range:[firstSpan.firstChild,0,firstSpan.lastChild,firstSpan.lastChild.length],
              rect: firstSpanRect, rectList:firstSpanRectList});
 }