| 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 "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/paint/CachedDisplayItem.h" | 9 #include "platform/graphics/paint/CachedDisplayItem.h" |
| 10 #include "platform/graphics/paint/ClipPathRecorder.h" | 10 #include "platform/graphics/paint/ClipPathRecorder.h" |
| 11 #include "platform/graphics/paint/ClipRecorder.h" | 11 #include "platform/graphics/paint/ClipRecorder.h" |
| 12 #include "platform/graphics/paint/DrawingDisplayItem.h" | 12 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 13 #include "platform/graphics/paint/DrawingRecorder.h" | 13 #include "platform/graphics/paint/DrawingRecorder.h" |
| 14 #include "platform/graphics/paint/SubsequenceRecorder.h" | 14 #include "platform/graphics/paint/SubsequenceRecorder.h" |
| 15 #include "platform/testing/FakeDisplayItemClient.h" | 15 #include "platform/testing/FakeDisplayItemClient.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class PaintControllerTest : public ::testing::Test { | 20 class PaintControllerTest : public ::testing::Test { |
| 21 public: | 21 public: |
| 22 PaintControllerTest() | 22 PaintControllerTest() |
| 23 : m_paintController(PaintController::create()) | 23 : m_paintController(PaintController::create()) |
| 24 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) | 24 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } |
| 25 { | |
| 26 } | |
| 27 | 25 |
| 28 IntRect visualRect(const PaintArtifact& paintArtifact, unsigned index) | 26 IntRect visualRect(const PaintArtifact& paintArtifact, unsigned index) |
| 29 { | 27 { |
| 30 return paintArtifact.getDisplayItemList().visualRect(index); | 28 return paintArtifact.getDisplayItemList().visualRect(index); |
| 31 } | 29 } |
| 32 | 30 |
| 33 protected: | 31 protected: |
| 34 PaintController& getPaintController() { return *m_paintController; } | 32 PaintController& getPaintController() { return *m_paintController; } |
| 35 | 33 |
| 36 private: | 34 private: |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 GraphicsContext context(getPaintController()); | 788 GraphicsContext context(getPaintController()); |
| 791 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 789 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 792 | 790 |
| 793 getPaintController().commitNewDisplayItems(LayoutSize(20, 30)); | 791 getPaintController().commitNewDisplayItems(LayoutSize(20, 30)); |
| 794 const auto& paintArtifact = getPaintController().paintArtifact(); | 792 const auto& paintArtifact = getPaintController().paintArtifact(); |
| 795 ASSERT_EQ(1u, paintArtifact.getDisplayItemList().size()); | 793 ASSERT_EQ(1u, paintArtifact.getDisplayItemList().size()); |
| 796 EXPECT_RECT_EQ(IntRect(-20, -30, 200, 100), visualRect(paintArtifact, 0)); | 794 EXPECT_RECT_EQ(IntRect(-20, -30, 200, 100), visualRect(paintArtifact, 0)); |
| 797 } | 795 } |
| 798 | 796 |
| 799 } // namespace blink | 797 } // namespace blink |
| OLD | NEW |