Chromium Code Reviews| 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 | |
|
esprehn
2015/10/09 10:34:00
good catch
dsinclair
2015/10/13 15:50:43
Acknowledged.
| |
| 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 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent); |
| 183 layoutObject->updateStyle(); | 197 if (fullscreenElement) |
|
esprehn
2015/10/09 10:34:00
if (Element* fullscreenElement = Fullscreen::curre
dsinclair
2015/10/13 15:50:43
Done.
| |
| 198 Fullscreen::from(fullscreenElement->document()).didUpdateSize(*fullscree nElement); | |
| 184 } | 199 } |
| 185 | 200 |
| 186 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) | 201 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) |
| 187 { | 202 { |
| 188 PageScaleConstraints fullscreenConstraints; | 203 PageScaleConstraints fullscreenConstraints; |
| 189 if (!removeConstraints) { | 204 if (!removeConstraints) { |
| 190 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); | 205 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); |
| 191 fullscreenConstraints.layoutSize = IntSize(m_webViewImpl->size()); | 206 fullscreenConstraints.layoutSize = IntSize(m_webViewImpl->size()); |
| 192 } | 207 } |
| 193 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen Constraints); | 208 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen Constraints); |
| 194 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); | 209 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); |
| 195 m_webViewImpl->updateMainFrameLayoutSize(); | 210 m_webViewImpl->updateMainFrameLayoutSize(); |
| 196 } | 211 } |
| 197 | 212 |
| 198 DEFINE_TRACE(FullscreenController) | 213 DEFINE_TRACE(FullscreenController) |
| 199 { | 214 { |
| 200 visitor->trace(m_provisionalFullScreenElement); | 215 visitor->trace(m_provisionalFullScreenElement); |
| 201 visitor->trace(m_fullScreenFrame); | 216 visitor->trace(m_fullScreenFrame); |
| 202 } | 217 } |
| 203 | 218 |
| 204 } // namespace blink | 219 } // namespace blink |
| 205 | 220 |
| OLD | NEW |