Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1032)

Side by Side Diff: Source/core/html/HTMLVideoElement.cpp

Issue 1240573005: Make video.webkitSupportsFullscreen an alias of document.fullscreenEnabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move comments to assert descriptions Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLVideoElement.h ('k') | Source/core/html/HTMLVideoElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/html/HTMLVideoElement.h" 27 #include "core/html/HTMLVideoElement.h"
28 28
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "core/CSSPropertyNames.h" 30 #include "core/CSSPropertyNames.h"
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.h"
32 #include "core/dom/Attribute.h" 32 #include "core/dom/Attribute.h"
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
35 #include "core/dom/Fullscreen.h"
35 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
36 #include "core/frame/Settings.h" 37 #include "core/frame/Settings.h"
37 #include "core/html/parser/HTMLParserIdioms.h" 38 #include "core/html/parser/HTMLParserIdioms.h"
38 #include "core/layout/LayoutImage.h" 39 #include "core/layout/LayoutImage.h"
39 #include "core/layout/LayoutVideo.h" 40 #include "core/layout/LayoutVideo.h"
40 #include "platform/UserGestureIndicator.h" 41 #include "platform/UserGestureIndicator.h"
41 #include "platform/graphics/GraphicsContext.h" 42 #include "platform/graphics/GraphicsContext.h"
42 #include "platform/graphics/ImageBuffer.h" 43 #include "platform/graphics/ImageBuffer.h"
43 #include "platform/graphics/gpu/Extensions3DUtil.h" 44 #include "platform/graphics/gpu/Extensions3DUtil.h"
44 #include "public/platform/WebCanvas.h" 45 #include "public/platform/WebCanvas.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 toLayoutImage(layoutObject())->imageResource()->setImageResource (0); 130 toLayoutImage(layoutObject())->imageResource()->setImageResource (0);
130 } 131 }
131 // Notify the player when the poster image URL changes. 132 // Notify the player when the poster image URL changes.
132 if (webMediaPlayer()) 133 if (webMediaPlayer())
133 webMediaPlayer()->setPoster(posterImageURL()); 134 webMediaPlayer()->setPoster(posterImageURL());
134 } else { 135 } else {
135 HTMLMediaElement::parseAttribute(name, value); 136 HTMLMediaElement::parseAttribute(name, value);
136 } 137 }
137 } 138 }
138 139
139 bool HTMLVideoElement::supportsFullscreen() const
140 {
141 if (!document().page())
142 return false;
143
144 if (!webMediaPlayer())
145 return false;
146
147 return true;
148 }
149
150 unsigned HTMLVideoElement::videoWidth() const 140 unsigned HTMLVideoElement::videoWidth() const
151 { 141 {
152 if (!webMediaPlayer()) 142 if (!webMediaPlayer())
153 return 0; 143 return 0;
154 return webMediaPlayer()->naturalSize().width; 144 return webMediaPlayer()->naturalSize().width;
155 } 145 }
156 146
157 unsigned HTMLVideoElement::videoHeight() const 147 unsigned HTMLVideoElement::videoHeight() const
158 { 148 {
159 if (!webMediaPlayer()) 149 if (!webMediaPlayer())
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 215 }
226 216
227 bool HTMLVideoElement::hasAvailableVideoFrame() const 217 bool HTMLVideoElement::hasAvailableVideoFrame() const
228 { 218 {
229 if (!webMediaPlayer()) 219 if (!webMediaPlayer())
230 return false; 220 return false;
231 221
232 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= Web MediaPlayer::ReadyStateHaveCurrentData; 222 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= Web MediaPlayer::ReadyStateHaveCurrentData;
233 } 223 }
234 224
235 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& exceptionState) 225 void HTMLVideoElement::webkitEnterFullscreen()
236 { 226 {
237 if (isFullscreen()) 227 if (!isFullscreen())
238 return; 228 enterFullscreen();
239
240 if (!supportsFullscreen()) {
241 exceptionState.throwDOMException(InvalidStateError, "This element does n ot support fullscreen mode.");
242 return;
243 }
244
245 enterFullscreen();
246 } 229 }
247 230
248 void HTMLVideoElement::webkitExitFullscreen() 231 void HTMLVideoElement::webkitExitFullscreen()
249 { 232 {
250 if (isFullscreen()) 233 if (isFullscreen())
251 exitFullscreen(); 234 exitFullscreen();
252 } 235 }
253 236
254 bool HTMLVideoElement::webkitSupportsFullscreen() 237 bool HTMLVideoElement::webkitSupportsFullscreen()
255 { 238 {
256 return supportsFullscreen(); 239 return Fullscreen::fullscreenEnabled(document());
257 } 240 }
258 241
259 bool HTMLVideoElement::webkitDisplayingFullscreen() 242 bool HTMLVideoElement::webkitDisplayingFullscreen()
260 { 243 {
261 return isFullscreen(); 244 return isFullscreen();
262 } 245 }
263 246
264 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) 247 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument)
265 { 248 {
266 if (m_imageLoader) 249 if (m_imageLoader)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 { 304 {
322 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); 305 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin);
323 } 306 }
324 307
325 FloatSize HTMLVideoElement::elementSize() const 308 FloatSize HTMLVideoElement::elementSize() const
326 { 309 {
327 return FloatSize(videoWidth(), videoHeight()); 310 return FloatSize(videoWidth(), videoHeight());
328 } 311 }
329 312
330 } // namespace blink 313 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLVideoElement.h ('k') | Source/core/html/HTMLVideoElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698