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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Spec text from 4.8.6 | 91 // Spec text from 4.8.6 |
92 // | 92 // |
93 // The intrinsic width of a video element's playback area is the intrinsic w
idth | 93 // The intrinsic width of a video element's playback area is the intrinsic w
idth |
94 // of the video resource, if that is available; otherwise it is the intrinsi
c | 94 // of the video resource, if that is available; otherwise it is the intrinsi
c |
95 // width of the poster frame, if that is available; otherwise it is 300 CSS
pixels. | 95 // width of the poster frame, if that is available; otherwise it is 300 CSS
pixels. |
96 // | 96 // |
97 // The intrinsic height of a video element's playback area is the intrinsic
height | 97 // The intrinsic height of a video element's playback area is the intrinsic
height |
98 // of the video resource, if that is available; otherwise it is the intrinsi
c | 98 // of the video resource, if that is available; otherwise it is the intrinsi
c |
99 // height of the poster frame, if that is available; otherwise it is 150 CSS
pixels. | 99 // height of the poster frame, if that is available; otherwise it is 150 CSS
pixels. |
100 blink::WebMediaPlayer* webMediaPlayer = mediaElement()->webMediaPlayer(); | 100 WebMediaPlayer* webMediaPlayer = mediaElement()->webMediaPlayer(); |
101 if (webMediaPlayer && video->readyState() >= HTMLVideoElement::HAVE_METADATA
) { | 101 if (webMediaPlayer && video->readyState() >= HTMLVideoElement::HAVE_METADATA
) { |
102 IntSize size = webMediaPlayer->naturalSize(); | 102 IntSize size = webMediaPlayer->naturalSize(); |
103 if (!size.isEmpty()) | 103 if (!size.isEmpty()) |
104 return size; | 104 return size; |
105 } | 105 } |
106 | 106 |
107 if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !im
ageResource()->errorOccurred()) | 107 if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !im
ageResource()->errorOccurred()) |
108 return m_cachedImageSize; | 108 return m_cachedImageSize; |
109 | 109 |
110 // <video> in standalone media documents should not use the default 300x150 | 110 // <video> in standalone media documents should not use the default 300x150 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 paintIntoRect(context, rect); | 171 paintIntoRect(context, rect); |
172 else if ((document().view() && document().view()->paintBehavior() & PaintBeh
aviorFlattenCompositingLayers) || !acceleratedRenderingInUse()) | 172 else if ((document().view() && document().view()->paintBehavior() & PaintBeh
aviorFlattenCompositingLayers) || !acceleratedRenderingInUse()) |
173 videoElement()->paintCurrentFrameInContext(context, pixelSnappedIntRect(
rect)); | 173 videoElement()->paintCurrentFrameInContext(context, pixelSnappedIntRect(
rect)); |
174 | 174 |
175 if (clip) | 175 if (clip) |
176 context->restore(); | 176 context->restore(); |
177 } | 177 } |
178 | 178 |
179 bool RenderVideo::acceleratedRenderingInUse() | 179 bool RenderVideo::acceleratedRenderingInUse() |
180 { | 180 { |
181 blink::WebLayer* webLayer = mediaElement()->platformLayer(); | 181 WebLayer* webLayer = mediaElement()->platformLayer(); |
182 return webLayer && !webLayer->isOrphan(); | 182 return webLayer && !webLayer->isOrphan(); |
183 } | 183 } |
184 | 184 |
185 void RenderVideo::layout() | 185 void RenderVideo::layout() |
186 { | 186 { |
187 updatePlayer(); | 187 updatePlayer(); |
188 RenderMedia::layout(); | 188 RenderMedia::layout(); |
189 } | 189 } |
190 | 190 |
191 HTMLVideoElement* RenderVideo::videoElement() const | 191 HTMLVideoElement* RenderVideo::videoElement() const |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return CompositingReasonVideo; | 282 return CompositingReasonVideo; |
283 } | 283 } |
284 | 284 |
285 if (shouldDisplayVideo() && supportsAcceleratedRendering()) | 285 if (shouldDisplayVideo() && supportsAcceleratedRendering()) |
286 return CompositingReasonVideo; | 286 return CompositingReasonVideo; |
287 | 287 |
288 return CompositingReasonNone; | 288 return CompositingReasonNone; |
289 } | 289 } |
290 | 290 |
291 } // namespace blink | 291 } // namespace blink |
OLD | NEW |