Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: LayoutTests/fast/events/overflowchanged-event-raf-timing.html

Issue 82843003: Fire overflowchanged events at raf timing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/overflowchanged-event-raf-timing.html
diff --git a/LayoutTests/fast/events/overflowchanged-event-raf-timing.html b/LayoutTests/fast/events/overflowchanged-event-raf-timing.html
new file mode 100644
index 0000000000000000000000000000000000000000..a544b9e930f864e047a676361f6e45710f609e8b
--- /dev/null
+++ b/LayoutTests/fast/events/overflowchanged-event-raf-timing.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<style>
+ #scrollable { overflow: auto; height: 100px; width: 100px; }
+ #inside.scroll { height: 2000px; }
+</style>
+
+<p>Tests that overflowchanged events are deferred until raf.</p>
+
+<div id="scrollable">
+ <div id="inside"></div>
+</div>
+
+<div id="output"></div>
+
+<script>
+var scrollable = document.getElementById('scrollable');
+var output = document.getElementById('output');
+var inside = document.getElementById('inside');
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function log(text)
+{
+ output.appendChild(document.createElement('div')).textContent = text;
+}
+
+onload = function() {
+ scrollable.addEventListener('overflowchanged', function() {
+ log('overflowchanged');
+ });
+
+ document.body.offsetTop;
+
+ inside.classList.toggle('scroll');
+ document.body.offsetTop;
+ log('layout');
+
+ inside.classList.toggle('scroll');
+ document.body.offsetTop;
+ log('layout');
+
+ inside.classList.toggle('scroll');
+ document.body.offsetTop;
+ log('layout');
+
+ requestAnimationFrame(function() {
+ log('requestAnimationFrame');
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698