| 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 m_paintController->setCanUseClientCacheStatus(true); |
| 27 } |
| 25 | 28 |
| 26 IntRect visualRect(const PaintArtifact& paintArtifact, unsigned index) | 29 IntRect visualRect(const PaintArtifact& paintArtifact, unsigned index) |
| 27 { | 30 { |
| 28 return paintArtifact.getDisplayItemList().visualRect(index); | 31 return paintArtifact.getDisplayItemList().visualRect(index); |
| 29 } | 32 } |
| 30 | 33 |
| 31 protected: | 34 protected: |
| 32 PaintController& getPaintController() { return *m_paintController; } | 35 PaintController& getPaintController() { return *m_paintController; } |
| 33 | 36 |
| 34 private: | 37 private: |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 GraphicsContext context(getPaintController()); | 791 GraphicsContext context(getPaintController()); |
| 789 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 792 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 790 | 793 |
| 791 getPaintController().commitNewDisplayItems(LayoutSize(20, 30)); | 794 getPaintController().commitNewDisplayItems(LayoutSize(20, 30)); |
| 792 const auto& paintArtifact = getPaintController().paintArtifact(); | 795 const auto& paintArtifact = getPaintController().paintArtifact(); |
| 793 ASSERT_EQ(1u, paintArtifact.getDisplayItemList().size()); | 796 ASSERT_EQ(1u, paintArtifact.getDisplayItemList().size()); |
| 794 EXPECT_RECT_EQ(IntRect(-20, -30, 200, 100), visualRect(paintArtifact, 0)); | 797 EXPECT_RECT_EQ(IntRect(-20, -30, 200, 100), visualRect(paintArtifact, 0)); |
| 795 } | 798 } |
| 796 | 799 |
| 797 } // namespace blink | 800 } // namespace blink |
| OLD | NEW |