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

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

Issue 1220643002: Revert of [DevTools] Implement screen orientation override. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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: Source/modules/screen_orientation/ScreenOrientationController.cpp
diff --git a/Source/modules/screen_orientation/ScreenOrientationController.cpp b/Source/modules/screen_orientation/ScreenOrientationController.cpp
index abaec2ce42197dc283aecc164518e0843b99b098..0820474f073e7db10f66ec4a4058887cf10b4a33 100644
--- a/Source/modules/screen_orientation/ScreenOrientationController.cpp
+++ b/Source/modules/screen_orientation/ScreenOrientationController.cpp
@@ -41,9 +41,6 @@
, PlatformEventController(frame.page())
, m_client(client)
, m_dispatchEventTimer(this, &ScreenOrientationController::dispatchEventTimerFired)
- , m_override(false)
- , m_overrideType(WebScreenOrientationUndefined)
- , m_overrideAngle(0)
{
}
@@ -53,7 +50,7 @@
}
// Compute the screen orientation using the orientation angle and the screen width / height.
-WebScreenOrientationType ScreenOrientationController::computeOrientation(const IntRect& rect, uint16_t rotation)
+WebScreenOrientationType ScreenOrientationController::computeOrientation(ChromeClient& chromeClient)
{
// Bypass orientation detection in layout tests to get consistent results.
// FIXME: The screen dimension should be fixed when running the layout tests to avoid such
@@ -61,6 +58,8 @@
if (LayoutTestSupport::isRunningLayoutTest())
return WebScreenOrientationPortraitPrimary;
+ IntRect rect = chromeClient.screenInfo().rect;
+ uint16_t rotation = chromeClient.screenInfo().orientationAngle;
bool isTallDisplay = rotation % 180 ? rect.height() < rect.width() : rect.height() > rect.width();
switch (rotation) {
case 0:
@@ -77,16 +76,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);
@@ -94,15 +83,15 @@
ASSERT(frame()->host());
ChromeClient& chromeClient = frame()->host()->chromeClient();
- WebScreenOrientationType orientationType = effectiveType(chromeClient);
+ WebScreenOrientationType orientationType = chromeClient.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);
}
ASSERT(orientationType != WebScreenOrientationUndefined);
m_orientation->setType(orientationType);
- m_orientation->setAngle(effectiveAngle(chromeClient));
+ m_orientation->setAngle(chromeClient.screenInfo().orientationAngle);
}
bool ScreenOrientationController::isActiveAndVisible() const
@@ -119,7 +108,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
@@ -183,20 +172,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