Chromium Code Reviews| 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 player()->setPoster(posterImageURL()); | 119 player()->setPoster(posterImageURL()); |
| 120 } else | 120 } else |
| 121 HTMLMediaElement::parseAttribute(name, value); | 121 HTMLMediaElement::parseAttribute(name, value); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool HTMLVideoElement::supportsFullscreen() const | 124 bool HTMLVideoElement::supportsFullscreen() const |
| 125 { | 125 { |
| 126 if (!document().page()) | 126 if (!document().page()) |
| 127 return false; | 127 return false; |
| 128 | 128 |
| 129 if (!player()) | 129 if (!webMediaPlayer()) |
|
acolwell GONE FROM CHROMIUM
2014/05/22 01:06:06
Doesn't this cause a subtle script visible change
Srirama
2014/05/22 06:06:04
You are right, there will be a difference if we ac
| |
| 130 return false; | 130 return false; |
| 131 | 131 |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 unsigned HTMLVideoElement::videoWidth() const | 135 unsigned HTMLVideoElement::videoWidth() const |
| 136 { | 136 { |
| 137 if (!player()) | 137 if (!webMediaPlayer()) |
| 138 return 0; | 138 return 0; |
| 139 return player()->naturalSize().width(); | 139 return static_cast<IntSize>(webMediaPlayer()->naturalSize()).width(); |
|
acolwell GONE FROM CHROMIUM
2014/05/22 01:06:06
Why do you need the cast to IntSize here?
Srirama
2014/05/22 06:06:04
This gives me error without cast, because webMedia
acolwell GONE FROM CHROMIUM
2014/05/22 14:47:46
WebSize is a struct with public width & height mem
| |
| 140 } | 140 } |
| 141 | 141 |
| 142 unsigned HTMLVideoElement::videoHeight() const | 142 unsigned HTMLVideoElement::videoHeight() const |
| 143 { | 143 { |
| 144 if (!player()) | 144 if (!webMediaPlayer()) |
| 145 return 0; | 145 return 0; |
| 146 return player()->naturalSize().height(); | 146 return static_cast<IntSize>(webMediaPlayer()->naturalSize()).height(); |
|
acolwell GONE FROM CHROMIUM
2014/05/22 01:06:06
Why do you need the cast to IntSize here?
Srirama
2014/05/22 06:06:04
ditto
| |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool HTMLVideoElement::isURLAttribute(const Attribute& attribute) const | 149 bool HTMLVideoElement::isURLAttribute(const Attribute& attribute) const |
| 150 { | 150 { |
| 151 return attribute.name() == posterAttr || HTMLMediaElement::isURLAttribute(at tribute); | 151 return attribute.name() == posterAttr || HTMLMediaElement::isURLAttribute(at tribute); |
| 152 } | 152 } |
| 153 | 153 |
| 154 const AtomicString HTMLVideoElement::imageSourceURL() const | 154 const AtomicString HTMLVideoElement::imageSourceURL() const |
| 155 { | 155 { |
| 156 const AtomicString& url = getAttribute(posterAttr); | 156 const AtomicString& url = getAttribute(posterAttr); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 197 |
| 198 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern alFormat, bool premultiplyAlpha, bool flipY) | 198 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern alFormat, bool premultiplyAlpha, bool flipY) |
| 199 { | 199 { |
| 200 if (!player()) | 200 if (!player()) |
| 201 return false; | 201 return false; |
| 202 return player()->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY); | 202 return player()->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY); |
| 203 } | 203 } |
| 204 | 204 |
| 205 bool HTMLVideoElement::hasAvailableVideoFrame() const | 205 bool HTMLVideoElement::hasAvailableVideoFrame() const |
| 206 { | 206 { |
| 207 if (!player()) | 207 if (!webMediaPlayer()) |
| 208 return false; | 208 return false; |
| 209 | 209 |
| 210 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu rrentData; | 210 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= bli nk::WebMediaPlayer::ReadyStateHaveCurrentData; |
| 211 } | 211 } |
| 212 | 212 |
| 213 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& exceptionState) | 213 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& exceptionState) |
| 214 { | 214 { |
| 215 if (isFullscreen()) | 215 if (isFullscreen()) |
| 216 return; | 216 return; |
| 217 | 217 |
| 218 if (!supportsFullscreen()) { | 218 if (!supportsFullscreen()) { |
| 219 exceptionState.throwDOMException(InvalidStateError, "This element does n ot support fullscreen mode."); | 219 exceptionState.throwDOMException(InvalidStateError, "This element does n ot support fullscreen mode."); |
| 220 return; | 220 return; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 241 | 241 |
| 242 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) | 242 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) |
| 243 { | 243 { |
| 244 if (m_imageLoader) | 244 if (m_imageLoader) |
| 245 m_imageLoader->elementDidMoveToNewDocument(); | 245 m_imageLoader->elementDidMoveToNewDocument(); |
| 246 HTMLMediaElement::didMoveToNewDocument(oldDocument); | 246 HTMLMediaElement::didMoveToNewDocument(oldDocument); |
| 247 } | 247 } |
| 248 | 248 |
| 249 unsigned HTMLVideoElement::webkitDecodedFrameCount() const | 249 unsigned HTMLVideoElement::webkitDecodedFrameCount() const |
| 250 { | 250 { |
| 251 if (!player()) | 251 if (!webMediaPlayer()) |
| 252 return 0; | 252 return 0; |
| 253 | 253 |
| 254 return player()->decodedFrameCount(); | 254 return webMediaPlayer()->decodedFrameCount(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 unsigned HTMLVideoElement::webkitDroppedFrameCount() const | 257 unsigned HTMLVideoElement::webkitDroppedFrameCount() const |
| 258 { | 258 { |
| 259 if (!player()) | 259 if (!webMediaPlayer()) |
| 260 return 0; | 260 return 0; |
| 261 | 261 |
| 262 return player()->droppedFrameCount(); | 262 return webMediaPlayer()->droppedFrameCount(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 KURL HTMLVideoElement::posterImageURL() const | 265 KURL HTMLVideoElement::posterImageURL() const |
| 266 { | 266 { |
| 267 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); | 267 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); |
| 268 if (url.isEmpty()) | 268 if (url.isEmpty()) |
| 269 return KURL(); | 269 return KURL(); |
| 270 return document().completeURL(url); | 270 return document().completeURL(url); |
| 271 } | 271 } |
| 272 | 272 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 290 } | 290 } |
| 291 | 291 |
| 292 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i ntrinsicSize)); | 292 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i ntrinsicSize)); |
| 293 | 293 |
| 294 *status = NormalSourceImageStatus; | 294 *status = NormalSourceImageStatus; |
| 295 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); | 295 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const | 298 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const |
| 299 { | 299 { |
| 300 return !hasSingleSecurityOrigin() || (!(player() && player()->didPassCORSAcc essCheck()) && destinationSecurityOrigin->taintsCanvas(currentSrc())); | 300 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer() ->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr c())); |
| 301 } | 301 } |
| 302 | 302 |
| 303 FloatSize HTMLVideoElement::sourceSize() const | 303 FloatSize HTMLVideoElement::sourceSize() const |
| 304 { | 304 { |
| 305 return FloatSize(videoWidth(), videoHeight()); | 305 return FloatSize(videoWidth(), videoHeight()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } | 308 } |
| OLD | NEW |