| 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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 return IntSize(width(), height()); | 1105 return IntSize(width(), height()); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 ScriptPromise HTMLCanvasElement::createImageBitmap(ScriptState* scriptState, Eve
ntTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) | 1108 ScriptPromise HTMLCanvasElement::createImageBitmap(ScriptState* scriptState, Eve
ntTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) |
| 1109 { | 1109 { |
| 1110 DCHECK(eventTarget.toLocalDOMWindow()); | 1110 DCHECK(eventTarget.toLocalDOMWindow()); |
| 1111 if (!sw || !sh) { | 1111 if (!sw || !sh) { |
| 1112 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 1112 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
| 1113 return ScriptPromise(); | 1113 return ScriptPromise(); |
| 1114 } | 1114 } |
| 1115 if ((options.hasResizeWidth() && options.resizeWidth() <= 0) || (options.has
ResizeHeight() && options.resizeHeight() <= 0)) { |
| 1116 exceptionState.throwDOMException(InvalidStateError, "The resizeWidth or/
and resizeHeight is less than or equals to 0."); |
| 1117 return ScriptPromise(); |
| 1118 } |
| 1115 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); | 1119 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); |
| 1116 } | 1120 } |
| 1117 | 1121 |
| 1118 bool HTMLCanvasElement::isOpaque() const | 1122 bool HTMLCanvasElement::isOpaque() const |
| 1119 { | 1123 { |
| 1120 return m_context && !m_context->hasAlpha(); | 1124 return m_context && !m_context->hasAlpha(); |
| 1121 } | 1125 } |
| 1122 | 1126 |
| 1123 bool HTMLCanvasElement::isSupportedInteractiveCanvasFallback(const Element& elem
ent) | 1127 bool HTMLCanvasElement::isSupportedInteractiveCanvasFallback(const Element& elem
ent) |
| 1124 { | 1128 { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 | 1198 |
| 1195 bool HTMLCanvasElement::createSurfaceLayer() | 1199 bool HTMLCanvasElement::createSurfaceLayer() |
| 1196 { | 1200 { |
| 1197 DCHECK(!m_surfaceLayerBridge); | 1201 DCHECK(!m_surfaceLayerBridge); |
| 1198 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne
w CanvasSurfaceLayerBridgeClientImpl()); | 1202 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne
w CanvasSurfaceLayerBridgeClientImpl()); |
| 1199 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri
dgeClient))); | 1203 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri
dgeClient))); |
| 1200 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height(
)); | 1204 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height(
)); |
| 1201 } | 1205 } |
| 1202 | 1206 |
| 1203 } // namespace blink | 1207 } // namespace blink |
| OLD | NEW |