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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } | 996 } |
997 | 997 |
998 IntSize HTMLCanvasElement::bitmapSourceSize() const | 998 IntSize HTMLCanvasElement::bitmapSourceSize() const |
999 { | 999 { |
1000 return IntSize(width(), height()); | 1000 return IntSize(width(), height()); |
1001 } | 1001 } |
1002 | 1002 |
1003 ScriptPromise HTMLCanvasElement::createImageBitmap(ScriptState* scriptState, Eve
ntTarget& eventTarget, int sx, int sy, int sw, int sh, ExceptionState& exception
State) | 1003 ScriptPromise HTMLCanvasElement::createImageBitmap(ScriptState* scriptState, Eve
ntTarget& eventTarget, int sx, int sy, int sw, int sh, ExceptionState& exception
State) |
1004 { | 1004 { |
1005 ASSERT(eventTarget.toDOMWindow()); | 1005 ASSERT(eventTarget.toDOMWindow()); |
1006 if (!originClean()) { | |
1007 exceptionState.throwSecurityError("The canvas element provided is tainte
d with cross-origin data."); | |
1008 return ScriptPromise(); | |
1009 } | |
1010 if (!sw || !sh) { | 1006 if (!sw || !sh) { |
1011 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 1007 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
1012 return ScriptPromise(); | 1008 return ScriptPromise(); |
1013 } | 1009 } |
1014 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); | 1010 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); |
1015 } | 1011 } |
1016 | 1012 |
1017 bool HTMLCanvasElement::isOpaque() const | 1013 bool HTMLCanvasElement::isOpaque() const |
1018 { | 1014 { |
1019 return m_context && !m_context->hasAlpha(); | 1015 return m_context && !m_context->hasAlpha(); |
1020 } | 1016 } |
1021 | 1017 |
1022 } // blink | 1018 } // blink |
OLD | NEW |