Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Source/web/FullscreenController.cpp

Issue 2168373002: Revert of Reland "Implement FullScreen using top layer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve WebFrameTest.cpp conflict and appease presubmit Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 30
31 #include "web/FullscreenController.h" 31 #include "web/FullscreenController.h"
32 32
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/Fullscreen.h" 34 #include "core/dom/Fullscreen.h"
35 #include "core/frame/FrameView.h" 35 #include "core/frame/FrameView.h"
36 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
37 #include "core/frame/PageScaleConstraintsSet.h" 37 #include "core/frame/PageScaleConstraintsSet.h"
38 #include "core/html/HTMLMediaElement.h" 38 #include "core/html/HTMLMediaElement.h"
39 #include "core/html/HTMLVideoElement.h" 39 #include "core/html/HTMLVideoElement.h"
40 #include "core/layout/LayoutFullScreen.h"
40 #include "platform/RuntimeEnabledFeatures.h" 41 #include "platform/RuntimeEnabledFeatures.h"
41 #include "public/platform/WebLayerTreeView.h" 42 #include "public/platform/WebLayerTreeView.h"
42 #include "public/web/WebFrameClient.h" 43 #include "public/web/WebFrameClient.h"
43 #include "web/WebLocalFrameImpl.h" 44 #include "web/WebLocalFrameImpl.h"
44 #include "web/WebSettingsImpl.h" 45 #include "web/WebSettingsImpl.h"
45 #include "web/WebViewImpl.h" 46 #include "web/WebViewImpl.h"
46 47
47 namespace blink { 48 namespace blink {
48 49
49 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) 50 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 } 125 }
125 } 126 }
126 127
127 m_haveEnteredFullscreen = false; 128 m_haveEnteredFullscreen = false;
128 m_fullScreenFrame.clear(); 129 m_fullScreenFrame.clear();
129 } 130 }
130 131
131 void FullscreenController::enterFullScreenForElement(Element* element) 132 void FullscreenController::enterFullScreenForElement(Element* element)
132 { 133 {
133 // TODO(dsinclair): This should not be needed because we addToTopLayer
134 // in Fullscreen::pushFullscreenElementStack but, the WebView code doesn't
135 // call Fullscreen::requestFullscreen() and, instead, just enters and
136 // exists itself. This should be unified so there is one way to go
137 // fullscreen. crbug.com/538158
138 element->document().addToTopLayer(element);
139
140 // We are already transitioning to fullscreen for a different element. 134 // We are already transitioning to fullscreen for a different element.
141 if (m_provisionalFullScreenElement) { 135 if (m_provisionalFullScreenElement) {
142 m_provisionalFullScreenElement = element; 136 m_provisionalFullScreenElement = element;
143 return; 137 return;
144 } 138 }
145 139
146 // We are already in fullscreen mode. 140 // We are already in fullscreen mode.
147 if (m_fullScreenFrame) { 141 if (m_fullScreenFrame) {
148 m_provisionalFullScreenElement = element; 142 m_provisionalFullScreenElement = element;
149 didEnterFullscreen(); 143 didEnterFullscreen();
(...skipping 17 matching lines...) Expand all
167 if (!Fullscreen::from(element->document()).forCrossProcessDescendant()) 161 if (!Fullscreen::from(element->document()).forCrossProcessDescendant())
168 frame->client()->enterFullscreen(); 162 frame->client()->enterFullscreen();
169 m_provisionalFullScreenElement = element; 163 m_provisionalFullScreenElement = element;
170 } 164 }
171 } 165 }
172 166
173 void FullscreenController::exitFullScreenForElement(Element* element) 167 void FullscreenController::exitFullScreenForElement(Element* element)
174 { 168 {
175 DCHECK(element); 169 DCHECK(element);
176 170
177 // TODO(dsinclair): This should not be needed because we addToTopLayer
178 // in Fullscreen::popFullscreenElementStack but, the WebView code doesn't
179 // call Fullscreen::requestFullscreen() and, instead, just enters and
180 // exists itself. This should be unified so there is one way to go
181 // fullscreen. crbug.com/538158
182 element->document().removeFromTopLayer(element);
183
184 // The client is exiting full screen, so don't send a notification. 171 // The client is exiting full screen, so don't send a notification.
185 if (m_isCancelingFullScreen) 172 if (m_isCancelingFullScreen)
186 return; 173 return;
187 174
188 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document(). frame()); 175 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document(). frame());
189 if (frame && frame->client()) 176 if (frame && frame->client())
190 frame->client()->exitFullscreen(); 177 frame->client()->exitFullscreen();
191 } 178 }
192 179
193 void FullscreenController::updateSize() 180 void FullscreenController::updateSize()
194 { 181 {
195 if (!isFullscreen()) 182 if (!isFullscreen())
196 return; 183 return;
197 184
198 updatePageScaleConstraints(false); 185 updatePageScaleConstraints(false);
199 186
200 Document* document = m_fullScreenFrame->document(); 187 LayoutFullScreen* layoutObject = Fullscreen::from(*m_fullScreenFrame->docume nt()).fullScreenLayoutObject();
201 if (Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*d ocument)) 188 if (layoutObject)
202 Fullscreen::from(fullscreenElement->document()).didUpdateSize(*fullscree nElement); 189 layoutObject->updateStyle();
203 } 190 }
204 191
205 void FullscreenController::didUpdateLayout() 192 void FullscreenController::didUpdateLayout()
206 { 193 {
207 if (!m_needsScrollAndScaleRestore) 194 if (!m_needsScrollAndScaleRestore)
208 return; 195 return;
209 196
210 // If we re-entered fullscreen before we could restore the scroll and scale 197 // If we re-entered fullscreen before we could restore the scroll and scale
211 // don't try restoring them yet. 198 // don't try restoring them yet.
212 if (isFullscreen()) 199 if (isFullscreen())
(...skipping 28 matching lines...) Expand all
241 m_webViewImpl->updateMainFrameLayoutSize(); 228 m_webViewImpl->updateMainFrameLayoutSize();
242 } 229 }
243 230
244 DEFINE_TRACE(FullscreenController) 231 DEFINE_TRACE(FullscreenController)
245 { 232 {
246 visitor->trace(m_provisionalFullScreenElement); 233 visitor->trace(m_provisionalFullScreenElement);
247 visitor->trace(m_fullScreenFrame); 234 visitor->trace(m_fullScreenFrame);
248 } 235 }
249 236
250 } // namespace blink 237 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/api/LayoutItem.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698