| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/canvas2d/CanvasRenderingContext2D.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 6 | 6 |
| 7 #include "core/fetch/MemoryCache.h" | 7 #include "core/fetch/MemoryCache.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/ImageBitmap.h" | 9 #include "core/frame/ImageBitmap.h" |
| 10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class FakeImageSource : public CanvasImageSource { | 38 class FakeImageSource : public CanvasImageSource { |
| 39 public: | 39 public: |
| 40 FakeImageSource(IntSize, BitmapOpacity); | 40 FakeImageSource(IntSize, BitmapOpacity); |
| 41 | 41 |
| 42 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; | 42 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; |
| 43 | 43 |
| 44 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr
ide { return false; } | 44 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr
ide { return false; } |
| 45 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_
size); } | 45 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_
size); } |
| 46 bool isOpaque() const override { return m_isOpaque; } | 46 bool isOpaque() const override { return m_isOpaque; } |
| 47 int sourceWidth() override { return m_size.width(); } |
| 48 int sourceHeight() override { return m_size.height(); } |
| 47 | 49 |
| 48 ~FakeImageSource() override { } | 50 ~FakeImageSource() override { } |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 IntSize m_size; | 53 IntSize m_size; |
| 52 RefPtr<Image> m_image; | 54 RefPtr<Image> m_image; |
| 53 bool m_isOpaque; | 55 bool m_isOpaque; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) | 58 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 747 |
| 746 TEST_F(CanvasRenderingContext2DTest, ContextDisposedBeforeCanvas) | 748 TEST_F(CanvasRenderingContext2DTest, ContextDisposedBeforeCanvas) |
| 747 { | 749 { |
| 748 createContext(NonOpaque); | 750 createContext(NonOpaque); |
| 749 | 751 |
| 750 canvasElement().detachContext(); | 752 canvasElement().detachContext(); |
| 751 // Passes by not crashing later during teardown | 753 // Passes by not crashing later during teardown |
| 752 } | 754 } |
| 753 | 755 |
| 754 } // namespace blink | 756 } // namespace blink |
| OLD | NEW |