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

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

Issue 96203003: Switch HTMLCanvasElement over to new-style ExceptionState. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLCanvasElementCustom.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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this method to be used on a worker thread). 366 // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this method to be used on a worker thread).
367 if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncod ing(lowercaseMimeType)) 367 if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncod ing(lowercaseMimeType))
368 lowercaseMimeType = "image/png"; 368 lowercaseMimeType = "image/png";
369 369
370 return lowercaseMimeType; 370 return lowercaseMimeType;
371 } 371 }
372 372
373 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit y, ExceptionState& exceptionState) 373 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit y, ExceptionState& exceptionState)
374 { 374 {
375 if (!m_originClean) { 375 if (!m_originClean) {
376 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute("to DataURL", "HTMLCanvasElement", "tainted canvases may not be exported.")); 376 exceptionState.throwSecurityError("tainted canvases may not be exported. ");
Mike West 2013/11/29 08:26:45 Nit: If you're changing this anyway, can you capit
sof 2013/11/29 08:58:03 Done, and same for the other taint-related error m
377 return String(); 377 return String();
378 } 378 }
379 379
380 if (m_size.isEmpty() || !buffer()) 380 if (m_size.isEmpty() || !buffer())
381 return String("data:,"); 381 return String("data:,");
382 382
383 String encodingMimeType = toEncodingMimeType(mimeType); 383 String encodingMimeType = toEncodingMimeType(mimeType);
384 384
385 // Try to get ImageData first, as that may avoid lossy conversions. 385 // Try to get ImageData first, as that may avoid lossy conversions.
386 RefPtr<ImageData> imageData = getImageData(); 386 RefPtr<ImageData> imageData = getImageData();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); 551 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer);
552 IntSize unscaledSize = size(); 552 IntSize unscaledSize = size();
553 IntSize size = convertLogicalToDevice(unscaledSize); 553 IntSize size = convertLogicalToDevice(unscaledSize);
554 AffineTransform transform; 554 AffineTransform transform;
555 if (size.width() && size.height()) 555 if (size.width() && size.height())
556 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height()); 556 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height());
557 return m_imageBuffer->baseTransform() * transform; 557 return m_imageBuffer->baseTransform() * transform;
558 } 558 }
559 559
560 } 560 }
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698