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

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

Issue 291873002: Eliminate MediaPlayer & MediaPlayerClient abstractions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated as per the review comments Created 6 years, 6 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
« no previous file with comments | « Source/core/html/HTMLVideoElement.h ('k') | Source/core/rendering/RenderVideo.cpp » ('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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return false; 127 return false;
128 128
129 if (!player()) 129 if (!player())
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 webMediaPlayer()->naturalSize().width;
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 webMediaPlayer()->naturalSize().height;
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
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLVideoElement.h ('k') | Source/core/rendering/RenderVideo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698