OLD | NEW |
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this
method to be used on a worker thread). | 376 // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this
method to be used on a worker thread). |
377 if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncod
ing(lowercaseMimeType)) | 377 if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncod
ing(lowercaseMimeType)) |
378 lowercaseMimeType = "image/png"; | 378 lowercaseMimeType = "image/png"; |
379 | 379 |
380 return lowercaseMimeType; | 380 return lowercaseMimeType; |
381 } | 381 } |
382 | 382 |
383 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit
y, ExceptionCode& ec) | 383 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit
y, ExceptionCode& ec) |
384 { | 384 { |
385 if (!m_originClean) { | 385 if (!m_originClean) { |
386 ec = SECURITY_ERR; | 386 ec = SecurityError; |
387 return String(); | 387 return String(); |
388 } | 388 } |
389 | 389 |
390 if (m_size.isEmpty() || !buffer()) | 390 if (m_size.isEmpty() || !buffer()) |
391 return String("data:,"); | 391 return String("data:,"); |
392 | 392 |
393 String encodingMimeType = toEncodingMimeType(mimeType); | 393 String encodingMimeType = toEncodingMimeType(mimeType); |
394 | 394 |
395 // Try to get ImageData first, as that may avoid lossy conversions. | 395 // Try to get ImageData first, as that may avoid lossy conversions. |
396 RefPtr<ImageData> imageData = getImageData(); | 396 RefPtr<ImageData> imageData = getImageData(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 HTMLElement::reportMemoryUsage(memoryObjectInfo); | 584 HTMLElement::reportMemoryUsage(memoryObjectInfo); |
585 info.addMember(m_observers, "observers"); | 585 info.addMember(m_observers, "observers"); |
586 info.addMember(m_context, "context"); | 586 info.addMember(m_context, "context"); |
587 info.addMember(m_imageBuffer, "imageBuffer"); | 587 info.addMember(m_imageBuffer, "imageBuffer"); |
588 info.addMember(m_contextStateSaver, "contextStateSaver"); | 588 info.addMember(m_contextStateSaver, "contextStateSaver"); |
589 info.addMember(m_presentedImage, "presentedImage"); | 589 info.addMember(m_presentedImage, "presentedImage"); |
590 info.addMember(m_copiedImage, "copiedImage"); | 590 info.addMember(m_copiedImage, "copiedImage"); |
591 } | 591 } |
592 | 592 |
593 } | 593 } |
OLD | NEW |