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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (videoElement()->shouldDisplayPosterImage()) | 119 if (videoElement()->shouldDisplayPosterImage()) |
120 m_cachedImageSize = intrinsicSize(); | 120 m_cachedImageSize = intrinsicSize(); |
121 | 121 |
122 // The intrinsic size is now that of the image, but in case we already had t
he | 122 // The intrinsic size is now that of the image, but in case we already had t
he |
123 // intrinsic size of the video we call this here to restore the video size. | 123 // intrinsic size of the video we call this here to restore the video size. |
124 updateIntrinsicSize(); | 124 updateIntrinsicSize(); |
125 } | 125 } |
126 | 126 |
127 IntRect LayoutVideo::videoBox() const | 127 IntRect LayoutVideo::videoBox() const |
128 { | 128 { |
129 const LayoutSize* overriddenIntrinsicSize = 0; | 129 const LayoutSize* overriddenIntrinsicSize = nullptr; |
130 if (videoElement()->shouldDisplayPosterImage()) | 130 if (videoElement()->shouldDisplayPosterImage()) |
131 overriddenIntrinsicSize = &m_cachedImageSize; | 131 overriddenIntrinsicSize = &m_cachedImageSize; |
132 | 132 |
133 return pixelSnappedIntRect(replacedContentRect(overriddenIntrinsicSize)); | 133 return pixelSnappedIntRect(replacedContentRect(overriddenIntrinsicSize)); |
134 } | 134 } |
135 | 135 |
136 bool LayoutVideo::shouldDisplayVideo() const | 136 bool LayoutVideo::shouldDisplayVideo() const |
137 { | 137 { |
138 return !videoElement()->shouldDisplayPosterImage(); | 138 return !videoElement()->shouldDisplayPosterImage(); |
139 } | 139 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 bool LayoutVideo::supportsAcceleratedRendering() const | 198 bool LayoutVideo::supportsAcceleratedRendering() const |
199 { | 199 { |
200 return !!mediaElement()->platformLayer(); | 200 return !!mediaElement()->platformLayer(); |
201 } | 201 } |
202 | 202 |
203 static const LayoutBlock* layoutObjectPlaceholder(const LayoutObject* layoutObje
ct) | 203 static const LayoutBlock* layoutObjectPlaceholder(const LayoutObject* layoutObje
ct) |
204 { | 204 { |
205 LayoutObject* parent = layoutObject->parent(); | 205 LayoutObject* parent = layoutObject->parent(); |
206 if (!parent) | 206 if (!parent) |
207 return 0; | 207 return nullptr; |
208 | 208 |
209 LayoutFullScreen* fullScreen = parent->isLayoutFullScreen() ? toLayoutFullSc
reen(parent) : 0; | 209 LayoutFullScreen* fullScreen = parent->isLayoutFullScreen() ? toLayoutFullSc
reen(parent) : 0; |
210 if (!fullScreen) | 210 if (!fullScreen) |
211 return 0; | 211 return nullptr; |
212 | 212 |
213 return fullScreen->placeholder(); | 213 return fullScreen->placeholder(); |
214 } | 214 } |
215 | 215 |
216 LayoutUnit LayoutVideo::offsetLeft() const | 216 LayoutUnit LayoutVideo::offsetLeft() const |
217 { | 217 { |
218 if (const LayoutBlock* block = layoutObjectPlaceholder(this)) | 218 if (const LayoutBlock* block = layoutObjectPlaceholder(this)) |
219 return block->offsetLeft(); | 219 return block->offsetLeft(); |
220 return LayoutMedia::offsetLeft(); | 220 return LayoutMedia::offsetLeft(); |
221 } | 221 } |
(...skipping 27 matching lines...) Expand all Loading... |
249 return CompositingReasonVideo; | 249 return CompositingReasonVideo; |
250 } | 250 } |
251 | 251 |
252 if (shouldDisplayVideo() && supportsAcceleratedRendering()) | 252 if (shouldDisplayVideo() && supportsAcceleratedRendering()) |
253 return CompositingReasonVideo; | 253 return CompositingReasonVideo; |
254 | 254 |
255 return CompositingReasonNone; | 255 return CompositingReasonNone; |
256 } | 256 } |
257 | 257 |
258 } // namespace blink | 258 } // namespace blink |
OLD | NEW |