⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176282 in webkit


Ignore:
Timestamp:
Nov 18, 2014, 2:05:10 PM (12 years ago)
Author:
Chris Dumez
Message:

DOMTimers sometimes don't get unthrottled on scrolling
https://bugs.webkit.org/show_bug.cgi?id=138838

Reviewed by Antti Koivisto.

Source/WebCore:

DOMTimers sometimes didn't get unthrottled on scrolling. This is
because we stopped listening for viewport changes every time the
timer fires, but we didn't listen for those changes again if we
decided the timer should stay throttled after the timer's action
was executed.

We should listen for viewport changes again after executing the
timer's action, if there are elements outside the viewport causing
the DOMTimer to be throttled, even if the throttleState hasn't
changed (i.e the timer stays throttled).

Test: fast/dom/timer-unthrottle-on-scroll.html

  • page/DOMTimer.cpp:

(WebCore::DOMTimer::updateThrottlingStateIfNecessary):
(WebCore::DOMTimer::updateTimerIntervalIfNecessary):
(WebCore::DOMTimer::updateThrottlingStateAfterViewportChange):

LayoutTests:

Add a layout test to verify that DOMTimers get unthrottled on scroll if
the element whose style they are changing is inside the viewport after
the scroll.

  • fast/dom/timer-unthrottle-on-scroll-expected.txt: Added.
  • fast/dom/timer-unthrottle-on-scroll.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r176263 r176282  
     12014-11-18  Chris Dumez  <cdumez@apple.com>
     2
     3        DOMTimers sometimes don't get unthrottled on scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=138838
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Add a layout test to verify that DOMTimers get unthrottled on scroll if
     9        the element whose style they are changing is inside the viewport after
     10        the scroll.
     11
     12        * fast/dom/timer-unthrottle-on-scroll-expected.txt: Added.
     13        * fast/dom/timer-unthrottle-on-scroll.html: Added.
     14
    1152014-11-18  Myles C. Maxfield  <litherum@gmail.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r176278 r176282  
     12014-11-18  Chris Dumez  <cdumez@apple.com>
     2
     3        DOMTimers sometimes don't get unthrottled on scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=138838
     5
     6        Reviewed by Antti Koivisto.
     7
     8        DOMTimers sometimes didn't get unthrottled on scrolling. This is
     9        because we stopped listening for viewport changes every time the
     10        timer fires, but we didn't listen for those changes again if we
     11        decided the timer should stay throttled after the timer's action
     12        was executed.
     13
     14        We should listen for viewport changes again after executing the
     15        timer's action, if there are elements outside the viewport causing
     16        the DOMTimer to be throttled, even if the throttleState hasn't
     17        changed (i.e the timer stays throttled).
     18
     19        Test: fast/dom/timer-unthrottle-on-scroll.html
     20
     21        * page/DOMTimer.cpp:
     22        (WebCore::DOMTimer::updateThrottlingStateIfNecessary):
     23        (WebCore::DOMTimer::updateTimerIntervalIfNecessary):
     24        (WebCore::DOMTimer::updateThrottlingStateAfterViewportChange):
     25
    1262014-11-18  Daniel Bates  <dbates@webkit.org>
    227
  • trunk/Source/WebCore/page/DOMTimer.cpp

    r176212 r176282  
    255255{
    256256    if (fireState.scriptMadeUserObservableChanges()) {
     257        ASSERT(m_elementsCausingThrottling.isEmpty());
    257258        if (m_throttleState != ShouldNotThrottle) {
    258259            m_throttleState = ShouldNotThrottle;
    259             ASSERT(m_elementsCausingThrottling.isEmpty());
    260260            updateTimerIntervalIfNecessary();
    261261        }
     
    263263        if (m_throttleState != ShouldThrottle) {
    264264            m_throttleState = ShouldThrottle;
    265             fireState.elementsChangedOutsideViewport(m_elementsCausingThrottling);
    266265            updateTimerIntervalIfNecessary();
    267266        }
     267        // Update our vector of Elements causing throttling and register
     268        // for viewport changes if the vector is not empty.
     269        fireState.elementsChangedOutsideViewport(m_elementsCausingThrottling);
     270        if (isIntervalDependentOnViewport())
     271            registerForViewportChanges();
    268272    }
    269273}
     
    429433        return;
    430434
    431     // Timer was throttled / unthrottled, make sure we register / unregister
    432     // from the FrameView if the timer's interval is dependent on viewport.
    433     if (isIntervalDependentOnViewport())
    434         registerForViewportChanges();
    435     else if (m_throttleState == ShouldNotThrottle)
    436         unregisterForViewportChanges();
    437 
    438435    if (repeatInterval()) {
    439436        ASSERT(WTF::areEssentiallyEqual(repeatInterval(), previousInterval, oneMillisecond));
     
    458455            LOG(DOMTimers, "%p - Script is changing style of an element that is now inside the viewport, unthrottling the timer.", this);
    459456            m_throttleState = ShouldNotThrottle;
     457            unregisterForViewportChanges();
    460458            updateTimerIntervalIfNecessary();
    461459            break;
Note: See TracChangeset for help on using the changeset viewer.