Index: Source/modules/gamepad/NavigatorGamepad.cpp |
diff --git a/Source/modules/gamepad/NavigatorGamepad.cpp b/Source/modules/gamepad/NavigatorGamepad.cpp |
index 0b39cea0a4775edb93e83c9af4196c9516b2f78a..6333946be8a506ee5138fe2e9e63869afac7b3f6 100644 |
--- a/Source/modules/gamepad/NavigatorGamepad.cpp |
+++ b/Source/modules/gamepad/NavigatorGamepad.cpp |
@@ -228,4 +228,13 @@ void NavigatorGamepad::didRemoveAllEventListeners(LocalDOMWindow*) |
m_hasEventListener = false; |
} |
+void NavigatorGamepad::pageVisibilityChanged() |
+{ |
+ // Inform the embedder whether it needs to provide gamepad data for us. |
+ if (page()->visibilityState() == PageVisibilityStateVisible && (m_hasEventListener || m_gamepads || m_webkitGamepads)) |
+ startUpdating(); |
+ else |
+ stopUpdating(); |
+} |
+ |
} // namespace WebCore |