| 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 "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "core/layout/LayoutText.h" | 9 #include "core/layout/LayoutText.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| 11 #include "core/layout/line/InlineTextBox.h" | 11 #include "core/layout/line/InlineTextBox.h" |
| 12 #include "core/page/FocusController.h" | 12 #include "core/page/FocusController.h" |
| 13 #include "core/paint/DeprecatedPaintLayer.h" | 13 #include "core/paint/DeprecatedPaintLayer.h" |
| 14 #include "core/paint/DeprecatedPaintLayerPainter.h" | 14 #include "core/paint/DeprecatedPaintLayerPainter.h" |
| 15 #include "core/paint/LayerClipRecorder.h" | 15 #include "core/paint/LayerClipRecorder.h" |
| 16 #include "core/paint/LayoutObjectDrawingRecorder.h" | 16 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 17 #include "core/paint/ScopeRecorder.h" | 17 #include "core/paint/ScopeRecorder.h" |
| 18 #include "core/paint/SubtreeRecorder.h" | 18 #include "core/paint/SubtreeRecorder.h" |
| 19 #include "platform/graphics/GraphicsContext.h" | 19 #include "platform/graphics/GraphicsContext.h" |
| 20 #include "platform/graphics/GraphicsLayer.h" | 20 #include "platform/graphics/GraphicsLayer.h" |
| 21 #include "platform/graphics/paint/DrawingDisplayItem.h" | 21 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 22 #include <gtest/gtest.h> | 22 #include <gtest/gtest.h> |
| 23 | 23 |
| 24 namespace blink { | 24 namespace blink { |
| 25 | 25 |
| 26 class DisplayItemListPaintTest : public RenderingTest { | 26 class DisplayItemListPaintTest : public RenderingTest { |
| 27 public: | 27 public: |
| 28 DisplayItemListPaintTest() | 28 DisplayItemListPaintTest() |
| 29 : m_layoutView(nullptr) { } | 29 : m_layoutView(nullptr) |
| 30 , m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn
abled()) { } |
| 30 | 31 |
| 31 protected: | 32 protected: |
| 32 LayoutView& layoutView() { return *m_layoutView; } | 33 LayoutView& layoutView() { return *m_layoutView; } |
| 33 DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graph
icsLayerBacking()->displayItemList(); } | 34 DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graph
icsLayerBacking()->displayItemList(); } |
| 34 const DisplayItems& newPaintListBeforeUpdate() { return rootDisplayItemList(
).m_newDisplayItems; } | 35 const DisplayItems& newPaintListBeforeUpdate() { return rootDisplayItemList(
).m_newDisplayItems; } |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 virtual void SetUp() override | 38 virtual void SetUp() override |
| 38 { | 39 { |
| 39 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); | 40 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); |
| 40 | 41 |
| 41 RenderingTest::SetUp(); | 42 RenderingTest::SetUp(); |
| 42 enableCompositing(); | 43 enableCompositing(); |
| 43 | 44 |
| 44 m_layoutView = document().view()->layoutView(); | 45 m_layoutView = document().view()->layoutView(); |
| 45 ASSERT_TRUE(m_layoutView); | 46 ASSERT_TRUE(m_layoutView); |
| 46 } | 47 } |
| 47 | 48 |
| 48 virtual void TearDown() override | 49 virtual void TearDown() override |
| 49 { | 50 { |
| 50 RuntimeEnabledFeatures::setSlimmingPaintEnabled(false); | 51 RuntimeEnabledFeatures::setSlimmingPaintEnabled(m_originalSlimmingPaintE
nabled); |
| 51 } | 52 } |
| 52 | 53 |
| 53 LayoutView* m_layoutView; | 54 LayoutView* m_layoutView; |
| 55 bool m_originalSlimmingPaintEnabled; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 class TestDisplayItem : public DisplayItem { | 58 class TestDisplayItem : public DisplayItem { |
| 57 public: | 59 public: |
| 58 TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : Display
Item(client, type) { } | 60 TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : Display
Item(client, type) { } |
| 59 | 61 |
| 60 virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED();
} | 62 virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED();
} |
| 61 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } | 63 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } |
| 62 }; | 64 }; |
| 63 | 65 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); | 152 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
| 151 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); | 153 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
| 152 | 154 |
| 153 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, | 155 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, |
| 154 TestDisplayItem(htmlObject, DisplayItem::BoxDecorationBackground), | 156 TestDisplayItem(htmlObject, DisplayItem::BoxDecorationBackground), |
| 155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), | 157 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), |
| 156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); | 158 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); |
| 157 } | 159 } |
| 158 | 160 |
| 159 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |