| 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 "core/paint/LayerClipRecorder.h" | 5 #include "core/paint/LayerClipRecorder.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/layout/api/LayoutAPIShim.h" |
| 9 #include "core/layout/compositing/PaintLayerCompositor.h" | 10 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 11 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 11 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 12 #include "platform/graphics/GraphicsContext.h" | 13 #include "platform/graphics/GraphicsContext.h" |
| 13 #include "platform/graphics/GraphicsLayer.h" | 14 #include "platform/graphics/GraphicsLayer.h" |
| 14 #include "platform/graphics/paint/PaintController.h" | 15 #include "platform/graphics/paint/PaintController.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 class LayerClipRecorderTest : public RenderingTest { | 21 class LayerClipRecorderTest : public RenderingTest { |
| 21 public: | 22 public: |
| 22 LayerClipRecorderTest() | 23 LayerClipRecorderTest() |
| 23 : m_layoutView(nullptr) { } | 24 : m_layoutView(nullptr) { } |
| 24 | 25 |
| 25 protected: | 26 protected: |
| 26 LayoutView& layoutView() { return *m_layoutView; } | 27 LayoutView& layoutView() { return *m_layoutView; } |
| 27 PaintController& rootPaintController() { return layoutView().layer()->graphi
csLayerBacking()->getPaintController(); } | 28 PaintController& rootPaintController() { return layoutView().layer()->graphi
csLayerBacking()->getPaintController(); } |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 void SetUp() override | 31 void SetUp() override |
| 31 { | 32 { |
| 32 RenderingTest::SetUp(); | 33 RenderingTest::SetUp(); |
| 33 enableCompositing(); | 34 enableCompositing(); |
| 34 | 35 |
| 35 m_layoutView = document().view()->layoutView(); | 36 m_layoutView = toLayoutView(LayoutAPIShim::layoutObjectFrom(document().v
iew()->layoutViewItem())); |
| 36 ASSERT_TRUE(m_layoutView); | 37 ASSERT_TRUE(m_layoutView); |
| 37 } | 38 } |
| 38 | 39 |
| 39 LayoutView* m_layoutView; | 40 LayoutView* m_layoutView; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 void drawEmptyClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase) | 43 void drawEmptyClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase) |
| 43 { | 44 { |
| 44 LayoutRect rect(1, 1, 9, 9); | 45 LayoutRect rect(1, 1, 9, 9); |
| 45 ClipRect clipRect(rect); | 46 ClipRect clipRect(rect); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 GraphicsContext context(rootPaintController()); | 79 GraphicsContext context(rootPaintController()); |
| 79 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); | 80 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); |
| 80 | 81 |
| 81 drawEmptyClip(context, layoutView(), PaintPhaseForeground); | 82 drawEmptyClip(context, layoutView(), PaintPhaseForeground); |
| 82 rootPaintController().commitNewDisplayItems(); | 83 rootPaintController().commitNewDisplayItems(); |
| 83 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); | 84 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace | 87 } // namespace |
| 87 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |