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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 1455763002: Use union type in ImageBitmapFactories.idl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better argument passing Created 5 years 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/frame/ImageBitmap.h" 6 #include "core/frame/ImageBitmap.h"
7 7
8 #include "core/html/HTMLCanvasElement.h" 8 #include "core/html/HTMLCanvasElement.h"
9 #include "core/html/HTMLVideoElement.h" 9 #include "core/html/HTMLVideoElement.h"
10 #include "core/html/ImageData.h" 10 #include "core/html/ImageData.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 IntSize ImageBitmap::size() const 182 IntSize ImageBitmap::size() const
183 { 183 {
184 if (!m_image) 184 if (!m_image)
185 return IntSize(); 185 return IntSize();
186 ASSERT(m_image->width() > 0 && m_image->height() > 0); 186 ASSERT(m_image->width() > 0 && m_image->height() > 0);
187 return IntSize(m_image->width(), m_image->height()); 187 return IntSize(m_image->width(), m_image->height());
188 } 188 }
189 189
190 ScriptPromise ImageBitmap::createImageBitmap(ScriptState* scriptState, EventTarg et& eventTarget, int sx, int sy, int sw, int sh, ExceptionState& exceptionState)
191 {
192 if (!sw || !sh) {
193 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
194 return ScriptPromise();
195 }
196 return ImageBitmapSource::fulfillImageBitmap(scriptState, create(this, IntRe ct(sx, sy, sw, sh)));
197 }
198
190 void ImageBitmap::notifyImageSourceChanged() 199 void ImageBitmap::notifyImageSourceChanged()
191 { 200 {
192 } 201 }
193 202
194 PassRefPtr<Image> ImageBitmap::getSourceImageForCanvas(SourceImageStatus* status , AccelerationHint) const 203 PassRefPtr<Image> ImageBitmap::getSourceImageForCanvas(SourceImageStatus* status , AccelerationHint) const
195 { 204 {
196 *status = NormalSourceImageStatus; 205 *status = NormalSourceImageStatus;
197 return m_image ? m_image : nullptr; 206 return m_image ? m_image : nullptr;
198 } 207 }
199 208
200 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const 209 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const
201 { 210 {
202 } 211 }
203 212
204 FloatSize ImageBitmap::elementSize() const 213 FloatSize ImageBitmap::elementSize() const
205 { 214 {
206 return FloatSize(width(), height()); 215 return FloatSize(width(), height());
207 } 216 }
208 217
209 DEFINE_TRACE(ImageBitmap) 218 DEFINE_TRACE(ImageBitmap)
210 { 219 {
211 ImageLoaderClient::trace(visitor); 220 ImageLoaderClient::trace(visitor);
212 } 221 }
213 222
214 } // namespace blink 223 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.h ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698