mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 785588. Perform asynchronous scroll operations before firing requestAnimationFrame callbacks. r=tnikkel
--HG-- extra : rebase_source : 3c1439773981db4ea1b957db4351f50899229130
This commit is contained in:
parent
72d8ae53e3
commit
9cdb4ee0d8
@ -133,6 +133,7 @@ MOCHITEST_FILES = \
|
||||
test_bug696020.html \
|
||||
test_event_target_radius.html \
|
||||
test_mozPaintCount.html \
|
||||
test_scroll_event_ordering.html \
|
||||
test_scroll_selection_into_view.html \
|
||||
test_bug583889.html \
|
||||
bug583889_inner1.html \
|
||||
|
56
layout/base/tests/test_scroll_event_ordering.html
Normal file
56
layout/base/tests/test_scroll_event_ordering.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=785588
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 785588 --- ordering of scroll-related events</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=785588">Mozilla Bug 785588</a>
|
||||
<div id="content">
|
||||
<div id="d" style="border:2px solid black; width:100px; height:100px; overflow:auto">
|
||||
<div id="inner" style="height:200px;">Hello</div>
|
||||
</div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var smoothScrollPref = "general.smoothScroll";
|
||||
SpecialPowers.setBoolPref(smoothScrollPref, false);
|
||||
|
||||
var d = document.getElementById("d");
|
||||
d.scrollTop = 0;
|
||||
var inner = document.getElementById("inner");
|
||||
|
||||
var state = "initial";
|
||||
|
||||
function onFrame() {
|
||||
is(state, "initial", "Must be in initial state");
|
||||
ok(d.scrollTop > 0, "Must have scrolled by some amount (got " + d.scrollTop + ")");
|
||||
state = "didOnFrame";
|
||||
}
|
||||
|
||||
function onScroll() {
|
||||
is(state, "didOnFrame", "Must have got requestAnimationFrame callback already");
|
||||
ok(d.scrollTop > 0, "Must have scrolled by some amount (got " + d.scrollTop + ")");
|
||||
SpecialPowers.clearUserPref(smoothScrollPref);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
window.getSelection().collapse(inner.firstChild, 0);
|
||||
window.mozRequestAnimationFrame(onFrame);
|
||||
d.onscroll = onScroll;
|
||||
sendKey("DOWN");
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(doTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1377,7 +1377,7 @@ public:
|
||||
bool SetRefreshObserver(nsGfxScrollFrameInner *aCallee) {
|
||||
NS_ASSERTION(aCallee && !mCallee, "AsyncScroll::SetRefreshObserver - Invalid usage.");
|
||||
|
||||
if (!RefreshDriver(aCallee)->AddRefreshObserver(this, Flush_Display)) {
|
||||
if (!RefreshDriver(aCallee)->AddRefreshObserver(this, Flush_Style)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1405,7 +1405,7 @@ private:
|
||||
*/
|
||||
void RemoveObserver() {
|
||||
if (mCallee) {
|
||||
RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Display);
|
||||
RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Style);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user