Changeset 218747 in webkit
- Timestamp:
- Jun 23, 2017 8:44:30 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r218744 r218747 1 2017-06-23 Chris Dumez <cdumez@apple.com> 2 3 [mac-wk1] requestAnimationFrame callbacks may not get serviced 4 https://bugs.webkit.org/show_bug.cgi?id=173628 5 6 Reviewed by Simon Fraser. 7 8 Extend layout test coverage. 9 10 * fast/events/page-visibility-transition-test-expected.txt: 11 * fast/events/page-visibility-transition-test.html: 12 1 13 2017-06-23 Zan Dobersek <zdobersek@igalia.com> 2 14 -
trunk/LayoutTests/fast/events/page-visibility-transition-test-expected.txt
r161105 r218747 6 6 PASS document.visibilityState is "visible" 7 7 PASS document.hidden is false 8 PASS internals.scriptedAnimationsAreSuspended is false 8 9 PASS document.visibilityState is "hidden" 9 10 PASS document.hidden is true 11 PASS internals.scriptedAnimationsAreSuspended is true 10 12 PASS document.visibilityState is "hidden" 11 13 PASS document.hidden is true 14 PASS internals.scriptedAnimationsAreSuspended is true 12 15 PASS document.visibilityState is "visible" 13 16 PASS document.hidden is false 17 PASS internals.scriptedAnimationsAreSuspended is false 14 18 PASS successfullyParsed is true 15 19 -
trunk/LayoutTests/fast/events/page-visibility-transition-test.html
r161105 r218747 33 33 shouldBeEqualToString("document.visibilityState", "visible"); 34 34 shouldBeFalse("document.hidden"); 35 shouldBeFalse("internals.scriptedAnimationsAreSuspended"); 35 36 } 36 37 … … 38 39 shouldBeEqualToString("document.visibilityState", "hidden"); 39 40 shouldBeTrue("document.hidden"); 41 shouldBeTrue("internals.scriptedAnimationsAreSuspended"); 40 42 } 41 43 -
trunk/Source/WebCore/ChangeLog
r218746 r218747 1 2017-06-23 Chris Dumez <cdumez@apple.com> 2 3 [mac-wk1] requestAnimationFrame callbacks may not get serviced 4 https://bugs.webkit.org/show_bug.cgi?id=173628 5 6 Reviewed by Simon Fraser. 7 8 Page::setIsVisibleInternal() was firing the 'visibilitychange' event 9 synchronously while in the middle of updating its visibility/activity 10 state. This allowed the JavaScript to re-enter the method by calling 11 testRunner.setPageVisibility() / resetPageVisiblity() and we would 12 end up in an inconsistent state. 13 14 No new tests, extended existing test. 15 16 * dom/Document.cpp: 17 (WebCore::Document::visibilityStateChanged): 18 Do no fire the visibilitychange event synchronously as we are in the 19 middle of updating the page's activity state. Instead fire the 20 event asynchronously. 21 22 * page/Page.cpp: 23 (WebCore::Page::setIsVisibleInternal): 24 Move the calling of Document::visibilityStateChanged() until after we're 25 done updating the page's visibility state. 26 27 * testing/Internals.cpp: 28 (WebCore::Internals::scriptedAnimationsAreSuspended): 29 * testing/Internals.h: 30 * testing/Internals.idl: 31 Add test infrastructure to check if scripted animations are suspended. 32 1 33 2017-06-23 Eric Carlson <eric.carlson@apple.com> 2 34 -
trunk/Source/WebCore/dom/Document.cpp
r218730 r218747 1618 1618 void Document::visibilityStateChanged() 1619 1619 { 1620 dispatchEvent(Event::create(eventNames().visibilitychangeEvent, false, false));1620 enqueueDocumentEvent(Event::create(eventNames().visibilitychangeEvent, false, false)); 1621 1621 for (auto* client : m_visibilityStateCallbackClients) 1622 1622 client->visibilityStateChanged(); -
trunk/Source/WebCore/page/Page.cpp
r218732 r218747 1715 1715 } 1716 1716 1717 if (!isVisible) { 1718 if (m_settings->hiddenPageCSSAnimationSuspensionEnabled()) 1719 mainFrame().animation().suspendAnimations(); 1720 1721 setSVGAnimationsState(*this, SVGAnimationsState::Paused); 1722 1723 #if PLATFORM(IOS) 1724 suspendDeviceMotionAndOrientationUpdates(); 1725 #endif 1726 1727 #if PLATFORM(MAC) 1728 if (MacApplication::isDumpRenderTree()) 1729 WTFLogAlways("\nPage::setIsVisibleInternal(%s), %p", isVisible ? "true" : "false", this); 1730 #endif 1731 suspendScriptedAnimations(); 1732 1733 if (FrameView* view = mainFrame().view()) 1734 view->hide(); 1735 } 1736 1717 1737 Vector<Ref<Document>> documents; 1718 1738 for (Frame* frame = &m_mainFrame.get(); frame; frame = frame->tree().traverseNext()) … … 1721 1741 for (auto& document : documents) 1722 1742 document->visibilityStateChanged(); 1723 1724 if (!isVisible) {1725 if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())1726 mainFrame().animation().suspendAnimations();1727 1728 setSVGAnimationsState(*this, SVGAnimationsState::Paused);1729 1730 #if PLATFORM(IOS)1731 suspendDeviceMotionAndOrientationUpdates();1732 #endif1733 1734 #if PLATFORM(MAC)1735 if (MacApplication::isDumpRenderTree())1736 WTFLogAlways("\nPage::setIsVisibleInternal(%s), %p", isVisible ? "true" : "false", this);1737 #endif1738 suspendScriptedAnimations();1739 1740 if (FrameView* view = mainFrame().view())1741 view->hide();1742 }1743 1743 } 1744 1744 -
trunk/Source/WebCore/testing/Internals.cpp
r218699 r218747 1164 1164 } 1165 1165 1166 bool Internals::scriptedAnimationsAreSuspended() const 1167 { 1168 Document* document = contextDocument(); 1169 if (!document || !document->page()) 1170 return true; 1171 1172 return document->page()->scriptedAnimationsSuspended(); 1173 } 1174 1166 1175 bool Internals::areTimersThrottled() const 1167 1176 { -
trunk/Source/WebCore/testing/Internals.h
r218699 r218747 153 153 bool isRequestAnimationFrameThrottled() const; 154 154 double requestAnimationFrameInterval() const; 155 bool scriptedAnimationsAreSuspended() const; 155 156 bool areTimersThrottled() const; 156 157 -
trunk/Source/WebCore/testing/Internals.idl
r218699 r218747 371 371 [MayThrowException] void setLowPowerModeEnabled(boolean enabled); 372 372 readonly attribute double requestAnimationFrameInterval; 373 readonly attribute boolean scriptedAnimationsAreSuspended; 373 374 374 375 // Override the behavior of WebPage::eventThrottlingDelay(), which only affects iOS.
Note: See TracChangeset
for help on using the changeset viewer.