| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (!m_fullscreenFrame) | 93 if (!m_fullscreenFrame) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 if (m_haveEnteredFullscreen) | 96 if (m_haveEnteredFullscreen) |
| 97 updatePageScaleConstraints(true); | 97 updatePageScaleConstraints(true); |
| 98 | 98 |
| 99 if (Document* document = m_fullscreenFrame->document()) { | 99 if (Document* document = m_fullscreenFrame->document()) { |
| 100 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(*document)) { | 100 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(*document)) { |
| 101 Element* element = fullscreen->currentFullScreenElement(); | 101 Element* element = fullscreen->currentFullScreenElement(); |
| 102 if (element) { | 102 if (element) { |
| 103 // When the client exits from full screen we have to call fullyExitFulls
creen to notify | 103 // When the client exits from full screen we have to call |
| 104 // the document. While doing that, suppress notifications back to the cl
ient. | 104 // fullyExitFullscreen to notify the document. While doing that, |
| 105 // suppress notifications back to the client. |
| 105 m_isCancelingFullscreen = true; | 106 m_isCancelingFullscreen = true; |
| 106 Fullscreen::fullyExitFullscreen(*document); | 107 Fullscreen::fullyExitFullscreen(*document); |
| 107 m_isCancelingFullscreen = false; | 108 m_isCancelingFullscreen = false; |
| 108 | 109 |
| 109 // If the video used overlay fullscreen mode, the background was made tr
ansparent. Restore the transparency. | 110 // If the video used overlay fullscreen mode, the background was made |
| 111 // transparent. Restore the transparency. |
| 110 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView()) | 112 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView()) |
| 111 m_webViewImpl->layerTreeView()->setHasTransparentBackground( | 113 m_webViewImpl->layerTreeView()->setHasTransparentBackground( |
| 112 m_webViewImpl->isTransparent()); | 114 m_webViewImpl->isTransparent()); |
| 113 | 115 |
| 114 // We need to wait until style and layout are updated in order | 116 // We need to wait until style and layout are updated in order |
| 115 // to propertly restore scroll offsets since content may not be | 117 // to propertly restore scroll offsets since content may not be |
| 116 // overflowing in the same way until they do. | 118 // overflowing in the same way until they do. |
| 117 if (m_haveEnteredFullscreen) | 119 if (m_haveEnteredFullscreen) |
| 118 m_needsScrollAndScaleRestore = true; | 120 m_needsScrollAndScaleRestore = true; |
| 119 | 121 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) { | 212 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) { |
| 211 PageScaleConstraints fullscreenConstraints; | 213 PageScaleConstraints fullscreenConstraints; |
| 212 if (!removeConstraints) { | 214 if (!removeConstraints) { |
| 213 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); | 215 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); |
| 214 fullscreenConstraints.layoutSize = FloatSize(m_webViewImpl->size()); | 216 fullscreenConstraints.layoutSize = FloatSize(m_webViewImpl->size()); |
| 215 } | 217 } |
| 216 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints( | 218 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints( |
| 217 fullscreenConstraints); | 219 fullscreenConstraints); |
| 218 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); | 220 m_webViewImpl->pageScaleConstraintsSet().computeFinalConstraints(); |
| 219 | 221 |
| 220 // Although we called computedFinalConstraints() above, the "final" constraint
s are not | 222 // Although we called computedFinalConstraints() above, the "final" |
| 221 // actually final. They are still subject to scale factor clamping by contents
size. | 223 // constraints are not actually final. They are still subject to scale factor |
| 222 // Normally they should be dirtied due to contents size mutation after layout,
however the | 224 // clamping by contents size. Normally they should be dirtied due to |
| 223 // contents size is not guaranteed to mutate, and the scale factor may remain
unclamped. | 225 // contents size mutation after layout, however the contents size is not |
| 224 // Just fire the event again to ensure the final constraints pick up the lates
t contents size. | 226 // guaranteed to mutate, and the scale factor may remain unclamped. Just |
| 227 // fire the event again to ensure the final constraints pick up the latest |
| 228 // contents size. |
| 225 m_webViewImpl->didChangeContentsSize(); | 229 m_webViewImpl->didChangeContentsSize(); |
| 226 if (m_webViewImpl->mainFrameImpl() && | 230 if (m_webViewImpl->mainFrameImpl() && |
| 227 m_webViewImpl->mainFrameImpl()->frameView()) | 231 m_webViewImpl->mainFrameImpl()->frameView()) |
| 228 m_webViewImpl->mainFrameImpl()->frameView()->setNeedsLayout(); | 232 m_webViewImpl->mainFrameImpl()->frameView()->setNeedsLayout(); |
| 229 | 233 |
| 230 m_webViewImpl->updateMainFrameLayoutSize(); | 234 m_webViewImpl->updateMainFrameLayoutSize(); |
| 231 } | 235 } |
| 232 | 236 |
| 233 DEFINE_TRACE(FullscreenController) { | 237 DEFINE_TRACE(FullscreenController) { |
| 234 visitor->trace(m_provisionalFullscreenElement); | 238 visitor->trace(m_provisionalFullscreenElement); |
| 235 visitor->trace(m_fullscreenFrame); | 239 visitor->trace(m_fullscreenFrame); |
| 236 } | 240 } |
| 237 | 241 |
| 238 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |