OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 fullscreen->didExitFullScreenForElement(0); | 130 fullscreen->didExitFullScreenForElement(0); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 m_fullScreenFrame.clear(); | 135 m_fullScreenFrame.clear(); |
136 } | 136 } |
137 | 137 |
138 void FullscreenController::enterFullScreenForElement(Element* element) | 138 void FullscreenController::enterFullScreenForElement(Element* element) |
139 { | 139 { |
| 140 // TODO(dsinclair): This should not be needed because we addToTopLayer |
| 141 // in Fullscreen::pushFullscreenElementStack but, the WebView code doesn't |
| 142 // call Fullscreen::requestFullscreen() and, instead, just enters and |
| 143 // exists itself. This should be unified so there is one way to go |
| 144 // fullscreen. crbug.com/538158 |
| 145 element->document().addToTopLayer(element); |
| 146 |
140 // We are already transitioning to fullscreen for a different element. | 147 // We are already transitioning to fullscreen for a different element. |
141 if (m_provisionalFullScreenElement) { | 148 if (m_provisionalFullScreenElement) { |
142 m_provisionalFullScreenElement = element; | 149 m_provisionalFullScreenElement = element; |
143 return; | 150 return; |
144 } | 151 } |
145 | 152 |
146 // We are already in fullscreen mode. | 153 // We are already in fullscreen mode. |
147 if (m_fullScreenFrame) { | 154 if (m_fullScreenFrame) { |
148 m_provisionalFullScreenElement = element; | 155 m_provisionalFullScreenElement = element; |
149 didEnterFullScreen(); | 156 didEnterFullScreen(); |
150 return; | 157 return; |
151 } | 158 } |
152 | 159 |
153 // We need to transition to fullscreen mode. | 160 // We need to transition to fullscreen mode. |
154 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); | 161 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); |
155 if (frame && frame->client()) { | 162 if (frame && frame->client()) { |
156 frame->client()->enterFullscreen(); | 163 frame->client()->enterFullscreen(); |
157 m_provisionalFullScreenElement = element; | 164 m_provisionalFullScreenElement = element; |
158 } | 165 } |
159 } | 166 } |
160 | 167 |
161 void FullscreenController::exitFullScreenForElement(Element* element) | 168 void FullscreenController::exitFullScreenForElement(Element* element) |
162 { | 169 { |
163 ASSERT(element); | 170 ASSERT(element); |
164 | 171 |
| 172 // TODO(dsinclair): This should not be needed because we addToTopLayer |
| 173 // in Fullscreen::popFullscreenElementStack but, the WebView code doesn't |
| 174 // call Fullscreen::requestFullscreen() and, instead, just enters and |
| 175 // exists itself. This should be unified so there is one way to go |
| 176 // fullscreen. crbug.com/538158 |
| 177 element->document().removeFromTopLayer(element); |
| 178 |
165 // The client is exiting full screen, so don't send a notification. | 179 // The client is exiting full screen, so don't send a notification. |
166 if (m_isCancelingFullScreen) | 180 if (m_isCancelingFullScreen) |
167 return; | 181 return; |
168 | 182 |
169 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); | 183 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); |
170 if (frame && frame->client()) | 184 if (frame && frame->client()) |
171 frame->client()->exitFullscreen(); | 185 frame->client()->exitFullscreen(); |
172 } | 186 } |
173 | 187 |
174 void FullscreenController::updateSize() | 188 void FullscreenController::updateSize() |
175 { | 189 { |
176 if (!isFullscreen()) | 190 if (!isFullscreen()) |
177 return; | 191 return; |
178 | 192 |
179 updatePageScaleConstraints(false); | 193 updatePageScaleConstraints(false); |
180 | 194 |
181 LayoutFullScreen* layoutObject = Fullscreen::from(*m_fullScreenFrame->docume
nt()).fullScreenLayoutObject(); | 195 Document* document = m_fullScreenFrame->document(); |
182 if (layoutObject) | 196 if (Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*d
ocument)) |
183 layoutObject->updateStyle(); | 197 Fullscreen::from(fullscreenElement->document()).didUpdateSize(*fullscree
nElement); |
184 } | 198 } |
185 | 199 |
186 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) | 200 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) |
187 { | 201 { |
188 PageScaleConstraints fullscreenConstraints; | 202 PageScaleConstraints fullscreenConstraints; |
189 if (!removeConstraints) { | 203 if (!removeConstraints) { |
190 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); | 204 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); |
191 fullscreenConstraints.layoutSize = IntSize(m_webViewImpl->size()); | 205 fullscreenConstraints.layoutSize = IntSize(m_webViewImpl->size()); |
192 } | 206 } |
193 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen
Constraints); | 207 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen
Constraints); |
194 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); | 208 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); |
195 m_webViewImpl->updateMainFrameLayoutSize(); | 209 m_webViewImpl->updateMainFrameLayoutSize(); |
196 } | 210 } |
197 | 211 |
198 DEFINE_TRACE(FullscreenController) | 212 DEFINE_TRACE(FullscreenController) |
199 { | 213 { |
200 visitor->trace(m_provisionalFullScreenElement); | 214 visitor->trace(m_provisionalFullScreenElement); |
201 visitor->trace(m_fullScreenFrame); | 215 visitor->trace(m_fullScreenFrame); |
202 } | 216 } |
203 | 217 |
204 } // namespace blink | 218 } // namespace blink |
205 | 219 |
OLD | NEW |