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 10 matching lines...) Expand all Loading... |
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" |
31 #include "core/paint/VideoPainter.h" | 33 #include "core/paint/VideoPainter.h" |
32 #include "public/platform/WebLayer.h" | 34 #include "public/platform/WebLayer.h" |
33 | 35 |
34 namespace blink { | 36 namespace blink { |
35 | 37 |
36 using namespace HTMLNames; | 38 using namespace HTMLNames; |
37 | 39 |
38 LayoutVideo::LayoutVideo(HTMLVideoElement* video) | 40 LayoutVideo::LayoutVideo(HTMLVideoElement* video) |
39 : LayoutMedia(video) | 41 : LayoutMedia(video) |
40 { | 42 { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 LayoutUnit LayoutVideo::minimumReplacedHeight() const | 190 LayoutUnit LayoutVideo::minimumReplacedHeight() const |
189 { | 191 { |
190 return LayoutReplaced::minimumReplacedHeight(); | 192 return LayoutReplaced::minimumReplacedHeight(); |
191 } | 193 } |
192 | 194 |
193 bool LayoutVideo::supportsAcceleratedRendering() const | 195 bool LayoutVideo::supportsAcceleratedRendering() const |
194 { | 196 { |
195 return !!mediaElement()->platformLayer(); | 197 return !!mediaElement()->platformLayer(); |
196 } | 198 } |
197 | 199 |
| 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 |
198 CompositingReasons LayoutVideo::additionalCompositingReasons() const | 241 CompositingReasons LayoutVideo::additionalCompositingReasons() const |
199 { | 242 { |
200 HTMLMediaElement* element = toHTMLMediaElement(node()); | 243 HTMLMediaElement* element = toHTMLMediaElement(node()); |
201 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) | 244 if (element->isFullscreen() && element->usesOverlayFullscreenVideo()) |
202 return CompositingReasonVideo; | 245 return CompositingReasonVideo; |
203 | 246 |
204 if (shouldDisplayVideo() && supportsAcceleratedRendering()) | 247 if (shouldDisplayVideo() && supportsAcceleratedRendering()) |
205 return CompositingReasonVideo; | 248 return CompositingReasonVideo; |
206 | 249 |
207 return CompositingReasonNone; | 250 return CompositingReasonNone; |
208 } | 251 } |
209 | 252 |
210 } // namespace blink | 253 } // namespace blink |
OLD | NEW |