зеркало из https://github.com/mozilla/gecko-dev.git
Bug 655005 - [RTL] left scrollbar is mispositioned when the control sidebar is visible [r=mfinkle]
This commit is contained in:
Родитель
ab019cd896
Коммит
2fe65b214e
|
@ -1394,13 +1394,12 @@ Browser.MainDragger.prototype = {
|
|||
// the 'solution' for now is to reposition it if needed
|
||||
let x = 0;
|
||||
if (Browser.floatedWhileDragging) {
|
||||
let [tabsVis, controlsVis, tabsW, controlsW] = Browser.computeSidebarVisibility();
|
||||
let [tabsSidebar, controlsSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
|
||||
|
||||
// Check if the sidebars are inverted (rtl)
|
||||
let [leftVis, rightVis, leftW, rightW] = Browser.computeSidebarVisibility();
|
||||
let [leftSidebar, rightSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
|
||||
if (leftSidebar.left > rightSidebar.left)
|
||||
x = Math.round(Math.max(0, rightW * rightVis));
|
||||
else
|
||||
x = Math.round(Math.max(0, leftW * leftVis)) * -1.0;
|
||||
let direction = (tabsSidebar.left > controlsSidebar.left) ? 1 : -1;
|
||||
x = Math.round(tabsW * tabsVis) * direction
|
||||
}
|
||||
|
||||
this._verticalScrollbar.style.MozTransform = "translate(" + x + "px," + y + "px)";
|
||||
|
|
|
@ -56,6 +56,21 @@ function checkScrollbars(aHorizontalVisible, aVerticalVisible, aHorizontalPositi
|
|||
EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" });
|
||||
}
|
||||
|
||||
function checkScrollbarsPosition(aX) {
|
||||
let browser = getBrowser();
|
||||
let width = browser.getBoundingClientRect().width;
|
||||
let height = browser.getBoundingClientRect().height;
|
||||
EventUtils.synthesizeMouse(browser, width / 2, height / 4, { type: "mousedown" });
|
||||
EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mousemove" });
|
||||
|
||||
let verticalRect = verticalScrollbar.getBoundingClientRect();
|
||||
let margin = parseInt(verticalScrollbar.getAttribute("end"));
|
||||
let expectedPosition = window.innerWidth - aX - margin;
|
||||
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" });
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
desc: "Testing visibility of scrollbars",
|
||||
|
||||
|
@ -101,6 +116,41 @@ gTests.push({
|
|||
}
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "Testing position of scrollbars",
|
||||
|
||||
run: function() {
|
||||
waitForPageShow(testURL_01 + "vertical", gCurrentTest.checkScrollbarsPosition);
|
||||
gOpenedTabs.push(Browser.addTab(testURL_01 + "vertical", true));
|
||||
},
|
||||
|
||||
checkScrollbarsPosition: function() {
|
||||
let [,, tabsWidth, controlsWidth] = Browser.computeSidebarVisibility();
|
||||
|
||||
checkScrollbarsPosition(0);
|
||||
|
||||
// Show the left sidebar and ensure scrollbar is visible
|
||||
Browser.controlsScrollboxScroller.scrollTo(0, 0);
|
||||
checkScrollbarsPosition(-tabsWidth);
|
||||
|
||||
// Show the right sidebar and ensure scrollbar is visible
|
||||
Browser.controlsScrollboxScroller.scrollTo(tabsWidth + controlsWidth, 0);
|
||||
checkScrollbarsPosition(controlsWidth);
|
||||
|
||||
gCurrentTest.finish();
|
||||
},
|
||||
|
||||
finish: function() {
|
||||
Elements.browsers.addEventListener("PanFinished", function(aEvent) {
|
||||
Elements.browsers.removeEventListener("PanFinished", arguments.callee, false);
|
||||
setTimeout(function() {
|
||||
Browser.hideSidebars();
|
||||
}, 0);
|
||||
runNextTest();
|
||||
}, false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gTests.push({
|
||||
desc: "Check scrollbar visibility when the touch sequence is cancelled",
|
||||
|
|
Загрузка…
Ссылка в новой задаче