| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 6 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 7 | 7 |
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 : m_wrapGradients(WrapGradients::create()) | 121 : m_wrapGradients(WrapGradients::create()) |
| 122 , m_opaqueBitmap(IntSize(10, 10), OpaqueBitmap) | 122 , m_opaqueBitmap(IntSize(10, 10), OpaqueBitmap) |
| 123 , m_alphaBitmap(IntSize(10, 10), TransparentBitmap) | 123 , m_alphaBitmap(IntSize(10, 10), TransparentBitmap) |
| 124 { } | 124 { } |
| 125 | 125 |
| 126 void CanvasRenderingContext2DTest::createContext(OpacityMode opacityMode) | 126 void CanvasRenderingContext2DTest::createContext(OpacityMode opacityMode) |
| 127 { | 127 { |
| 128 String canvasType("2d"); | 128 String canvasType("2d"); |
| 129 CanvasContextCreationAttributes attributes; | 129 CanvasContextCreationAttributes attributes; |
| 130 attributes.setAlpha(opacityMode == NonOpaque); | 130 attributes.setAlpha(opacityMode == NonOpaque); |
| 131 m_canvasElement->getCanvasRenderingContext(canvasType, attributes); | 131 m_canvasElement->getCanvasRenderingContext(nullptr, canvasType, attributes); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void CanvasRenderingContext2DTest::SetUp() | 134 void CanvasRenderingContext2DTest::SetUp() |
| 135 { | 135 { |
| 136 Page::PageClients pageClients; | 136 Page::PageClients pageClients; |
| 137 fillWithEmptyClients(pageClients); | 137 fillWithEmptyClients(pageClients); |
| 138 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; | 138 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; |
| 139 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 139 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 140 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas><
/body>", ASSERT_NO_EXCEPTION); | 140 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas><
/body>", ASSERT_NO_EXCEPTION); |
| 141 m_document->view()->updateAllLifecyclePhases(); | 141 m_document->view()->updateAllLifecyclePhases(); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // The canvasChanged notification must be immediate, and not deferred until
paint time | 624 // The canvasChanged notification must be immediate, and not deferred until
paint time |
| 625 // because offscreen canvases, which are not painted, also need to emit noti
fications. | 625 // because offscreen canvases, which are not painted, also need to emit noti
fications. |
| 626 EXPECT_CALL(*observer, canvasChanged(&canvasElement(), FloatRect(0, 0, 1, 1)
)).Times(1); | 626 EXPECT_CALL(*observer, canvasChanged(&canvasElement(), FloatRect(0, 0, 1, 1)
)).Times(1); |
| 627 context2d()->fillRect(0, 0, 1, 1); | 627 context2d()->fillRect(0, 0, 1, 1); |
| 628 Mock::VerifyAndClearExpectations(observer.get()); | 628 Mock::VerifyAndClearExpectations(observer.get()); |
| 629 | 629 |
| 630 canvasElement().removeObserver(observer.get()); | 630 canvasElement().removeObserver(observer.get()); |
| 631 } | 631 } |
| 632 | 632 |
| 633 } // namespace blink | 633 } // namespace blink |
| OLD | NEW |