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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 HTMLMediaElement::collectStyleForPresentationAttribute(name, value, style); 107 HTMLMediaElement::collectStyleForPresentationAttribute(name, value, style);
108 } 108 }
109 109
110 bool HTMLVideoElement::isPresentationAttribute( 110 bool HTMLVideoElement::isPresentationAttribute(
111 const QualifiedName& name) const { 111 const QualifiedName& name) const {
112 if (name == widthAttr || name == heightAttr) 112 if (name == widthAttr || name == heightAttr)
113 return true; 113 return true;
114 return HTMLMediaElement::isPresentationAttribute(name); 114 return HTMLMediaElement::isPresentationAttribute(name);
115 } 115 }
116 116
117 void HTMLVideoElement::parseAttribute(const QualifiedName& name, 117 void HTMLVideoElement::parseAttribute(
118 const AtomicString& oldValue, 118 const AttributeModificationParams& params) {
119 const AtomicString& value) { 119 if (params.name == posterAttr) {
120 if (name == posterAttr) {
121 // In case the poster attribute is set after playback, don't update the 120 // In case the poster attribute is set after playback, don't update the
122 // display state, post playback the correct state will be picked up. 121 // display state, post playback the correct state will be picked up.
123 if (getDisplayMode() < Video || !hasAvailableVideoFrame()) { 122 if (getDisplayMode() < Video || !hasAvailableVideoFrame()) {
124 // Force a poster recalc by setting m_displayMode to Unknown directly 123 // Force a poster recalc by setting m_displayMode to Unknown directly
125 // before calling updateDisplayState. 124 // before calling updateDisplayState.
126 HTMLMediaElement::setDisplayMode(Unknown); 125 HTMLMediaElement::setDisplayMode(Unknown);
127 updateDisplayState(); 126 updateDisplayState();
128 } 127 }
129 if (!posterImageURL().isEmpty()) { 128 if (!posterImageURL().isEmpty()) {
130 if (!m_imageLoader) 129 if (!m_imageLoader)
131 m_imageLoader = HTMLImageLoader::create(this); 130 m_imageLoader = HTMLImageLoader::create(this);
132 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError); 131 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError);
133 } else { 132 } else {
134 if (layoutObject()) 133 if (layoutObject())
135 toLayoutImage(layoutObject())->imageResource()->setImageResource(0); 134 toLayoutImage(layoutObject())->imageResource()->setImageResource(0);
136 } 135 }
137 // Notify the player when the poster image URL changes. 136 // Notify the player when the poster image URL changes.
138 if (webMediaPlayer()) 137 if (webMediaPlayer())
139 webMediaPlayer()->setPoster(posterImageURL()); 138 webMediaPlayer()->setPoster(posterImageURL());
140 } else { 139 } else {
141 HTMLMediaElement::parseAttribute(name, oldValue, value); 140 HTMLMediaElement::parseAttribute(params);
142 } 141 }
143 } 142 }
144 143
145 unsigned HTMLVideoElement::videoWidth() const { 144 unsigned HTMLVideoElement::videoWidth() const {
146 if (!webMediaPlayer()) 145 if (!webMediaPlayer())
147 return 0; 146 return 0;
148 return webMediaPlayer()->naturalSize().width; 147 return webMediaPlayer()->naturalSize().width;
149 } 148 }
150 149
151 unsigned HTMLVideoElement::videoHeight() const { 150 unsigned HTMLVideoElement::videoHeight() const {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return ScriptPromise(); 376 return ScriptPromise();
378 if (!ImageBitmap::isResizeOptionValid(options, exceptionState)) 377 if (!ImageBitmap::isResizeOptionValid(options, exceptionState))
379 return ScriptPromise(); 378 return ScriptPromise();
380 return ImageBitmapSource::fulfillImageBitmap( 379 return ImageBitmapSource::fulfillImageBitmap(
381 scriptState, 380 scriptState,
382 ImageBitmap::create(this, cropRect, 381 ImageBitmap::create(this, cropRect,
383 eventTarget.toLocalDOMWindow()->document(), options)); 382 eventTarget.toLocalDOMWindow()->document(), options));
384 } 383 }
385 384
386 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLVideoElement.h ('k') | third_party/WebKit/Source/core/html/TextControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698