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

Side by Side Diff: Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 758493004: canvas: make a temporary buffer when a context doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (!canvas->originClean()) { 171 if (!canvas->originClean()) {
172 exceptionState.throwSecurityError("The canvas element provided is tainte d with cross-origin data."); 172 exceptionState.throwSecurityError("The canvas element provided is tainte d with cross-origin data.");
173 return ScriptPromise(); 173 return ScriptPromise();
174 } 174 }
175 if (!sw || !sh) { 175 if (!sw || !sh) {
176 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); 176 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
177 return ScriptPromise(); 177 return ScriptPromise();
178 } 178 }
179 179
180 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 180 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
181 return fulfillImageBitmap(scriptState, canvas->buffer() ? ImageBitmap::creat e(canvas, IntRect(sx, sy, sw, sh)) : nullptr); 181 RefPtr<Image> canvasImage = canvas->copiedImage(BackBuffer);
Justin Novosad 2014/11/27 00:49:31 This seems like a step in the wrong direction. We
dshwang 2014/11/27 15:12:11 Thank you for explaining. I rollback this change.
182 return fulfillImageBitmap(scriptState, canvasImage ? ImageBitmap::create(can vasImage.get(), IntRect(sx, sy, sw, sh)) : nullptr);
182 } 183 }
183 184
184 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState) 185 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState)
185 { 186 {
186 ImageBitmapLoader* loader = ImageBitmapFactories::ImageBitmapLoader::create( from(eventTarget), IntRect(), scriptState); 187 ImageBitmapLoader* loader = ImageBitmapFactories::ImageBitmapLoader::create( from(eventTarget), IntRect(), scriptState);
187 ScriptPromise promise = loader->promise(); 188 ScriptPromise promise = loader->promise();
188 from(eventTarget).addLoader(loader); 189 from(eventTarget).addLoader(loader);
189 loader->loadBlobAsync(eventTarget.executionContext(), blob); 190 loader->loadBlobAsync(eventTarget.executionContext(), blob);
190 return promise; 191 return promise;
191 } 192 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 { 331 {
331 rejectPromise(); 332 rejectPromise();
332 } 333 }
333 334
334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) 335 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor)
335 { 336 {
336 visitor->trace(m_factory); 337 visitor->trace(m_factory);
337 } 338 }
338 339
339 } // namespace blink 340 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698