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

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

Issue 1722643003: Reland of [DevTools] Move screen orientation override to RenderWidgetScreenMetricsEmulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp
diff --git a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp
index 8e3c8624cf8f2ca630895aeb18f1751132880b92..de25e2c7aa258ac10f793bb8d080c3164e22f9a6 100644
--- a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp
+++ b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp
@@ -40,9 +40,6 @@
, PlatformEventController(frame.page())
, m_client(client)
, m_dispatchEventTimer(this, &ScreenOrientationController::dispatchEventTimerFired)
- , m_override(false)
- , m_overrideType(WebScreenOrientationUndefined)
- , m_overrideAngle(0)
{
}
@@ -76,16 +73,6 @@
}
}
-unsigned short ScreenOrientationController::effectiveAngle(ChromeClient& chromeClient)
-{
- return m_override ? m_overrideAngle : chromeClient.screenInfo().orientationAngle;
-}
-
-WebScreenOrientationType ScreenOrientationController::effectiveType(ChromeClient& chromeClient)
-{
- return m_override ? m_overrideType : chromeClient.screenInfo().orientationType;
-}
-
void ScreenOrientationController::updateOrientation()
{
ASSERT(m_orientation);
@@ -93,15 +80,16 @@
ASSERT(frame()->host());
ChromeClient& chromeClient = frame()->host()->chromeClient();
- WebScreenOrientationType orientationType = effectiveType(chromeClient);
+ WebScreenInfo screenInfo = chromeClient.screenInfo();
+ WebScreenOrientationType orientationType = screenInfo.orientationType;
if (orientationType == WebScreenOrientationUndefined) {
// The embedder could not provide us with an orientation, deduce it ourselves.
- orientationType = computeOrientation(chromeClient.screenInfo().rect, effectiveAngle(chromeClient));
+ orientationType = computeOrientation(chromeClient.screenInfo().rect, screenInfo.orientationAngle);
}
ASSERT(orientationType != WebScreenOrientationUndefined);
m_orientation->setType(orientationType);
- m_orientation->setAngle(effectiveAngle(chromeClient));
+ m_orientation->setAngle(screenInfo.orientationAngle);
}
bool ScreenOrientationController::isActiveAndVisible() const
@@ -118,7 +106,7 @@
// The orientation type and angle are tied in a way that if the angle has
// changed, the type must have changed.
- unsigned short currentAngle = effectiveAngle(frame()->host()->chromeClient());
+ unsigned short currentAngle = frame()->host()->chromeClient().screenInfo().orientationAngle;
// FIXME: sendOrientationChangeEvent() currently send an event all the
// children of the frame, so it should only be called on the frame on
@@ -182,20 +170,6 @@
m_client->unlockOrientation();
}
-void ScreenOrientationController::setOverride(WebScreenOrientationType type, unsigned short angle)
-{
- m_override = true;
- m_overrideType = type;
- m_overrideAngle = angle;
- notifyOrientationChanged();
-}
-
-void ScreenOrientationController::clearOverride()
-{
- m_override = false;
- notifyOrientationChanged();
-}
-
void ScreenOrientationController::dispatchEventTimerFired(Timer<ScreenOrientationController>*)
{
if (!m_orientation)

Powered by Google App Engine
This is Rietveld 408576698