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

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

Issue 2396573002: reflow comments in modules/[presentation,storage] (Closed)
Patch Set: Created 4 years, 2 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
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 "modules/screen_orientation/ScreenOrientationController.h" 5 #include "modules/screen_orientation/ScreenOrientationController.h"
6 6
7 #include "core/events/Event.h" 7 #include "core/events/Event.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 PlatformEventController(frame.page()), 42 PlatformEventController(frame.page()),
43 m_client(client), 43 m_client(client),
44 m_dispatchEventTimer( 44 m_dispatchEventTimer(
45 this, 45 this,
46 &ScreenOrientationController::dispatchEventTimerFired) {} 46 &ScreenOrientationController::dispatchEventTimerFired) {}
47 47
48 const char* ScreenOrientationController::supplementName() { 48 const char* ScreenOrientationController::supplementName() {
49 return "ScreenOrientationController"; 49 return "ScreenOrientationController";
50 } 50 }
51 51
52 // Compute the screen orientation using the orientation angle and the screen wid th / height. 52 // Compute the screen orientation using the orientation angle and the screen
53 // width / height.
53 WebScreenOrientationType ScreenOrientationController::computeOrientation( 54 WebScreenOrientationType ScreenOrientationController::computeOrientation(
54 const IntRect& rect, 55 const IntRect& rect,
55 uint16_t rotation) { 56 uint16_t rotation) {
56 // Bypass orientation detection in layout tests to get consistent results. 57 // Bypass orientation detection in layout tests to get consistent results.
57 // FIXME: The screen dimension should be fixed when running the layout tests t o avoid such 58 // FIXME: The screen dimension should be fixed when running the layout tests
58 // issues. 59 // to avoid such issues.
59 if (LayoutTestSupport::isRunningLayoutTest()) 60 if (LayoutTestSupport::isRunningLayoutTest())
60 return WebScreenOrientationPortraitPrimary; 61 return WebScreenOrientationPortraitPrimary;
61 62
62 bool isTallDisplay = rotation % 180 ? rect.height() < rect.width() 63 bool isTallDisplay = rotation % 180 ? rect.height() < rect.width()
63 : rect.height() > rect.width(); 64 : rect.height() > rect.width();
64 switch (rotation) { 65 switch (rotation) {
65 case 0: 66 case 0:
66 return isTallDisplay ? WebScreenOrientationPortraitPrimary 67 return isTallDisplay ? WebScreenOrientationPortraitPrimary
67 : WebScreenOrientationLandscapePrimary; 68 : WebScreenOrientationLandscapePrimary;
68 case 90: 69 case 90:
(...skipping 13 matching lines...) Expand all
82 83
83 void ScreenOrientationController::updateOrientation() { 84 void ScreenOrientationController::updateOrientation() {
84 ASSERT(m_orientation); 85 ASSERT(m_orientation);
85 ASSERT(frame()); 86 ASSERT(frame());
86 ASSERT(frame()->host()); 87 ASSERT(frame()->host());
87 88
88 ChromeClient& chromeClient = frame()->host()->chromeClient(); 89 ChromeClient& chromeClient = frame()->host()->chromeClient();
89 WebScreenInfo screenInfo = chromeClient.screenInfo(); 90 WebScreenInfo screenInfo = chromeClient.screenInfo();
90 WebScreenOrientationType orientationType = screenInfo.orientationType; 91 WebScreenOrientationType orientationType = screenInfo.orientationType;
91 if (orientationType == WebScreenOrientationUndefined) { 92 if (orientationType == WebScreenOrientationUndefined) {
92 // The embedder could not provide us with an orientation, deduce it ourselve s. 93 // The embedder could not provide us with an orientation, deduce it
94 // ourselves.
93 orientationType = computeOrientation(chromeClient.screenInfo().rect, 95 orientationType = computeOrientation(chromeClient.screenInfo().rect,
94 screenInfo.orientationAngle); 96 screenInfo.orientationAngle);
95 } 97 }
96 ASSERT(orientationType != WebScreenOrientationUndefined); 98 ASSERT(orientationType != WebScreenOrientationUndefined);
97 99
98 m_orientation->setType(orientationType); 100 m_orientation->setType(orientationType);
99 m_orientation->setAngle(screenInfo.orientationAngle); 101 m_orientation->setAngle(screenInfo.orientationAngle);
100 } 102 }
101 103
102 bool ScreenOrientationController::isActiveAndVisible() const { 104 bool ScreenOrientationController::isActiveAndVisible() const {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 217 }
216 218
217 DEFINE_TRACE(ScreenOrientationController) { 219 DEFINE_TRACE(ScreenOrientationController) {
218 visitor->trace(m_orientation); 220 visitor->trace(m_orientation);
219 DOMWindowProperty::trace(visitor); 221 DOMWindowProperty::trace(visitor);
220 Supplement<LocalFrame>::trace(visitor); 222 Supplement<LocalFrame>::trace(visitor);
221 PlatformEventController::trace(visitor); 223 PlatformEventController::trace(visitor);
222 } 224 }
223 225
224 } // namespace blink 226 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698