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 25 matching lines...) Expand all Loading... | |
36 #include "core/html/canvas/CanvasRenderingContext.h" | 36 #include "core/html/canvas/CanvasRenderingContext.h" |
37 #include "core/html/parser/HTMLParserIdioms.h" | 37 #include "core/html/parser/HTMLParserIdioms.h" |
38 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
39 #include "core/rendering/RenderImage.h" | 39 #include "core/rendering/RenderImage.h" |
40 #include "core/rendering/RenderVideo.h" | 40 #include "core/rendering/RenderVideo.h" |
41 #include "platform/UserGestureIndicator.h" | 41 #include "platform/UserGestureIndicator.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 using namespace HTMLNames; | 45 using namespace HTMLNames; |
46 using blink::WebMediaPlayer; | |
acolwell GONE FROM CHROMIUM
2014/05/20 16:40:21
nit: Please just add blink:: to the one usage belo
| |
46 | 47 |
47 inline HTMLVideoElement::HTMLVideoElement(Document& document) | 48 inline HTMLVideoElement::HTMLVideoElement(Document& document) |
48 : HTMLMediaElement(videoTag, document) | 49 : HTMLMediaElement(videoTag, document) |
49 { | 50 { |
50 ScriptWrappable::init(this); | 51 ScriptWrappable::init(this); |
51 if (document.settings()) | 52 if (document.settings()) |
52 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste rURL()); | 53 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste rURL()); |
53 } | 54 } |
54 | 55 |
55 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu ment) | 56 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu ment) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 player()->setPoster(posterImageURL()); | 120 player()->setPoster(posterImageURL()); |
120 } else | 121 } else |
121 HTMLMediaElement::parseAttribute(name, value); | 122 HTMLMediaElement::parseAttribute(name, value); |
122 } | 123 } |
123 | 124 |
124 bool HTMLVideoElement::supportsFullscreen() const | 125 bool HTMLVideoElement::supportsFullscreen() const |
125 { | 126 { |
126 if (!document().page()) | 127 if (!document().page()) |
127 return false; | 128 return false; |
128 | 129 |
129 if (!player()) | 130 if (!webMediaPlayer()) |
130 return false; | 131 return false; |
131 | 132 |
132 return true; | 133 return true; |
133 } | 134 } |
134 | 135 |
135 unsigned HTMLVideoElement::videoWidth() const | 136 unsigned HTMLVideoElement::videoWidth() const |
136 { | 137 { |
137 if (!player()) | 138 if (!webMediaPlayer()) |
138 return 0; | 139 return 0; |
139 return player()->naturalSize().width(); | 140 IntSize playerSize = webMediaPlayer()->naturalSize(); |
acolwell GONE FROM CHROMIUM
2014/05/20 16:40:21
nit: Just inline this below since nothing else use
| |
141 return playerSize.width(); | |
140 } | 142 } |
141 | 143 |
142 unsigned HTMLVideoElement::videoHeight() const | 144 unsigned HTMLVideoElement::videoHeight() const |
143 { | 145 { |
144 if (!player()) | 146 if (!webMediaPlayer()) |
145 return 0; | 147 return 0; |
146 return player()->naturalSize().height(); | 148 IntSize playerSize = webMediaPlayer()->naturalSize(); |
149 return playerSize.height(); | |
acolwell GONE FROM CHROMIUM
2014/05/20 16:40:21
ditto
| |
147 } | 150 } |
148 | 151 |
149 bool HTMLVideoElement::isURLAttribute(const Attribute& attribute) const | 152 bool HTMLVideoElement::isURLAttribute(const Attribute& attribute) const |
150 { | 153 { |
151 return attribute.name() == posterAttr || HTMLMediaElement::isURLAttribute(at tribute); | 154 return attribute.name() == posterAttr || HTMLMediaElement::isURLAttribute(at tribute); |
152 } | 155 } |
153 | 156 |
154 const AtomicString HTMLVideoElement::imageSourceURL() const | 157 const AtomicString HTMLVideoElement::imageSourceURL() const |
155 { | 158 { |
156 const AtomicString& url = getAttribute(posterAttr); | 159 const AtomicString& url = getAttribute(posterAttr); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 200 |
198 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern alFormat, bool premultiplyAlpha, bool flipY) | 201 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern alFormat, bool premultiplyAlpha, bool flipY) |
199 { | 202 { |
200 if (!player()) | 203 if (!player()) |
201 return false; | 204 return false; |
202 return player()->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY); | 205 return player()->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY); |
203 } | 206 } |
204 | 207 |
205 bool HTMLVideoElement::hasAvailableVideoFrame() const | 208 bool HTMLVideoElement::hasAvailableVideoFrame() const |
206 { | 209 { |
207 if (!player()) | 210 if (!webMediaPlayer()) |
208 return false; | 211 return false; |
209 | 212 |
210 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu rrentData; | 213 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= Web MediaPlayer::ReadyStateHaveCurrentData; |
211 } | 214 } |
212 | 215 |
213 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& exceptionState) | 216 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& exceptionState) |
214 { | 217 { |
215 if (isFullscreen()) | 218 if (isFullscreen()) |
216 return; | 219 return; |
217 | 220 |
218 if (!supportsFullscreen()) { | 221 if (!supportsFullscreen()) { |
219 exceptionState.throwDOMException(InvalidStateError, "This element does n ot support fullscreen mode."); | 222 exceptionState.throwDOMException(InvalidStateError, "This element does n ot support fullscreen mode."); |
220 return; | 223 return; |
(...skipping 20 matching lines...) Expand all Loading... | |
241 | 244 |
242 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) | 245 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) |
243 { | 246 { |
244 if (m_imageLoader) | 247 if (m_imageLoader) |
245 m_imageLoader->elementDidMoveToNewDocument(); | 248 m_imageLoader->elementDidMoveToNewDocument(); |
246 HTMLMediaElement::didMoveToNewDocument(oldDocument); | 249 HTMLMediaElement::didMoveToNewDocument(oldDocument); |
247 } | 250 } |
248 | 251 |
249 unsigned HTMLVideoElement::webkitDecodedFrameCount() const | 252 unsigned HTMLVideoElement::webkitDecodedFrameCount() const |
250 { | 253 { |
251 if (!player()) | 254 if (!webMediaPlayer()) |
252 return 0; | 255 return 0; |
253 | 256 |
254 return player()->decodedFrameCount(); | 257 return webMediaPlayer()->decodedFrameCount(); |
255 } | 258 } |
256 | 259 |
257 unsigned HTMLVideoElement::webkitDroppedFrameCount() const | 260 unsigned HTMLVideoElement::webkitDroppedFrameCount() const |
258 { | 261 { |
259 if (!player()) | 262 if (!webMediaPlayer()) |
260 return 0; | 263 return 0; |
261 | 264 |
262 return player()->droppedFrameCount(); | 265 return webMediaPlayer()->droppedFrameCount(); |
263 } | 266 } |
264 | 267 |
265 KURL HTMLVideoElement::posterImageURL() const | 268 KURL HTMLVideoElement::posterImageURL() const |
266 { | 269 { |
267 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); | 270 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); |
268 if (url.isEmpty()) | 271 if (url.isEmpty()) |
269 return KURL(); | 272 return KURL(); |
270 return document().completeURL(url); | 273 return document().completeURL(url); |
271 } | 274 } |
272 | 275 |
(...skipping 17 matching lines...) Expand all Loading... | |
290 } | 293 } |
291 | 294 |
292 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i ntrinsicSize)); | 295 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i ntrinsicSize)); |
293 | 296 |
294 *status = NormalSourceImageStatus; | 297 *status = NormalSourceImageStatus; |
295 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); | 298 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); |
296 } | 299 } |
297 | 300 |
298 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const | 301 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const |
299 { | 302 { |
300 return !hasSingleSecurityOrigin() || (!(player() && player()->didPassCORSAcc essCheck()) && destinationSecurityOrigin->taintsCanvas(currentSrc())); | 303 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer() ->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr c())); |
301 } | 304 } |
302 | 305 |
303 FloatSize HTMLVideoElement::sourceSize() const | 306 FloatSize HTMLVideoElement::sourceSize() const |
304 { | 307 { |
305 return FloatSize(videoWidth(), videoHeight()); | 308 return FloatSize(videoWidth(), videoHeight()); |
306 } | 309 } |
307 | 310 |
308 } | 311 } |
OLD | NEW |