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

Side by Side Diff: Source/modules/screen_orientation/ScreenOrientationController.cpp

Issue 879913003: Use IntRect instead of FloatRect for window positions and sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added FIXME comments Created 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/page/WindowFeatures.cpp ('k') | Source/platform/PlatformScreen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/screen_orientation/ScreenOrientationController.h" 6 #include "modules/screen_orientation/ScreenOrientationController.h"
7 7
8 #include "core/events/Event.h" 8 #include "core/events/Event.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Compute the screen orientation using the orientation angle and the screen wid th / height. 50 // Compute the screen orientation using the orientation angle and the screen wid th / height.
51 WebScreenOrientationType ScreenOrientationController::computeOrientation(FrameVi ew* view) 51 WebScreenOrientationType ScreenOrientationController::computeOrientation(FrameVi ew* view)
52 { 52 {
53 // Bypass orientation detection in layout tests to get consistent results. 53 // Bypass orientation detection in layout tests to get consistent results.
54 // FIXME: The screen dimension should be fixed when running the layout tests to avoid such 54 // FIXME: The screen dimension should be fixed when running the layout tests to avoid such
55 // issues. 55 // issues.
56 if (LayoutTestSupport::isRunningLayoutTest()) 56 if (LayoutTestSupport::isRunningLayoutTest())
57 return WebScreenOrientationPortraitPrimary; 57 return WebScreenOrientationPortraitPrimary;
58 58
59 FloatRect rect = screenRect(view); 59 IntRect rect = screenRect(view);
60 uint16_t rotation = screenOrientationAngle(view); 60 uint16_t rotation = screenOrientationAngle(view);
61 bool isTallDisplay = rotation % 180 ? rect.height() < rect.width() : rect.he ight() > rect.width(); 61 bool isTallDisplay = rotation % 180 ? rect.height() < rect.width() : rect.he ight() > rect.width();
62 switch (rotation) { 62 switch (rotation) {
63 case 0: 63 case 0:
64 return isTallDisplay ? WebScreenOrientationPortraitPrimary : WebScreenOr ientationLandscapePrimary; 64 return isTallDisplay ? WebScreenOrientationPortraitPrimary : WebScreenOr ientationLandscapePrimary;
65 case 90: 65 case 90:
66 return isTallDisplay ? WebScreenOrientationLandscapePrimary : WebScreenO rientationPortraitSecondary; 66 return isTallDisplay ? WebScreenOrientationLandscapePrimary : WebScreenO rientationPortraitSecondary;
67 case 180: 67 case 180:
68 return isTallDisplay ? WebScreenOrientationPortraitSecondary : WebScreen OrientationLandscapeSecondary; 68 return isTallDisplay ? WebScreenOrientationPortraitSecondary : WebScreen OrientationLandscapeSecondary;
69 case 270: 69 case 270:
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 void ScreenOrientationController::trace(Visitor* visitor) 212 void ScreenOrientationController::trace(Visitor* visitor)
213 { 213 {
214 visitor->trace(m_orientation); 214 visitor->trace(m_orientation);
215 FrameDestructionObserver::trace(visitor); 215 FrameDestructionObserver::trace(visitor);
216 WillBeHeapSupplement<LocalFrame>::trace(visitor); 216 WillBeHeapSupplement<LocalFrame>::trace(visitor);
217 PlatformEventController::trace(visitor); 217 PlatformEventController::trace(visitor);
218 } 218 }
219 219
220 } // namespace blink 220 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/WindowFeatures.cpp ('k') | Source/platform/PlatformScreen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698