OLD | NEW |
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 11 matching lines...) Expand all Loading... |
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 "config.h" | 26 #include "config.h" |
27 #include "core/layout/LayoutVideo.h" | 27 #include "core/layout/LayoutVideo.h" |
28 | 28 |
29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/html/HTMLVideoElement.h" | 31 #include "core/html/HTMLVideoElement.h" |
| 32 #include "core/layout/LayoutFullScreen.h" |
32 #include "core/paint/VideoPainter.h" | 33 #include "core/paint/VideoPainter.h" |
33 #include "public/platform/WebLayer.h" | 34 #include "public/platform/WebLayer.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 using namespace HTMLNames; | 38 using namespace HTMLNames; |
38 | 39 |
39 LayoutVideo::LayoutVideo(HTMLVideoElement* video) | 40 LayoutVideo::LayoutVideo(HTMLVideoElement* video) |
40 : LayoutMedia(video) | 41 : LayoutMedia(video) |
41 { | 42 { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 LayoutUnit LayoutVideo::minimumReplacedHeight() const | 196 LayoutUnit LayoutVideo::minimumReplacedHeight() const |
196 { | 197 { |
197 return LayoutReplaced::minimumReplacedHeight(); | 198 return LayoutReplaced::minimumReplacedHeight(); |
198 } | 199 } |
199 | 200 |
200 bool LayoutVideo::supportsAcceleratedRendering() const | 201 bool LayoutVideo::supportsAcceleratedRendering() const |
201 { | 202 { |
202 return !!mediaElement()->platformLayer(); | 203 return !!mediaElement()->platformLayer(); |
203 } | 204 } |
204 | 205 |
| 206 static const LayoutBlock* layoutObjectPlaceholder(const LayoutObject* layoutObje
ct) |
| 207 { |
| 208 LayoutObject* parent = layoutObject->parent(); |
| 209 if (!parent) |
| 210 return nullptr; |
| 211 |
| 212 LayoutFullScreen* fullScreen = parent->isLayoutFullScreen() ? toLayoutFullSc
reen(parent) : 0; |
| 213 if (!fullScreen) |
| 214 return nullptr; |
| 215 |
| 216 return fullScreen->placeholder(); |
| 217 } |
| 218 |
| 219 LayoutUnit LayoutVideo::offsetLeft() const |
| 220 { |
| 221 if (const LayoutBlock* block = layoutObjectPlaceholder(this)) |
| 222 return block->offsetLeft(); |
| 223 return LayoutMedia::offsetLeft(); |
| 224 } |
| 225 |
| 226 LayoutUnit LayoutVideo::offsetTop() const |
| 227 { |
| 228 if (const LayoutBlock* block = layoutObjectPlaceholder(this)) |
| 229 return block->offsetTop(); |
| 230 return LayoutMedia::offsetTop(); |
| 231 } |
| 232 |
| 233 LayoutUnit LayoutVideo::offsetWidth() const |
| 234 { |
| 235 if (const LayoutBlock* block = layoutObjectPlaceholder(this)) |
| 236 return block->offsetWidth(); |
| 237 return LayoutMedia::offsetWidth(); |
| 238 } |
| 239 |
| 240 LayoutUnit LayoutVideo::offsetHeight() const |
| 241 { |
| 242 if (const LayoutBlock* block = layoutObjectPlaceholder(this)) |
| 243 return block->offsetHeight(); |
| 244 return LayoutMedia::offsetHeight(); |
| 245 } |
| 246 |
205 CompositingReasons LayoutVideo::additionalCompositingReasons() const | 247 CompositingReasons LayoutVideo::additionalCompositingReasons() const |
206 { | 248 { |
207 HTMLMediaElement* element = toHTMLMediaElement(node()); | 249 HTMLMediaElement* element = toHTMLMediaElement(node()); |
208 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) | 250 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) |
209 return CompositingReasonVideo; | 251 return CompositingReasonVideo; |
210 | 252 |
211 if (shouldDisplayVideo() && supportsAcceleratedRendering()) | 253 if (shouldDisplayVideo() && supportsAcceleratedRendering()) |
212 return CompositingReasonVideo; | 254 return CompositingReasonVideo; |
213 | 255 |
214 return CompositingReasonNone; | 256 return CompositingReasonNone; |
215 } | 257 } |
216 | 258 |
217 } // namespace blink | 259 } // namespace blink |
OLD | NEW |