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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 double quality = UndefinedQualityValue; | 570 double quality = UndefinedQualityValue; |
571 if (!qualityArgument.isEmpty()) { | 571 if (!qualityArgument.isEmpty()) { |
572 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); | 572 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); |
573 if (v8Value->IsNumber()) { | 573 if (v8Value->IsNumber()) { |
574 quality = v8Value.As<v8::Number>()->Value(); | 574 quality = v8Value.As<v8::Number>()->Value(); |
575 } | 575 } |
576 } | 576 } |
577 return toDataURLInternal(mimeType, quality, BackBuffer); | 577 return toDataURLInternal(mimeType, quality, BackBuffer); |
578 } | 578 } |
579 | 579 |
580 void HTMLCanvasElement::toBlob(ScriptState* scriptState, FileCallback* callback,
const String& mimeType, const ScriptValue& qualityArgument, ExceptionState& exc
eptionState) | 580 void HTMLCanvasElement::toBlob(ScriptState* scriptState, BlobCallback* callback,
const String& mimeType, const ScriptValue& qualityArgument, ExceptionState& exc
eptionState) |
581 { | 581 { |
582 if (!originClean()) { | 582 if (!originClean()) { |
583 exceptionState.throwSecurityError("Tainted canvases may not be exported.
"); | 583 exceptionState.throwSecurityError("Tainted canvases may not be exported.
"); |
584 return; | 584 return; |
585 } | 585 } |
586 | 586 |
587 if (!isPaintable()) { | 587 if (!isPaintable()) { |
588 // If the canvas element's bitmap has no pixels | 588 // If the canvas element's bitmap has no pixels |
589 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, bind(&FileCallback::handleEvent, callback, nullptr)); | 589 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, bind(&BlobCallback::handleEvent, callback, nullptr)); |
590 return; | 590 return; |
591 } | 591 } |
592 | 592 |
593 double quality = UndefinedQualityValue; | 593 double quality = UndefinedQualityValue; |
594 if (!qualityArgument.isEmpty()) { | 594 if (!qualityArgument.isEmpty()) { |
595 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); | 595 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); |
596 if (v8Value->IsNumber()) { | 596 if (v8Value->IsNumber()) { |
597 quality = v8Value.As<v8::Number>()->Value(); | 597 quality = v8Value.As<v8::Number>()->Value(); |
598 } | 598 } |
599 } | 599 } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 } | 1010 } |
1011 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); | 1011 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); |
1012 } | 1012 } |
1013 | 1013 |
1014 bool HTMLCanvasElement::isOpaque() const | 1014 bool HTMLCanvasElement::isOpaque() const |
1015 { | 1015 { |
1016 return m_context && !m_context->hasAlpha(); | 1016 return m_context && !m_context->hasAlpha(); |
1017 } | 1017 } |
1018 | 1018 |
1019 } // blink | 1019 } // blink |
OLD | NEW |