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 |
123 unsigned HTMLVideoElement::videoWidth() const | 134 unsigned HTMLVideoElement::videoWidth() const |
124 { | 135 { |
125 if (!player()) | 136 if (!player()) |
126 return 0; | 137 return 0; |
127 return player()->naturalSize().width(); | 138 return player()->naturalSize().width(); |
128 } | 139 } |
129 | 140 |
130 unsigned HTMLVideoElement::videoHeight() const | 141 unsigned HTMLVideoElement::videoHeight() const |
131 { | 142 { |
132 if (!player()) | 143 if (!player()) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 200 } |
190 | 201 |
191 bool HTMLVideoElement::hasAvailableVideoFrame() const | 202 bool HTMLVideoElement::hasAvailableVideoFrame() const |
192 { | 203 { |
193 if (!player()) | 204 if (!player()) |
194 return false; | 205 return false; |
195 | 206 |
196 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu
rrentData; | 207 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu
rrentData; |
197 } | 208 } |
198 | 209 |
| 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 |
199 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) | 245 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) |
200 { | 246 { |
201 if (m_imageLoader) | 247 if (m_imageLoader) |
202 m_imageLoader->elementDidMoveToNewDocument(); | 248 m_imageLoader->elementDidMoveToNewDocument(); |
203 HTMLMediaElement::didMoveToNewDocument(oldDocument); | 249 HTMLMediaElement::didMoveToNewDocument(oldDocument); |
204 } | 250 } |
205 | 251 |
206 unsigned HTMLVideoElement::webkitDecodedFrameCount() const | 252 unsigned HTMLVideoElement::webkitDecodedFrameCount() const |
207 { | 253 { |
208 if (!player()) | 254 if (!player()) |
(...skipping 17 matching lines...) Expand all Loading... |
226 return KURL(); | 272 return KURL(); |
227 return document().completeURL(url); | 273 return document().completeURL(url); |
228 } | 274 } |
229 | 275 |
230 KURL HTMLVideoElement::mediaPlayerPosterURL() | 276 KURL HTMLVideoElement::mediaPlayerPosterURL() |
231 { | 277 { |
232 return posterImageURL(); | 278 return posterImageURL(); |
233 } | 279 } |
234 | 280 |
235 } | 281 } |
OLD | NEW |