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

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

Issue 304003002: Don't mutate the DOM from inside an Element's constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix includes 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.cpp ('k') | no next file » | 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 "CSSPropertyNames.h" 29 #include "CSSPropertyNames.h"
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "bindings/v8/ExceptionState.h" 31 #include "bindings/v8/ExceptionState.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/shadow/ShadowRoot.h"
36 #include "core/frame/Settings.h"
35 #include "core/html/HTMLImageLoader.h" 37 #include "core/html/HTMLImageLoader.h"
36 #include "core/html/canvas/CanvasRenderingContext.h" 38 #include "core/html/canvas/CanvasRenderingContext.h"
37 #include "core/html/parser/HTMLParserIdioms.h" 39 #include "core/html/parser/HTMLParserIdioms.h"
38 #include "core/frame/Settings.h"
39 #include "core/rendering/RenderImage.h" 40 #include "core/rendering/RenderImage.h"
40 #include "core/rendering/RenderVideo.h" 41 #include "core/rendering/RenderVideo.h"
41 #include "platform/UserGestureIndicator.h" 42 #include "platform/UserGestureIndicator.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 using namespace HTMLNames; 46 using namespace HTMLNames;
46 47
47 inline HTMLVideoElement::HTMLVideoElement(Document& document) 48 inline HTMLVideoElement::HTMLVideoElement(Document& document)
48 : HTMLMediaElement(videoTag, document) 49 : HTMLMediaElement(videoTag, document)
49 { 50 {
50 ScriptWrappable::init(this); 51 ScriptWrappable::init(this);
51 if (document.settings()) 52 if (document.settings())
52 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste rURL()); 53 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste rURL());
53 } 54 }
54 55
55 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu ment) 56 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu ment)
56 { 57 {
57 RefPtrWillBeRawPtr<HTMLVideoElement> videoElement(adoptRefWillBeRefCountedGa rbageCollected(new HTMLVideoElement(document))); 58 RefPtrWillBeRawPtr<HTMLVideoElement> video = adoptRefWillBeRefCountedGarbage Collected(new HTMLVideoElement(document));
58 videoElement->suspendIfNeeded(); 59 video->ensureUserAgentShadowRoot();
59 return videoElement.release(); 60 video->suspendIfNeeded();
61 return video.release();
60 } 62 }
61 63
62 bool HTMLVideoElement::rendererIsNeeded(const RenderStyle& style) 64 bool HTMLVideoElement::rendererIsNeeded(const RenderStyle& style)
63 { 65 {
64 return HTMLElement::rendererIsNeeded(style); 66 return HTMLElement::rendererIsNeeded(style);
65 } 67 }
66 68
67 RenderObject* HTMLVideoElement::createRenderer(RenderStyle*) 69 RenderObject* HTMLVideoElement::createRenderer(RenderStyle*)
68 { 70 {
69 return new RenderVideo(this); 71 return new RenderVideo(this);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 { 301 {
300 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer() ->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr c())); 302 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer() ->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr c()));
301 } 303 }
302 304
303 FloatSize HTMLVideoElement::sourceSize() const 305 FloatSize HTMLVideoElement::sourceSize() const
304 { 306 {
305 return FloatSize(videoWidth(), videoHeight()); 307 return FloatSize(videoWidth(), videoHeight());
306 } 308 }
307 309
308 } 310 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698