| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu
ment) | 56 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu
ment) |
| 57 { | 57 { |
| 58 RefPtrWillBeRawPtr<HTMLVideoElement> video = adoptRefWillBeRefCountedGarbage
Collected(new HTMLVideoElement(document)); | 58 RefPtrWillBeRawPtr<HTMLVideoElement> video = adoptRefWillBeRefCountedGarbage
Collected(new HTMLVideoElement(document)); |
| 59 video->ensureUserAgentShadowRoot(); | 59 video->ensureUserAgentShadowRoot(); |
| 60 video->suspendIfNeeded(); | 60 video->suspendIfNeeded(); |
| 61 return video.release(); | 61 return video.release(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void HTMLVideoElement::trace(Visitor* visitor) |
| 65 { |
| 66 visitor->trace(m_imageLoader); |
| 67 HTMLMediaElement::trace(visitor); |
| 68 } |
| 69 |
| 64 bool HTMLVideoElement::rendererIsNeeded(const RenderStyle& style) | 70 bool HTMLVideoElement::rendererIsNeeded(const RenderStyle& style) |
| 65 { | 71 { |
| 66 return HTMLElement::rendererIsNeeded(style); | 72 return HTMLElement::rendererIsNeeded(style); |
| 67 } | 73 } |
| 68 | 74 |
| 69 RenderObject* HTMLVideoElement::createRenderer(RenderStyle*) | 75 RenderObject* HTMLVideoElement::createRenderer(RenderStyle*) |
| 70 { | 76 { |
| 71 return new RenderVideo(this); | 77 return new RenderVideo(this); |
| 72 } | 78 } |
| 73 | 79 |
| 74 void HTMLVideoElement::attach(const AttachContext& context) | 80 void HTMLVideoElement::attach(const AttachContext& context) |
| 75 { | 81 { |
| 76 HTMLMediaElement::attach(context); | 82 HTMLMediaElement::attach(context); |
| 77 | 83 |
| 78 updateDisplayState(); | 84 updateDisplayState(); |
| 79 if (shouldDisplayPosterImage()) { | 85 if (shouldDisplayPosterImage()) { |
| 80 if (!m_imageLoader) | 86 if (!m_imageLoader) |
| 81 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 87 m_imageLoader = HTMLImageLoader::create(this); |
| 82 m_imageLoader->updateFromElement(); | 88 m_imageLoader->updateFromElement(); |
| 83 if (renderer()) | 89 if (renderer()) |
| 84 toRenderImage(renderer())->imageResource()->setImageResource(m_image
Loader->image()); | 90 toRenderImage(renderer())->imageResource()->setImageResource(m_image
Loader->image()); |
| 85 } | 91 } |
| 86 } | 92 } |
| 87 | 93 |
| 88 void HTMLVideoElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) | 94 void HTMLVideoElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) |
| 89 { | 95 { |
| 90 if (name == widthAttr) | 96 if (name == widthAttr) |
| 91 addHTMLLengthToStyle(style, CSSPropertyWidth, value); | 97 addHTMLLengthToStyle(style, CSSPropertyWidth, value); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 } | 109 } |
| 104 | 110 |
| 105 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 111 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 106 { | 112 { |
| 107 if (name == posterAttr) { | 113 if (name == posterAttr) { |
| 108 // Force a poster recalc by setting m_displayMode to Unknown directly be
fore calling updateDisplayState. | 114 // Force a poster recalc by setting m_displayMode to Unknown directly be
fore calling updateDisplayState. |
| 109 HTMLMediaElement::setDisplayMode(Unknown); | 115 HTMLMediaElement::setDisplayMode(Unknown); |
| 110 updateDisplayState(); | 116 updateDisplayState(); |
| 111 if (shouldDisplayPosterImage()) { | 117 if (shouldDisplayPosterImage()) { |
| 112 if (!m_imageLoader) | 118 if (!m_imageLoader) |
| 113 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 119 m_imageLoader = HTMLImageLoader::create(this); |
| 114 m_imageLoader->updateFromElementIgnoringPreviousError(); | 120 m_imageLoader->updateFromElementIgnoringPreviousError(); |
| 115 } else { | 121 } else { |
| 116 if (renderer()) | 122 if (renderer()) |
| 117 toRenderImage(renderer())->imageResource()->setImageResource(0); | 123 toRenderImage(renderer())->imageResource()->setImageResource(0); |
| 118 } | 124 } |
| 119 // Notify the player when the poster image URL changes. | 125 // Notify the player when the poster image URL changes. |
| 120 if (player()) | 126 if (player()) |
| 121 player()->setPoster(posterImageURL()); | 127 player()->setPoster(posterImageURL()); |
| 122 } else | 128 } else |
| 123 HTMLMediaElement::parseAttribute(name, value); | 129 HTMLMediaElement::parseAttribute(name, value); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 { | 307 { |
| 302 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer()
->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr
c())); | 308 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer()
->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr
c())); |
| 303 } | 309 } |
| 304 | 310 |
| 305 FloatSize HTMLVideoElement::sourceSize() const | 311 FloatSize HTMLVideoElement::sourceSize() const |
| 306 { | 312 { |
| 307 return FloatSize(videoWidth(), videoHeight()); | 313 return FloatSize(videoWidth(), videoHeight()); |
| 308 } | 314 } |
| 309 | 315 |
| 310 } | 316 } |
| OLD | NEW |