Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp

Issue 2661663003: Send orientation change events to sub frames even if parent isn't active. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
diff --git a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
index b3f4e3e35399c9e6540102a8e9e803e4525e4e62..abc7d9a1718f6440a9b920c2dc6427130bdcac01 100644
--- a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
+++ b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
@@ -101,8 +101,16 @@ void ScreenOrientationControllerImpl::updateOrientation() {
m_orientation->setAngle(screenInfo.orientationAngle);
}
+bool ScreenOrientationControllerImpl::isActive() const {
+ return m_orientation && m_client;
+}
+
+bool ScreenOrientationControllerImpl::isVisible() const {
+ return page() && page()->isPageVisible();
+}
+
bool ScreenOrientationControllerImpl::isActiveAndVisible() const {
- return m_orientation && m_client && page() && page()->isPageVisible();
+ return isActive() && isVisible();
}
void ScreenOrientationControllerImpl::pageVisibilityChanged() {
@@ -130,10 +138,11 @@ void ScreenOrientationControllerImpl::pageVisibilityChanged() {
}
void ScreenOrientationControllerImpl::notifyOrientationChanged() {
- if (!isActiveAndVisible())
+ if (!isVisible())
return;
- updateOrientation();
+ if (isActive())
+ updateOrientation();
// Keep track of the frames that need to be notified before notifying the
// current frame as it will prevent side effects from the change event
@@ -146,14 +155,15 @@ void ScreenOrientationControllerImpl::notifyOrientationChanged() {
}
// Notify current orientation object.
- if (!m_dispatchEventTimer.isActive())
+ if (isActive() && !m_dispatchEventTimer.isActive())
m_dispatchEventTimer.startOneShot(0, BLINK_FROM_HERE);
// ... and child frames, if they have a ScreenOrientationControllerImpl.
for (size_t i = 0; i < childFrames.size(); ++i) {
if (ScreenOrientationControllerImpl* controller =
- ScreenOrientationControllerImpl::from(*childFrames[i]))
+ ScreenOrientationControllerImpl::from(*childFrames[i])) {
controller->notifyOrientationChanged();
+ }
}
}
« no previous file with comments | « third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698