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 "core/paint/HTMLCanvasPainter.h" | 5 #include "core/paint/HTMLCanvasPainter.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
10 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 10 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 toHTMLCanvasElement(document().body()->firstChild()); | 77 toHTMLCanvasElement(document().body()->firstChild()); |
78 CanvasContextCreationAttributes attributes; | 78 CanvasContextCreationAttributes attributes; |
79 attributes.setAlpha(true); | 79 attributes.setAlpha(true); |
80 CanvasRenderingContext* context = | 80 CanvasRenderingContext* context = |
81 element->getCanvasRenderingContext("2d", attributes); | 81 element->getCanvasRenderingContext("2d", attributes); |
82 RefPtr<Canvas2DLayerBridge> bridge = | 82 RefPtr<Canvas2DLayerBridge> bridge = |
83 makeCanvas2DLayerBridge(IntSize(300, 200)); | 83 makeCanvas2DLayerBridge(IntSize(300, 200)); |
84 element->createImageBufferUsingSurfaceForTesting(WTF::wrapUnique( | 84 element->createImageBufferUsingSurfaceForTesting(WTF::wrapUnique( |
85 new Canvas2DImageBufferSurface(bridge, IntSize(300, 200)))); | 85 new Canvas2DImageBufferSurface(bridge, IntSize(300, 200)))); |
86 ASSERT_EQ(context, element->renderingContext()); | 86 ASSERT_EQ(context, element->renderingContext()); |
87 ASSERT_TRUE(context->isAccelerated()); | 87 ASSERT_TRUE(context->isComposited()); |
| 88 ASSERT_TRUE(element->isAccelerated()); |
88 | 89 |
89 // Force the page to paint. | 90 // Force the page to paint. |
90 document().view()->updateAllLifecyclePhases(); | 91 document().view()->updateAllLifecyclePhases(); |
91 | 92 |
92 // Fetch the layer associated with the <canvas>, and check that it was | 93 // Fetch the layer associated with the <canvas>, and check that it was |
93 // correctly configured in the layer tree. | 94 // correctly configured in the layer tree. |
94 const WebLayer* layer = context->platformLayer(); | 95 const WebLayer* layer = context->platformLayer(); |
95 ASSERT_TRUE(layer); | 96 ASSERT_TRUE(layer); |
96 EXPECT_TRUE(hasLayerAttached(*layer)); | 97 EXPECT_TRUE(hasLayerAttached(*layer)); |
97 EXPECT_EQ(WebSize(300, 200), layer->bounds()); | 98 EXPECT_EQ(WebSize(300, 200), layer->bounds()); |
98 } | 99 } |
99 | 100 |
100 } // namespace blink | 101 } // namespace blink |
OLD | NEW |