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 element->document().addToTopLayer(element); | |
dsinclair
2015/09/28 19:22:04
This fixes up the WebView unit test crash by makin
esprehn
2015/09/28 20:33:47
It seems really weird that we need this in two pla
philipj_slow
2015/09/29 08:05:23
I'm not sure if it's the case here, but there's a
dsinclair
2015/10/01 14:50:14
Added comment and filed bug.
| |
141 | |
140 // We are already transitioning to fullscreen for a different element. | 142 // We are already transitioning to fullscreen for a different element. |
141 if (m_provisionalFullScreenElement) { | 143 if (m_provisionalFullScreenElement) { |
142 m_provisionalFullScreenElement = element; | 144 m_provisionalFullScreenElement = element; |
143 return; | 145 return; |
144 } | 146 } |
145 | 147 |
146 // We are already in fullscreen mode. | 148 // We are already in fullscreen mode. |
147 if (m_fullScreenFrame) { | 149 if (m_fullScreenFrame) { |
148 m_provisionalFullScreenElement = element; | 150 m_provisionalFullScreenElement = element; |
149 didEnterFullScreen(); | 151 didEnterFullScreen(); |
150 return; | 152 return; |
151 } | 153 } |
152 | 154 |
153 // We need to transition to fullscreen mode. | 155 // We need to transition to fullscreen mode. |
154 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document(). frame()); | 156 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document(). frame()); |
155 if (frame && frame->client()) { | 157 if (frame && frame->client()) { |
156 frame->client()->enterFullscreen(); | 158 frame->client()->enterFullscreen(); |
157 m_provisionalFullScreenElement = element; | 159 m_provisionalFullScreenElement = element; |
158 } | 160 } |
159 } | 161 } |
160 | 162 |
161 void FullscreenController::exitFullScreenForElement(Element* element) | 163 void FullscreenController::exitFullScreenForElement(Element* element) |
162 { | 164 { |
163 ASSERT(element); | 165 ASSERT(element); |
164 | 166 |
167 element->document().removeFromTopLayer(element); | |
168 | |
165 // The client is exiting full screen, so don't send a notification. | 169 // The client is exiting full screen, so don't send a notification. |
166 if (m_isCancelingFullScreen) | 170 if (m_isCancelingFullScreen) |
167 return; | 171 return; |
168 | 172 |
169 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document(). frame()); | 173 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document(). frame()); |
170 if (frame && frame->client()) | 174 if (frame && frame->client()) |
171 frame->client()->exitFullscreen(); | 175 frame->client()->exitFullscreen(); |
172 } | 176 } |
173 | 177 |
174 void FullscreenController::updateSize() | 178 void FullscreenController::updateSize() |
175 { | 179 { |
176 if (!isFullscreen()) | 180 if (!isFullscreen()) |
177 return; | 181 return; |
178 | 182 |
179 updatePageScaleConstraints(false); | 183 updatePageScaleConstraints(false); |
180 | 184 |
181 LayoutFullScreen* layoutObject = Fullscreen::from(*m_fullScreenFrame->docume nt()).fullScreenLayoutObject(); | 185 Document* document = m_fullScreenFrame->document(); |
182 if (layoutObject) | 186 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent); |
183 layoutObject->updateStyle(); | 187 if (fullscreenElement) |
188 Fullscreen::from(fullscreenElement->document()).updatedSize(fullscreenEl ement); | |
184 } | 189 } |
185 | 190 |
186 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) | 191 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) |
187 { | 192 { |
188 PageScaleConstraints fullscreenConstraints; | 193 PageScaleConstraints fullscreenConstraints; |
189 if (!removeConstraints) { | 194 if (!removeConstraints) { |
190 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); | 195 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); |
191 fullscreenConstraints.layoutSize = IntSize(m_webViewImpl->size()); | 196 fullscreenConstraints.layoutSize = IntSize(m_webViewImpl->size()); |
192 } | 197 } |
193 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen Constraints); | 198 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen Constraints); |
194 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); | 199 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); |
195 m_webViewImpl->updateMainFrameLayoutSize(); | 200 m_webViewImpl->updateMainFrameLayoutSize(); |
196 } | 201 } |
197 | 202 |
198 DEFINE_TRACE(FullscreenController) | 203 DEFINE_TRACE(FullscreenController) |
199 { | 204 { |
200 visitor->trace(m_provisionalFullScreenElement); | 205 visitor->trace(m_provisionalFullScreenElement); |
201 visitor->trace(m_fullScreenFrame); | 206 visitor->trace(m_fullScreenFrame); |
202 } | 207 } |
203 | 208 |
204 } // namespace blink | 209 } // namespace blink |
205 | 210 |
OLD | NEW |