OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" | 5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" |
6 | 6 |
7 #include "bindings/modules/v8/UnionTypesModules.h" | 7 #include "bindings/modules/v8/UnionTypesModules.h" |
8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
9 #include "platform/graphics/ImageBuffer.h" | 9 #include "platform/graphics/ImageBuffer.h" |
10 #include "platform/graphics/StaticBitmapImage.h" | 10 #include "platform/graphics/StaticBitmapImage.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 bool OffscreenCanvasRenderingContext2D::originClean() const | 34 bool OffscreenCanvasRenderingContext2D::originClean() const |
35 { | 35 { |
36 return m_originClean; | 36 return m_originClean; |
37 } | 37 } |
38 | 38 |
39 void OffscreenCanvasRenderingContext2D::setOriginTainted() | 39 void OffscreenCanvasRenderingContext2D::setOriginTainted() |
40 { | 40 { |
41 m_originClean = false; | 41 m_originClean = false; |
42 } | 42 } |
43 | 43 |
44 bool OffscreenCanvasRenderingContext2D::wouldTaintOrigin(CanvasImageSource* sour
ce) | 44 bool OffscreenCanvasRenderingContext2D::wouldTaintOrigin(CanvasImageSource* sour
ce, ScriptState* scriptState) |
45 { | 45 { |
| 46 if (scriptState->getExecutionContext()->isWorkerGlobalScope()) { |
| 47 // Currently, we only support passing in ImageBitmap as source image in |
| 48 // drawImage() or createPattern() in a OffscreenCanvas2d in worker. |
| 49 ASSERT(source->isImageBitmap()); |
| 50 // ImageBitmap wouldTaintOrigin doesn't consider destinationSecurityOrig
in. |
| 51 return source->wouldTaintOrigin(nullptr); |
| 52 } |
| 53 |
| 54 // TODO(crbug.com/606925): implement wouldTaintOrigin for OffscreenCanvas2d |
| 55 // on main thread |
46 NOTIMPLEMENTED(); | 56 NOTIMPLEMENTED(); |
47 return false; | 57 return true; |
48 } | 58 } |
49 | 59 |
50 int OffscreenCanvasRenderingContext2D::width() const | 60 int OffscreenCanvasRenderingContext2D::width() const |
51 { | 61 { |
52 return getOffscreenCanvas()->width(); | 62 return getOffscreenCanvas()->width(); |
53 } | 63 } |
54 | 64 |
55 int OffscreenCanvasRenderingContext2D::height() const | 65 int OffscreenCanvasRenderingContext2D::height() const |
56 { | 66 { |
57 return getOffscreenCanvas()->height(); | 67 return getOffscreenCanvas()->height(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 151 } |
142 #endif | 152 #endif |
143 } | 153 } |
144 | 154 |
145 bool OffscreenCanvasRenderingContext2D::isContextLost() const | 155 bool OffscreenCanvasRenderingContext2D::isContextLost() const |
146 { | 156 { |
147 return false; | 157 return false; |
148 } | 158 } |
149 | 159 |
150 } | 160 } |
OLD | NEW |