haikuwebkit/ManualTests/ios/suspend-orientation-and-mot...

12 lines
581 B
HTML
Raw Permalink Normal View History

[iOS] Suspend and resume device motion and device orientation updates when page is hidden and visible, respectively https://bugs.webkit.org/show_bug.cgi?id=151840 <rdar://problem/23753931> Reviewed by Simon Fraser. .: Add a manual test that can be used to verify that we suspend dispatching device motion and device orientation events when the page is hidden. * ManualTests/ios/resources/suspend-orientation-and-motion-events-when-page-becomes-hidden.js: Added. (resetTest): (checkEvent): (handleVisibilityChange): * ManualTests/ios/suspend-orientation-and-motion-events-when-page-becomes-hidden.html: Added. Source/WebCore: * dom/Document.cpp: (WebCore::Document::suspendDeviceMotionAndOrientationUpdates): Added. (WebCore::Document::resumeDeviceMotionAndOrientationUpdates): Added. (WebCore::Document::platformSuspendOrStopActiveDOMObjects): Moved logic to suspend device motion and orientation updates from here to Document::suspendDeviceMotionAndOrientationUpdates(). (WebCore::Document::suspendActiveDOMObjects): Modified to call Document::suspendDeviceMotionAndOrientationUpdates(). (WebCore::Document::resumeActiveDOMObjects): Modified to call Document::resumeDeviceMotionAndOrientationUpdates(). * dom/Document.h: * page/Page.cpp: (WebCore::Page::setIsVisibleInternal): Suspend device motion and orientation updates when the page is hidden and resume updates when the page is visible. (WebCore::Page::suspendDeviceMotionAndOrientationUpdates): Added. (WebCore::Page::resumeDeviceMotionAndOrientationUpdates): Added. * page/Page.h: Canonical link: https://commits.webkit.org/170242@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-10 02:53:12 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="resources/suspend-orientation-and-motion-events-when-page-becomes-hidden.js"></script>
</head>
<body>
<p>This test can be used to verify that <code>devicemotion</code> and <code>deviceorientation</code> events are not dispatched when the page is hidden.</p>
<button onclick="window.open('suspend-orientation-and-motion-events-when-page-becomes-hidden.html')">Open this page in a child window to verify that this page does not receive events when the child window is the front-most window</button>
<pre id="console"></pre>
</body>
</html>