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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void FullscreenController::willEnterFullScreen() | 61 void FullscreenController::willEnterFullScreen() |
62 { | 62 { |
63 if (!m_provisionalFullScreenElement) | 63 if (!m_provisionalFullScreenElement) |
64 return; | 64 return; |
65 | 65 |
66 // Ensure that this element's document is still attached. | 66 // Ensure that this element's document is still attached. |
67 Document& doc = m_provisionalFullScreenElement->document(); | 67 Document& doc = m_provisionalFullScreenElement->document(); |
68 if (doc.frame()) { | 68 if (doc.frame()) { |
69 FullscreenElementStack::from(doc).webkitWillEnterFullScreenForElement(m_
provisionalFullScreenElement.get()); | 69 FullscreenElementStack::from(doc).willEnterFullScreenForElement(m_provis
ionalFullScreenElement.get()); |
70 m_fullScreenFrame = doc.frame(); | 70 m_fullScreenFrame = doc.frame(); |
71 } | 71 } |
72 m_provisionalFullScreenElement.clear(); | 72 m_provisionalFullScreenElement.clear(); |
73 } | 73 } |
74 | 74 |
75 void FullscreenController::didEnterFullScreen() | 75 void FullscreenController::didEnterFullScreen() |
76 { | 76 { |
77 if (!m_fullScreenFrame) | 77 if (!m_fullScreenFrame) |
78 return; | 78 return; |
79 | 79 |
80 if (Document* doc = m_fullScreenFrame->document()) { | 80 if (Document* doc = m_fullScreenFrame->document()) { |
81 if (FullscreenElementStack::isFullScreen(*doc)) { | 81 if (FullscreenElementStack::isFullScreen(*doc)) { |
82 if (!m_exitFullscreenPageScaleFactor) { | 82 if (!m_exitFullscreenPageScaleFactor) { |
83 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor
(); | 83 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor
(); |
84 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol
lOffset(); | 84 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol
lOffset(); |
85 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo
rtOffset(); | 85 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo
rtOffset(); |
86 m_webViewImpl->setPageScaleFactor(1.0f); | 86 m_webViewImpl->setPageScaleFactor(1.0f); |
87 m_webViewImpl->setMainFrameScrollOffset(IntPoint()); | 87 m_webViewImpl->setMainFrameScrollOffset(IntPoint()); |
88 m_webViewImpl->setPinchViewportOffset(FloatPoint()); | 88 m_webViewImpl->setPinchViewportOffset(FloatPoint()); |
89 } | 89 } |
90 | 90 |
91 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen
t(0); | 91 FullscreenElementStack::from(*doc).didEnterFullScreenForElement(0); |
92 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { | 92 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { |
93 Element* element = FullscreenElementStack::currentFullScreenElem
entFrom(*doc); | 93 Element* element = FullscreenElementStack::currentFullScreenElem
entFrom(*doc); |
94 ASSERT(element); | 94 ASSERT(element); |
95 if (isHTMLMediaElement(*element)) { | 95 if (isHTMLMediaElement(*element)) { |
96 HTMLMediaElement* mediaElement = toHTMLMediaElement(element)
; | 96 HTMLMediaElement* mediaElement = toHTMLMediaElement(element)
; |
97 if (mediaElement->webMediaPlayer() && mediaElement->webMedia
Player()->canEnterFullscreen() | 97 if (mediaElement->webMediaPlayer() && mediaElement->webMedia
Player()->canEnterFullscreen() |
98 // FIXME: There is no embedder-side handling in layout t
est mode. | 98 // FIXME: There is no embedder-side handling in layout t
est mode. |
99 && !isRunningLayoutTest()) { | 99 && !isRunningLayoutTest()) { |
100 mediaElement->webMediaPlayer()->enterFullscreen(); | 100 mediaElement->webMediaPlayer()->enterFullscreen(); |
101 } | 101 } |
(...skipping 13 matching lines...) Expand all Loading... |
115 if (Document* doc = m_fullScreenFrame->document()) { | 115 if (Document* doc = m_fullScreenFrame->document()) { |
116 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(*doc); | 116 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(*doc); |
117 if (!fullscreen) | 117 if (!fullscreen) |
118 return; | 118 return; |
119 if (fullscreen->isFullScreen(*doc)) { | 119 if (fullscreen->isFullScreen(*doc)) { |
120 // When the client exits from full screen we have to call fullyExitF
ullscreen to notify | 120 // When the client exits from full screen we have to call fullyExitF
ullscreen to notify |
121 // the document. While doing that, suppress notifications back to th
e client. | 121 // the document. While doing that, suppress notifications back to th
e client. |
122 m_isCancelingFullScreen = true; | 122 m_isCancelingFullScreen = true; |
123 fullscreen->fullyExitFullscreen(); | 123 fullscreen->fullyExitFullscreen(); |
124 m_isCancelingFullScreen = false; | 124 m_isCancelingFullScreen = false; |
125 fullscreen->webkitWillExitFullScreenForElement(0); | 125 fullscreen->willExitFullScreenForElement(0); |
126 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_web
ViewImpl->layerTreeView()) | 126 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_web
ViewImpl->layerTreeView()) |
127 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we
bViewImpl->isTransparent()); | 127 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we
bViewImpl->isTransparent()); |
128 } | 128 } |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 void FullscreenController::didExitFullScreen() | 132 void FullscreenController::didExitFullScreen() |
133 { | 133 { |
134 if (!m_fullScreenFrame) | 134 if (!m_fullScreenFrame) |
135 return; | 135 return; |
136 | 136 |
137 if (Document* doc = m_fullScreenFrame->document()) { | 137 if (Document* doc = m_fullScreenFrame->document()) { |
138 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfE
xists(*doc)) { | 138 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfE
xists(*doc)) { |
139 if (fullscreen->webkitIsFullScreen()) { | 139 if (fullscreen->webkitIsFullScreen()) { |
140 if (m_exitFullscreenPageScaleFactor) { | 140 if (m_exitFullscreenPageScaleFactor) { |
141 m_webViewImpl->setPageScaleFactor(m_exitFullscreenPageScaleF
actor); | 141 m_webViewImpl->setPageScaleFactor(m_exitFullscreenPageScaleF
actor); |
142 m_webViewImpl->setMainFrameScrollOffset(IntPoint(m_exitFulls
creenScrollOffset)); | 142 m_webViewImpl->setMainFrameScrollOffset(IntPoint(m_exitFulls
creenScrollOffset)); |
143 m_webViewImpl->setPinchViewportOffset(m_exitFullscreenPinchV
iewportOffset); | 143 m_webViewImpl->setPinchViewportOffset(m_exitFullscreenPinchV
iewportOffset); |
144 m_exitFullscreenPageScaleFactor = 0; | 144 m_exitFullscreenPageScaleFactor = 0; |
145 m_exitFullscreenScrollOffset = IntSize(); | 145 m_exitFullscreenScrollOffset = IntSize(); |
146 } | 146 } |
147 | 147 |
148 fullscreen->webkitDidExitFullScreenForElement(0); | 148 fullscreen->didExitFullScreenForElement(0); |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 m_fullScreenFrame.clear(); | 153 m_fullScreenFrame.clear(); |
154 } | 154 } |
155 | 155 |
156 void FullscreenController::enterFullScreenForElement(WebCore::Element* element) | 156 void FullscreenController::enterFullScreenForElement(WebCore::Element* element) |
157 { | 157 { |
158 if (m_webViewImpl->settingsImpl()->disallowFullscreenForNonMediaElements() &
& !isHTMLMediaElement(element)) | 158 if (m_webViewImpl->settingsImpl()->disallowFullscreenForNonMediaElements() &
& !isHTMLMediaElement(element)) |
(...skipping 24 matching lines...) Expand all Loading... |
183 { | 183 { |
184 // The client is exiting full screen, so don't send a notification. | 184 // The client is exiting full screen, so don't send a notification. |
185 if (m_isCancelingFullScreen) | 185 if (m_isCancelingFullScreen) |
186 return; | 186 return; |
187 if (WebViewClient* client = m_webViewImpl->client()) | 187 if (WebViewClient* client = m_webViewImpl->client()) |
188 client->exitFullScreen(); | 188 client->exitFullScreen(); |
189 } | 189 } |
190 | 190 |
191 } | 191 } |
192 | 192 |
OLD | NEW |