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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutVideo.cpp

Issue 2107233002: Reland "Implement FullScreen using top layer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new untested DCHECK 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) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/layout/LayoutVideo.h" 26 #include "core/layout/LayoutVideo.h"
27 27
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/html/HTMLVideoElement.h" 30 #include "core/html/HTMLVideoElement.h"
31 #include "core/layout/LayoutBlockFlow.h"
32 #include "core/layout/LayoutFullScreen.h"
33 #include "core/paint/VideoPainter.h" 31 #include "core/paint/VideoPainter.h"
34 #include "public/platform/WebLayer.h" 32 #include "public/platform/WebLayer.h"
35 33
36 namespace blink { 34 namespace blink {
37 35
38 using namespace HTMLNames; 36 using namespace HTMLNames;
39 37
40 LayoutVideo::LayoutVideo(HTMLVideoElement* video) 38 LayoutVideo::LayoutVideo(HTMLVideoElement* video)
41 : LayoutMedia(video) 39 : LayoutMedia(video)
42 { 40 {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 LayoutUnit LayoutVideo::minimumReplacedHeight() const 188 LayoutUnit LayoutVideo::minimumReplacedHeight() const
191 { 189 {
192 return LayoutReplaced::minimumReplacedHeight(); 190 return LayoutReplaced::minimumReplacedHeight();
193 } 191 }
194 192
195 bool LayoutVideo::supportsAcceleratedRendering() const 193 bool LayoutVideo::supportsAcceleratedRendering() const
196 { 194 {
197 return !!mediaElement()->platformLayer(); 195 return !!mediaElement()->platformLayer();
198 } 196 }
199 197
200 static const LayoutBlock* layoutObjectPlaceholder(const LayoutObject* layoutObje ct)
201 {
202 LayoutObject* parent = layoutObject->parent();
203 if (!parent)
204 return nullptr;
205
206 LayoutFullScreen* fullScreen = parent->isLayoutFullScreen() ? toLayoutFullSc reen(parent) : 0;
207 if (!fullScreen)
208 return nullptr;
209
210 return fullScreen->placeholder();
211 }
212
213 LayoutUnit LayoutVideo::offsetLeft(const Element* parent) const
214 {
215 if (const LayoutBlock* block = layoutObjectPlaceholder(this))
216 return block->offsetLeft(parent);
217 return LayoutMedia::offsetLeft(parent);
218 }
219
220 LayoutUnit LayoutVideo::offsetTop(const Element* parent) const
221 {
222 if (const LayoutBlock* block = layoutObjectPlaceholder(this))
223 return block->offsetTop(parent);
224 return LayoutMedia::offsetTop(parent);
225 }
226
227 LayoutUnit LayoutVideo::offsetWidth() const
228 {
229 if (const LayoutBlock* block = layoutObjectPlaceholder(this))
230 return block->offsetWidth();
231 return LayoutMedia::offsetWidth();
232 }
233
234 LayoutUnit LayoutVideo::offsetHeight() const
235 {
236 if (const LayoutBlock* block = layoutObjectPlaceholder(this))
237 return block->offsetHeight();
238 return LayoutMedia::offsetHeight();
239 }
240
241 CompositingReasons LayoutVideo::additionalCompositingReasons() const 198 CompositingReasons LayoutVideo::additionalCompositingReasons() const
242 { 199 {
243 HTMLMediaElement* element = toHTMLMediaElement(node()); 200 HTMLMediaElement* element = toHTMLMediaElement(node());
244 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) 201 if (element->isFullscreen() && element->usesOverlayFullscreenVideo())
245 return CompositingReasonVideo; 202 return CompositingReasonVideo;
246 203
247 if (shouldDisplayVideo() && supportsAcceleratedRendering()) 204 if (shouldDisplayVideo() && supportsAcceleratedRendering())
248 return CompositingReasonVideo; 205 return CompositingReasonVideo;
249 206
250 return CompositingReasonNone; 207 return CompositingReasonNone;
251 } 208 }
252 209
253 } // namespace blink 210 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutVideo.h ('k') | third_party/WebKit/Source/core/layout/api/LayoutFullScreenItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698