Bug 545970 - Autoscroll widget doesn't appear or wrong image appears in certain cases; r=neil@parkwaycc.co.uk

This commit is contained in:
Arpad Borsos 2010-02-13 12:31:10 +01:00
parent 096f9b88ac
commit 62af31824f
2 changed files with 8 additions and 6 deletions

View File

@ -16,7 +16,8 @@ function test()
{elem: 'c', expected: expectScrollHori},
{elem: 'd', expected: expectScrollVert},
{elem: 'e', expected: expectScrollVert},
{elem: 'f', expected: expectScrollNone}
{elem: 'f', expected: expectScrollNone},
{elem: 'g', expected: expectScrollBoth}
];
var doc;
@ -29,9 +30,9 @@ function test()
}
var elem = doc.getElementById(test.elem);
EventUtils.synthesizeMouse(elem, 10, 10, { button: 1 },
EventUtils.synthesizeMouse(elem, 50, 50, { button: 1 },
gBrowser.contentWindow);
EventUtils.synthesizeMouse(elem, 80, 80,
EventUtils.synthesizeMouse(elem, 100, 100,
{ type: "mousemove", clickCount: "0" },
gBrowser.contentWindow);
// the autoscroll implementation uses a 20ms interval
@ -52,7 +53,7 @@ function test()
waitForExplicitFinish();
gBrowser.addEventListener("load", onLoad, false);
var dataUri = 'data:text/html,<body>\
var dataUri = 'data:text/html,<body><style type="text/css">div { display: inline-block; }</style>\
<div id="a" style="width: 100px; height: 100px; overflow: hidden;"><div style="width: 200px; height: 200px;"></div></div>\
<div id="b" style="width: 100px; height: 100px; overflow: auto;"><div style="width: 200px; height: 200px;"></div></div>\
<div id="c" style="width: 100px; height: 100px; overflow-x: auto; overflow-y: hidden;"><div style="width: 200px; height: 200px;"></div></div>\
@ -63,6 +64,7 @@ function test()
<select id="f" style="width: 100px; height: 100px;"><option>a</option><option>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</option><option>a</option>\
<option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option>\
<option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option></select>\
<div id="g" style="width: 99px; height: 99px; padding: 10px; border: 10px solid black; margin: 10px; overflow: auto;"><div style="width: 100px; height: 100px;"></div></div>\
</body>';
gBrowser.loadURI(dataUri);

View File

@ -824,13 +824,13 @@
var overflowy = this._scrollable.ownerDocument.defaultView
.getComputedStyle(this._scrollable, '')
.getPropertyValue('overflow-y');
var scrollVert = this._scrollable.scrollHeight > this._scrollable.offsetHeight &&
var scrollVert = this._scrollable.scrollHeight > this._scrollable.clientHeight &&
overflowy != 'hidden' && overflowy != 'visible';
// do not allow horizontal scrolling for select elements, it leads
// to visual artifacts and is not the expected behavior anyway
if (!(this._scrollable instanceof HTMLSelectElement) &&
this._scrollable.scrollWidth > this._scrollable.offsetWidth &&
this._scrollable.scrollWidth > this._scrollable.clientWidth &&
overflowx != 'hidden' && overflowx != 'visible') {
this._autoScrollPopup.setAttribute("scrolldir", scrollVert ? "NSEW" : "EW");
break;