OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return ScriptPromise(); | 97 return ScriptPromise(); |
98 } | 98 } |
99 if (!sw || !sh) { | 99 if (!sw || !sh) { |
100 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 100 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
101 return ScriptPromise(); | 101 return ScriptPromise(); |
102 } | 102 } |
103 if (!image->cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) { | 103 if (!image->cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) { |
104 exceptionState.throwSecurityError("The source image contains image data
from multiple origins."); | 104 exceptionState.throwSecurityError("The source image contains image data
from multiple origins."); |
105 return ScriptPromise(); | 105 return ScriptPromise(); |
106 } | 106 } |
107 if (!image->cachedImage()->passesAccessControlCheck(eventTarget.toDOMWindow(
)->document()->securityOrigin()) && eventTarget.toDOMWindow()->document()->secur
ityOrigin()->taintsCanvas(image->src())) { | 107 Document* document = eventTarget.toDOMWindow()->document(); |
| 108 if (!image->cachedImage()->passesAccessControlCheck(document, document->secu
rityOrigin()) && document->securityOrigin()->taintsCanvas(image->src())) { |
108 exceptionState.throwSecurityError("Cross-origin access to the source ima
ge is denied."); | 109 exceptionState.throwSecurityError("Cross-origin access to the source ima
ge is denied."); |
109 return ScriptPromise(); | 110 return ScriptPromise(); |
110 } | 111 } |
111 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 112 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 |
112 return fulfillImageBitmap(scriptState, ImageBitmap::create(image, IntRect(sx
, sy, sw, sh))); | 113 return fulfillImageBitmap(scriptState, ImageBitmap::create(image, IntRect(sx
, sy, sw, sh))); |
113 } | 114 } |
114 | 115 |
115 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
EventTarget& eventTarget, HTMLVideoElement* video, ExceptionState& exceptionStat
e) | 116 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
EventTarget& eventTarget, HTMLVideoElement* video, ExceptionState& exceptionStat
e) |
116 { | 117 { |
117 IntSize s = sizeFor(video); | 118 IntSize s = sizeFor(video); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 { | 331 { |
331 rejectPromise(); | 332 rejectPromise(); |
332 } | 333 } |
333 | 334 |
334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) | 335 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) |
335 { | 336 { |
336 visitor->trace(m_factory); | 337 visitor->trace(m_factory); |
337 } | 338 } |
338 | 339 |
339 } // namespace blink | 340 } // namespace blink |
OLD | NEW |