This commit is contained in:
Dão Gottwald 2009-08-28 20:45:55 +02:00
Родитель 1cfc77d310 995f5d70ab
Коммит 6fb1ca821a
3 изменённых файлов: 4 добавлений и 97 удалений

Просмотреть файл

@ -50,18 +50,15 @@ DIRS = \
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
_BROWSER_FILES = \
browser_bug471962.js \
$(NULL)
# browser_keyevents_during_autoscrolling.js cannot start the autoscrolling by
# synthesizeMouse with middle button on linux, therefore, disable it temporarily
ifneq ($(MOZ_WIDGET_TOOLKIT),gtk2)
_BROWSER_TEST_FILES += \
browser_keyevents_during_autoscrolling.js \
browser_bug295977_autoscroll_overflow.js \
$(NULL)
_BROWSER_FILES += browser_keyevents_during_autoscrolling.js
endif
libs:: $(_BROWSER_TEST_FILES)
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

Просмотреть файл

@ -1,88 +0,0 @@
function test()
{
const kPrefName_AutoScroll = "general.autoScroll";
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
var kAutoScrollingEnabled = prefSvc.getBoolPref(kPrefName_AutoScroll);
prefSvc.setBoolPref(kPrefName_AutoScroll, true);
const expectScrollNone = 0;
const expectScrollVert = 1;
const expectScrollHori = 2;
const expectScrollBoth = 3;
var allTests = [
{elem: 'a', expected: expectScrollNone},
{elem: 'b', expected: expectScrollBoth},
{elem: 'c', expected: expectScrollHori},
{elem: 'd', expected: expectScrollVert},
{elem: 'e', expected: expectScrollVert},
{elem: 'f', expected: expectScrollNone}
];
var doc;
function nextTest() {
var test = allTests.shift();
if(!test) {
endTest();
return;
}
var elem = doc.getElementById(test.elem);
EventUtils.synthesizeMouse(elem, 10, 10, { button: 1 },
gBrowser.contentWindow);
EventUtils.synthesizeMouse(elem, 80, 80,
{ type: "mousemove", clickCount: "0" },
gBrowser.contentWindow);
// the autoscroll implementation uses a 20ms interval
// wait for 40ms to make sure it did autoscroll at least once
setTimeout(function () {
EventUtils.synthesizeKey("VK_ESCAPE", {}, gBrowser.contentWindow);
var scrollVert = test.expected & expectScrollVert;
ok((scrollVert && elem.scrollTop > 0) ||
(!scrollVert && elem.scrollTop == 0),
test.elem+' should'+(scrollVert ? '' : ' not')+' have scrolled vertically');
var scrollHori = test.expected & expectScrollHori;
ok((scrollHori && elem.scrollLeft > 0) ||
(!scrollHori && elem.scrollLeft == 0),
test.elem+' should'+(scrollHori ? '' : ' not')+' have scrolled horizontally');
nextTest();
}, 40);
}
function startTest() {
waitForExplicitFinish();
gBrowser.addEventListener("load", onLoad, false);
var dataUri = 'data:text/html,<body>\
<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>\
<div id="d" style="width: 100px; height: 100px; overflow-y: auto; overflow-x: hidden;"><div style="width: 200px; height: 200px;"></div></div>\
<select id="e" style="width: 100px; height: 100px;" multiple="multiple"><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><option>a</option><option>a</option></select>\
<select id="f" style="width: 100px; height: 100px;"><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><option>a</option><option>a</option></select>\
</body>';
gBrowser.loadURI(dataUri);
}
function onLoad() {
gBrowser.removeEventListener("load", onLoad, false);
gBrowser.contentWindow.focus();
doc = gBrowser.contentDocument;
nextTest();
}
function endTest() {
// restore the changed prefs
prefSvc.setBoolPref(kPrefName_AutoScroll, kAutoScrollingEnabled);
// cleaning-up
gBrowser.loadURI("about:blank");
finish();
}
startTest();
}

Просмотреть файл

@ -811,10 +811,8 @@
this._scrollable = this._scrollable.parentNode) {
// do not use overflow based autoscroll for <html> Elements
// or non-html elements such as svg or Document nodes
// also make sure to skip select elements that are not multiline
if (!(this._scrollable instanceof HTMLElement) ||
(this._scrollable instanceof HTMLHtmlElement) ||
((this._scrollable instanceof HTMLSelectElement) && !this._scrollable.multiple)) {
(this._scrollable instanceof HTMLHtmlElement)) {
continue;
}