| 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" | |
| 33 #include "core/paint/VideoPainter.h" | 32 #include "core/paint/VideoPainter.h" |
| 34 #include "public/platform/WebLayer.h" | 33 #include "public/platform/WebLayer.h" |
| 35 | 34 |
| 36 namespace blink { | 35 namespace blink { |
| 37 | 36 |
| 38 using namespace HTMLNames; | 37 using namespace HTMLNames; |
| 39 | 38 |
| 40 LayoutVideo::LayoutVideo(HTMLVideoElement* video) | 39 LayoutVideo::LayoutVideo(HTMLVideoElement* video) |
| 41 : LayoutMedia(video) | 40 : LayoutMedia(video) |
| 42 { | 41 { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 LayoutUnit LayoutVideo::minimumReplacedHeight() const | 195 LayoutUnit LayoutVideo::minimumReplacedHeight() const |
| 197 { | 196 { |
| 198 return LayoutReplaced::minimumReplacedHeight(); | 197 return LayoutReplaced::minimumReplacedHeight(); |
| 199 } | 198 } |
| 200 | 199 |
| 201 bool LayoutVideo::supportsAcceleratedRendering() const | 200 bool LayoutVideo::supportsAcceleratedRendering() const |
| 202 { | 201 { |
| 203 return !!mediaElement()->platformLayer(); | 202 return !!mediaElement()->platformLayer(); |
| 204 } | 203 } |
| 205 | 204 |
| 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 | |
| 247 CompositingReasons LayoutVideo::additionalCompositingReasons() const | 205 CompositingReasons LayoutVideo::additionalCompositingReasons() const |
| 248 { | 206 { |
| 249 HTMLMediaElement* element = toHTMLMediaElement(node()); | 207 HTMLMediaElement* element = toHTMLMediaElement(node()); |
| 250 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) | 208 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) |
| 251 return CompositingReasonVideo; | 209 return CompositingReasonVideo; |
| 252 | 210 |
| 253 if (shouldDisplayVideo() && supportsAcceleratedRendering()) | 211 if (shouldDisplayVideo() && supportsAcceleratedRendering()) |
| 254 return CompositingReasonVideo; | 212 return CompositingReasonVideo; |
| 255 | 213 |
| 256 return CompositingReasonNone; | 214 return CompositingReasonNone; |
| 257 } | 215 } |
| 258 | 216 |
| 259 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |