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

Side by Side Diff: Source/core/rendering/RenderVideo.cpp

Issue 788073004: Replace RenderFullscreen with top layer - Take II (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated after review comments. Created 6 years 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 | Annotate | Revision Log
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 16 matching lines...) Expand all
27 27
28 #include "core/rendering/RenderVideo.h" 28 #include "core/rendering/RenderVideo.h"
29 29
30 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
33 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
34 #include "core/html/HTMLVideoElement.h" 34 #include "core/html/HTMLVideoElement.h"
35 #include "core/paint/VideoPainter.h" 35 #include "core/paint/VideoPainter.h"
36 #include "core/rendering/PaintInfo.h" 36 #include "core/rendering/PaintInfo.h"
37 #include "core/rendering/RenderFullScreen.h"
38 #include "platform/graphics/media/MediaPlayer.h" 37 #include "platform/graphics/media/MediaPlayer.h"
39 #include "public/platform/WebLayer.h" 38 #include "public/platform/WebLayer.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 using namespace HTMLNames; 42 using namespace HTMLNames;
44 43
45 RenderVideo::RenderVideo(HTMLVideoElement* video) 44 RenderVideo::RenderVideo(HTMLVideoElement* video)
46 : RenderMedia(video) 45 : RenderMedia(video)
47 { 46 {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 LayoutUnit RenderVideo::minimumReplacedHeight() const 197 LayoutUnit RenderVideo::minimumReplacedHeight() const
199 { 198 {
200 return RenderReplaced::minimumReplacedHeight(); 199 return RenderReplaced::minimumReplacedHeight();
201 } 200 }
202 201
203 bool RenderVideo::supportsAcceleratedRendering() const 202 bool RenderVideo::supportsAcceleratedRendering() const
204 { 203 {
205 return !!mediaElement()->platformLayer(); 204 return !!mediaElement()->platformLayer();
206 } 205 }
207 206
208 static const RenderBlock* rendererPlaceholder(const RenderObject* renderer)
209 {
210 RenderObject* parent = renderer->parent();
211 if (!parent)
212 return 0;
213
214 RenderFullScreen* fullScreen = parent->isRenderFullScreen() ? toRenderFullSc reen(parent) : 0;
215 if (!fullScreen)
216 return 0;
217
218 return fullScreen->placeholder();
219 }
220
221 LayoutUnit RenderVideo::offsetLeft() const
222 {
223 if (const RenderBlock* block = rendererPlaceholder(this))
224 return block->offsetLeft();
225 return RenderMedia::offsetLeft();
226 }
227
228 LayoutUnit RenderVideo::offsetTop() const
229 {
230 if (const RenderBlock* block = rendererPlaceholder(this))
231 return block->offsetTop();
232 return RenderMedia::offsetTop();
233 }
234
235 LayoutUnit RenderVideo::offsetWidth() const
236 {
237 if (const RenderBlock* block = rendererPlaceholder(this))
238 return block->offsetWidth();
239 return RenderMedia::offsetWidth();
240 }
241
242 LayoutUnit RenderVideo::offsetHeight() const
243 {
244 if (const RenderBlock* block = rendererPlaceholder(this))
245 return block->offsetHeight();
246 return RenderMedia::offsetHeight();
247 }
248
249 CompositingReasons RenderVideo::additionalCompositingReasons() const 207 CompositingReasons RenderVideo::additionalCompositingReasons() const
250 { 208 {
251 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { 209 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) {
252 HTMLMediaElement* media = toHTMLMediaElement(node()); 210 HTMLMediaElement* media = toHTMLMediaElement(node());
253 if (media->isFullscreen()) 211 if (media->isFullscreen())
254 return CompositingReasonVideo; 212 return CompositingReasonVideo;
255 } 213 }
256 214
257 if (shouldDisplayVideo() && supportsAcceleratedRendering()) 215 if (shouldDisplayVideo() && supportsAcceleratedRendering())
258 return CompositingReasonVideo; 216 return CompositingReasonVideo;
259 217
260 return CompositingReasonNone; 218 return CompositingReasonNone;
261 } 219 }
262 220
263 } // namespace blink 221 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698