| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 if (renderer()) | 113 if (renderer()) |
| 114 toRenderImage(renderer())->imageResource()->setImageResource(0); | 114 toRenderImage(renderer())->imageResource()->setImageResource(0); |
| 115 } | 115 } |
| 116 // Notify the player when the poster image URL changes. | 116 // Notify the player when the poster image URL changes. |
| 117 if (player()) | 117 if (player()) |
| 118 player()->setPoster(posterImageURL()); | 118 player()->setPoster(posterImageURL()); |
| 119 } else | 119 } else |
| 120 HTMLMediaElement::parseAttribute(name, value); | 120 HTMLMediaElement::parseAttribute(name, value); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool HTMLVideoElement::supportsFullscreen() const | |
| 124 { | |
| 125 if (!document().page()) | |
| 126 return false; | |
| 127 | |
| 128 if (!player()) | |
| 129 return false; | |
| 130 | |
| 131 return true; | |
| 132 } | |
| 133 | |
| 134 unsigned HTMLVideoElement::videoWidth() const | 123 unsigned HTMLVideoElement::videoWidth() const |
| 135 { | 124 { |
| 136 if (!player()) | 125 if (!player()) |
| 137 return 0; | 126 return 0; |
| 138 return player()->naturalSize().width(); | 127 return player()->naturalSize().width(); |
| 139 } | 128 } |
| 140 | 129 |
| 141 unsigned HTMLVideoElement::videoHeight() const | 130 unsigned HTMLVideoElement::videoHeight() const |
| 142 { | 131 { |
| 143 if (!player()) | 132 if (!player()) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 189 } |
| 201 | 190 |
| 202 bool HTMLVideoElement::hasAvailableVideoFrame() const | 191 bool HTMLVideoElement::hasAvailableVideoFrame() const |
| 203 { | 192 { |
| 204 if (!player()) | 193 if (!player()) |
| 205 return false; | 194 return false; |
| 206 | 195 |
| 207 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu
rrentData; | 196 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu
rrentData; |
| 208 } | 197 } |
| 209 | 198 |
| 210 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& exceptionState) | |
| 211 { | |
| 212 if (isFullscreen()) | |
| 213 return; | |
| 214 | |
| 215 // Generate an exception if this isn't called in response to a user gesture,
or if the | |
| 216 // element does not support fullscreen. | |
| 217 if (userGestureRequiredForFullscreen() && !UserGestureIndicator::processingU
serGesture()) { | |
| 218 exceptionState.throwDOMException(InvalidStateError, "This element may on
ly enter fullscreen mode in response to a user gesture ('click', for example).")
; | |
| 219 return; | |
| 220 } | |
| 221 if (!supportsFullscreen()) { | |
| 222 exceptionState.throwDOMException(InvalidStateError, "This element does n
ot support fullscreen mode."); | |
| 223 return; | |
| 224 } | |
| 225 | |
| 226 enterFullscreen(); | |
| 227 } | |
| 228 | |
| 229 void HTMLVideoElement::webkitExitFullscreen() | |
| 230 { | |
| 231 if (isFullscreen()) | |
| 232 exitFullscreen(); | |
| 233 } | |
| 234 | |
| 235 bool HTMLVideoElement::webkitSupportsFullscreen() | |
| 236 { | |
| 237 return supportsFullscreen(); | |
| 238 } | |
| 239 | |
| 240 bool HTMLVideoElement::webkitDisplayingFullscreen() | |
| 241 { | |
| 242 return isFullscreen(); | |
| 243 } | |
| 244 | |
| 245 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) | 199 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) |
| 246 { | 200 { |
| 247 if (m_imageLoader) | 201 if (m_imageLoader) |
| 248 m_imageLoader->elementDidMoveToNewDocument(); | 202 m_imageLoader->elementDidMoveToNewDocument(); |
| 249 HTMLMediaElement::didMoveToNewDocument(oldDocument); | 203 HTMLMediaElement::didMoveToNewDocument(oldDocument); |
| 250 } | 204 } |
| 251 | 205 |
| 252 unsigned HTMLVideoElement::webkitDecodedFrameCount() const | 206 unsigned HTMLVideoElement::webkitDecodedFrameCount() const |
| 253 { | 207 { |
| 254 if (!player()) | 208 if (!player()) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 272 return KURL(); | 226 return KURL(); |
| 273 return document().completeURL(url); | 227 return document().completeURL(url); |
| 274 } | 228 } |
| 275 | 229 |
| 276 KURL HTMLVideoElement::mediaPlayerPosterURL() | 230 KURL HTMLVideoElement::mediaPlayerPosterURL() |
| 277 { | 231 { |
| 278 return posterImageURL(); | 232 return posterImageURL(); |
| 279 } | 233 } |
| 280 | 234 |
| 281 } | 235 } |
| OLD | NEW |