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

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

Issue 2272043003: frame()->host() may be null in ScreenOrientationController::pageVisibilityChanged (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | 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 "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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 orientationType = computeOrientation(chromeClient.screenInfo().rect, scr eenInfo.orientationAngle); 86 orientationType = computeOrientation(chromeClient.screenInfo().rect, scr eenInfo.orientationAngle);
87 } 87 }
88 ASSERT(orientationType != WebScreenOrientationUndefined); 88 ASSERT(orientationType != WebScreenOrientationUndefined);
89 89
90 m_orientation->setType(orientationType); 90 m_orientation->setType(orientationType);
91 m_orientation->setAngle(screenInfo.orientationAngle); 91 m_orientation->setAngle(screenInfo.orientationAngle);
92 } 92 }
93 93
94 bool ScreenOrientationController::isActiveAndVisible() const 94 bool ScreenOrientationController::isActiveAndVisible() const
95 { 95 {
96 return m_orientation && frame() && page() && page()->isPageVisible(); 96 return m_orientation && m_client && frame() && page() && page()->isPageVisib le();
97 } 97 }
98 98
99 void ScreenOrientationController::pageVisibilityChanged() 99 void ScreenOrientationController::pageVisibilityChanged()
100 { 100 {
101 notifyDispatcher(); 101 notifyDispatcher();
102 102
103 if (!isActiveAndVisible()) 103 if (!isActiveAndVisible())
104 return; 104 return;
105 105
106 DCHECK(frame());
107 DCHECK(frame()->host());
108
106 // The orientation type and angle are tied in a way that if the angle has 109 // The orientation type and angle are tied in a way that if the angle has
107 // changed, the type must have changed. 110 // changed, the type must have changed.
108 unsigned short currentAngle = frame()->host()->chromeClient().screenInfo().o rientationAngle; 111 unsigned short currentAngle = frame()->host()->chromeClient().screenInfo().o rientationAngle;
109 112
110 // FIXME: sendOrientationChangeEvent() currently send an event all the 113 // FIXME: sendOrientationChangeEvent() currently send an event all the
111 // children of the frame, so it should only be called on the frame on 114 // children of the frame, so it should only be called on the frame on
112 // top of the tree. We would need the embedder to call 115 // top of the tree. We would need the embedder to call
113 // sendOrientationChangeEvent on every WebFrame part of a WebView to be 116 // sendOrientationChangeEvent on every WebFrame part of a WebView to be
114 // able to remove this. 117 // able to remove this.
115 if (frame() == frame()->localFrameRoot() && m_orientation->angle() != curren tAngle) 118 if (frame() == frame()->localFrameRoot() && m_orientation->angle() != curren tAngle)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 214
212 DEFINE_TRACE(ScreenOrientationController) 215 DEFINE_TRACE(ScreenOrientationController)
213 { 216 {
214 visitor->trace(m_orientation); 217 visitor->trace(m_orientation);
215 DOMWindowProperty::trace(visitor); 218 DOMWindowProperty::trace(visitor);
216 Supplement<LocalFrame>::trace(visitor); 219 Supplement<LocalFrame>::trace(visitor);
217 PlatformEventController::trace(visitor); 220 PlatformEventController::trace(visitor);
218 } 221 }
219 222
220 } // namespace blink 223 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698