From 5b7bd01d722c1a8af172311be1936e5afd5adba0 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 30 Dec 2011 11:14:04 +1300 Subject: [PATCH] Bug 591718. Fix mobile browser test to handle getBoundingClientRect including a transform. r=mfinkle --- mobile/android/chrome/tests/browser_scrollbar.js | 4 +++- mobile/xul/chrome/tests/browser_scrollbar.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mobile/android/chrome/tests/browser_scrollbar.js b/mobile/android/chrome/tests/browser_scrollbar.js index 008d43c35f96..231b6fde4c65 100644 --- a/mobile/android/chrome/tests/browser_scrollbar.js +++ b/mobile/android/chrome/tests/browser_scrollbar.js @@ -65,7 +65,9 @@ function checkScrollbarsPosition(aX) { let verticalRect = verticalScrollbar.getBoundingClientRect(); let margin = parseInt(verticalScrollbar.getAttribute("end")); - let expectedPosition = window.innerWidth - aX - margin; + let matches = verticalScrollbar.style.MozTransform.match(/^translate\(([-0-9]+)px/); + let translateX = matches ? parseInt(matches[1]) : 0; + let expectedPosition = window.innerWidth - aX - margin + translateX; is(verticalRect.right, expectedPosition, "The vertical scrollbar should be position to " + expectedPosition + " (got " + verticalRect.right + ")"); EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" }); diff --git a/mobile/xul/chrome/tests/browser_scrollbar.js b/mobile/xul/chrome/tests/browser_scrollbar.js index 008d43c35f96..231b6fde4c65 100644 --- a/mobile/xul/chrome/tests/browser_scrollbar.js +++ b/mobile/xul/chrome/tests/browser_scrollbar.js @@ -65,7 +65,9 @@ function checkScrollbarsPosition(aX) { let verticalRect = verticalScrollbar.getBoundingClientRect(); let margin = parseInt(verticalScrollbar.getAttribute("end")); - let expectedPosition = window.innerWidth - aX - margin; + let matches = verticalScrollbar.style.MozTransform.match(/^translate\(([-0-9]+)px/); + let translateX = matches ? parseInt(matches[1]) : 0; + let expectedPosition = window.innerWidth - aX - margin + translateX; is(verticalRect.right, expectedPosition, "The vertical scrollbar should be position to " + expectedPosition + " (got " + verticalRect.right + ")"); EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" });