- a/LayoutTests/ChangeLog +13 lines
Lines 1-5 a/LayoutTests/ChangeLog_sec1
1
2014-11-19  Chris Dumez  <cdumez@apple.com>
1
2014-11-19  Chris Dumez  <cdumez@apple.com>
2
2
3
        Add layout test for DOM timer throttling in iframe scrolled out of viewport
4
        https://bugs.webkit.org/show_bug.cgi?id=138884
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add a layout test to test that a repeating DOM timer inside an iframe
9
        get throttled if the iframe is scrolled out of the viewport.
10
11
        * fast/dom/resources/timer-throttling-iframe.html: Added.
12
        * fast/dom/timer-throttle-on-scrolling-iframe-away.html: Added.
13
14
2014-11-19  Chris Dumez  <cdumez@apple.com>
15
3
        Add layout test for throttling of DOM timer changing the style of visible and invisible elements
16
        Add layout test for throttling of DOM timer changing the style of visible and invisible elements
4
        https://bugs.webkit.org/show_bug.cgi?id=138875
17
        https://bugs.webkit.org/show_bug.cgi?id=138875
5
18
- a/LayoutTests/fast/dom/resources/timer-throttling-iframe.html +23 lines
Line 0 a/LayoutTests/fast/dom/resources/timer-throttling-iframe.html_sec1
1
<!DOCTYPE html>
2
<body>
3
<div id="testElement">TEST</div>
4
<script>
5
var testElement = document.getElementById("testElement");
6
var iterationCount = 0;
7
var timeoutId;
8
9
function timerCallback() {
10
  ++iterationCount;
11
12
  // Change style of Element.
13
  testElement.style["opacity"] = "" + (iterationCount / 10.);
14
15
  parent.timerFired(iterationCount, internals.isTimerThrottled(timeoutId));
16
17
  if (iterationCount == 7)
18
    clearInterval(timeoutId);
19
}
20
21
timeoutId = setInterval(timerCallback, 0);
22
</script>
23
</body>
- a/LayoutTests/fast/dom/timer-throttle-on-scrolling-iframe-away.html +34 lines
Line 0 a/LayoutTests/fast/dom/timer-throttle-on-scrolling-iframe-away.html_sec1
1
<!DOCTYPE html>
2
<body>
3
<script src="../../resources/js-test-pre.js"></script>
4
<script>
5
description("Tests that a repeating timer in an iframe changing the style of an element gets throttled when scrolling the frame out of view.");
6
jsTestIsAsync = true;
7
8
function scrollFrameOutOfView()
9
{
10
  debug("Scrolling frame out of view.");
11
  window.scrollBy(0,800);
12
}
13
14
function timerFired(iterationCount, isThrottled) {
15
  // 5 iterations should suffice to throttle the timer.
16
  if (iterationCount == 5) {
17
    debug("Frame is inside viewport, timer should not be throttled");
18
    isTimerThrottledBeforeScroll = isThrottled;
19
    shouldBeFalse("isTimerThrottledBeforeScroll");
20
    scrollFrameOutOfView();
21
  } else if (iterationCount == 7) {
22
    debug("Frame is outside viewport, timer should now be throttled");
23
    isTimerThrottledAfterScroll = isThrottled;
24
    shouldBeTrue("isTimerThrottledAfterScroll");
25
    finishJSTest();
26
  }
27
}
28
29
</script>
30
<div style="position: relative; width: 1600px; height: 2400px; background-color: green;">
31
  <iframe id="testFrame" src="resources/timer-throttling-iframe.html" style="width: 100px; height: 100px;"></iframe>
32
</div>
33
<script src="../../resources/js-test-post.js"></script>
34
</body>

Return to Bug 138884