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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void HTMLVideoElement::attach(const AttachContext& context) | 84 void HTMLVideoElement::attach(const AttachContext& context) |
85 { | 85 { |
86 HTMLMediaElement::attach(context); | 86 HTMLMediaElement::attach(context); |
87 | 87 |
88 updateDisplayState(); | 88 updateDisplayState(); |
89 if (shouldDisplayPosterImage()) { | 89 if (shouldDisplayPosterImage()) { |
90 if (!m_imageLoader) | 90 if (!m_imageLoader) |
91 m_imageLoader = HTMLImageLoader::create(this); | 91 m_imageLoader = HTMLImageLoader::create(this); |
92 m_imageLoader->updateFromElement(); | 92 m_imageLoader->updateFromElement(); |
93 if (renderer()) | 93 if (layoutObject()) |
94 toLayoutImage(renderer())->imageResource()->setImageResource(m_image
Loader->image()); | 94 toLayoutImage(layoutObject())->imageResource()->setImageResource(m_i
mageLoader->image()); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 void HTMLVideoElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) | 98 void HTMLVideoElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) |
99 { | 99 { |
100 if (name == widthAttr) | 100 if (name == widthAttr) |
101 addHTMLLengthToStyle(style, CSSPropertyWidth, value); | 101 addHTMLLengthToStyle(style, CSSPropertyWidth, value); |
102 else if (name == heightAttr) | 102 else if (name == heightAttr) |
103 addHTMLLengthToStyle(style, CSSPropertyHeight, value); | 103 addHTMLLengthToStyle(style, CSSPropertyHeight, value); |
104 else | 104 else |
(...skipping 11 matching lines...) Expand all Loading... |
116 { | 116 { |
117 if (name == posterAttr) { | 117 if (name == posterAttr) { |
118 // Force a poster recalc by setting m_displayMode to Unknown directly be
fore calling updateDisplayState. | 118 // Force a poster recalc by setting m_displayMode to Unknown directly be
fore calling updateDisplayState. |
119 HTMLMediaElement::setDisplayMode(Unknown); | 119 HTMLMediaElement::setDisplayMode(Unknown); |
120 updateDisplayState(); | 120 updateDisplayState(); |
121 if (shouldDisplayPosterImage()) { | 121 if (shouldDisplayPosterImage()) { |
122 if (!m_imageLoader) | 122 if (!m_imageLoader) |
123 m_imageLoader = HTMLImageLoader::create(this); | 123 m_imageLoader = HTMLImageLoader::create(this); |
124 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); | 124 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); |
125 } else { | 125 } else { |
126 if (renderer()) | 126 if (layoutObject()) |
127 toLayoutImage(renderer())->imageResource()->setImageResource(0); | 127 toLayoutImage(layoutObject())->imageResource()->setImageResource
(0); |
128 } | 128 } |
129 // Notify the player when the poster image URL changes. | 129 // Notify the player when the poster image URL changes. |
130 if (webMediaPlayer()) | 130 if (webMediaPlayer()) |
131 webMediaPlayer()->setPoster(posterImageURL()); | 131 webMediaPlayer()->setPoster(posterImageURL()); |
132 } else { | 132 } else { |
133 HTMLMediaElement::parseAttribute(name, value); | 133 HTMLMediaElement::parseAttribute(name, value); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 bool HTMLVideoElement::supportsFullscreen() const | 137 bool HTMLVideoElement::supportsFullscreen() const |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // We have a poster path, but only show it until the user triggers displ
ay by playing or seeking and the | 181 // We have a poster path, but only show it until the user triggers displ
ay by playing or seeking and the |
182 // media engine has something to display. | 182 // media engine has something to display. |
183 // Don't show the poster if there is a seek operation or | 183 // Don't show the poster if there is a seek operation or |
184 // the video has restarted because of loop attribute | 184 // the video has restarted because of loop attribute |
185 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) | 185 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) |
186 return; | 186 return; |
187 } | 187 } |
188 | 188 |
189 HTMLMediaElement::setDisplayMode(mode); | 189 HTMLMediaElement::setDisplayMode(mode); |
190 | 190 |
191 if (renderer() && displayMode() != oldMode) | 191 if (layoutObject() && displayMode() != oldMode) |
192 renderer()->updateFromElement(); | 192 layoutObject()->updateFromElement(); |
193 } | 193 } |
194 | 194 |
195 void HTMLVideoElement::updateDisplayState() | 195 void HTMLVideoElement::updateDisplayState() |
196 { | 196 { |
197 if (posterImageURL().isEmpty()) | 197 if (posterImageURL().isEmpty()) |
198 setDisplayMode(Video); | 198 setDisplayMode(Video); |
199 else if (displayMode() < Poster) | 199 else if (displayMode() < Poster) |
200 setDisplayMode(Poster); | 200 setDisplayMode(Poster); |
201 } | 201 } |
202 | 202 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 { | 318 { |
319 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); | 319 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); |
320 } | 320 } |
321 | 321 |
322 FloatSize HTMLVideoElement::sourceSize() const | 322 FloatSize HTMLVideoElement::sourceSize() const |
323 { | 323 { |
324 return FloatSize(videoWidth(), videoHeight()); | 324 return FloatSize(videoWidth(), videoHeight()); |
325 } | 325 } |
326 | 326 |
327 } | 327 } |
OLD | NEW |