| Index: Source/core/paint/DisplayItemListPaintTest.cpp
|
| diff --git a/Source/core/paint/DisplayItemListPaintTest.cpp b/Source/core/paint/DisplayItemListPaintTest.cpp
|
| index f9fed44c8dc0e8f30525dcc4d6b8d718d643e2db..5771d1a37590c8fa260bd2931f937e71113addcd 100644
|
| --- a/Source/core/paint/DisplayItemListPaintTest.cpp
|
| +++ b/Source/core/paint/DisplayItemListPaintTest.cpp
|
| @@ -3,146 +3,20 @@
|
| // found in the LICENSE file.
|
|
|
| #include "config.h"
|
| -#include "platform/graphics/paint/DisplayItemList.h"
|
| +#include "core/paint/DisplayItemListPaintTest.h"
|
|
|
| -#include "core/layout/LayoutTestHelper.h"
|
| #include "core/layout/LayoutText.h"
|
| -#include "core/layout/LayoutView.h"
|
| #include "core/layout/line/InlineTextBox.h"
|
| #include "core/page/FocusController.h"
|
| -#include "core/paint/DeprecatedPaintLayer.h"
|
| #include "core/paint/DeprecatedPaintLayerPainter.h"
|
| #include "core/paint/LayerClipRecorder.h"
|
| #include "core/paint/LayoutObjectDrawingRecorder.h"
|
| #include "core/paint/ScopeRecorder.h"
|
| #include "platform/graphics/GraphicsContext.h"
|
| -#include "platform/graphics/GraphicsLayer.h"
|
| #include "platform/graphics/paint/DrawingDisplayItem.h"
|
| -#include <gtest/gtest.h>
|
|
|
| namespace blink {
|
|
|
| -class DisplayItemListPaintTest : public RenderingTest {
|
| -public:
|
| - DisplayItemListPaintTest()
|
| - : m_layoutView(nullptr)
|
| - , m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEnabled()) { }
|
| -
|
| -protected:
|
| - LayoutView& layoutView() { return *m_layoutView; }
|
| - DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graphicsLayerBacking()->displayItemList(); }
|
| - const DisplayItems& newDisplayItemsBeforeUpdate() { return rootDisplayItemList().m_newDisplayItems; }
|
| -
|
| -private:
|
| - void SetUp() override
|
| - {
|
| - RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
|
| -
|
| - RenderingTest::SetUp();
|
| - enableCompositing();
|
| -
|
| - m_layoutView = document().view()->layoutView();
|
| - ASSERT_TRUE(m_layoutView);
|
| - }
|
| -
|
| - void TearDown() override
|
| - {
|
| - RuntimeEnabledFeatures::setSlimmingPaintEnabled(m_originalSlimmingPaintEnabled);
|
| - }
|
| -
|
| - LayoutView* m_layoutView;
|
| - bool m_originalSlimmingPaintEnabled;
|
| -};
|
| -
|
| -// Slimming paint v2 has subtly different behavior on some paint tests. This
|
| -// class is used to test only v2 behavior while maintaining v1 test coverage.
|
| -class DisplayItemListPaintTestForSlimmingPaintV2 : public RenderingTest {
|
| -public:
|
| - DisplayItemListPaintTestForSlimmingPaintV2()
|
| - : m_layoutView(nullptr)
|
| - , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { }
|
| -
|
| -protected:
|
| - LayoutView& layoutView() { return *m_layoutView; }
|
| - DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graphicsLayerBacking()->displayItemList(); }
|
| - const DisplayItems& newDisplayItemsBeforeUpdate() { return rootDisplayItemList().m_newDisplayItems; }
|
| -
|
| - // Expose some document lifecycle steps for checking new display items before commiting.
|
| - void updateLifecyclePhasesToPaintForSlimmingPaintV2Clean()
|
| - {
|
| - document().view()->updateLifecyclePhasesInternal(FrameView::OnlyUpToCompositingCleanPlusScrolling);
|
| - document().view()->invalidateTreeIfNeededRecursive();
|
| - document().view()->paintForSlimmingPaintV2();
|
| - }
|
| - void compositeForSlimmingPaintV2() { document().view()->compositeForSlimmingPaintV2(); }
|
| -
|
| -private:
|
| - void SetUp() override
|
| - {
|
| - ASSERT_TRUE(RuntimeEnabledFeatures::slimmingPaintEnabled());
|
| - RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
|
| -
|
| - RenderingTest::SetUp();
|
| - enableCompositing();
|
| -
|
| - m_layoutView = document().view()->layoutView();
|
| - ASSERT_TRUE(m_layoutView);
|
| - }
|
| -
|
| - void TearDown() override
|
| - {
|
| - RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPaintV2Enabled);
|
| - }
|
| -
|
| - LayoutView* m_layoutView;
|
| - bool m_originalSlimmingPaintV2Enabled;
|
| -};
|
| -
|
| -class TestDisplayItem final : public DisplayItem {
|
| -public:
|
| - TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type, sizeof(*this)) { }
|
| -
|
| - void replay(GraphicsContext&) final { ASSERT_NOT_REACHED(); }
|
| - void appendToWebDisplayItemList(WebDisplayItemList*) const final { ASSERT_NOT_REACHED(); }
|
| -};
|
| -
|
| -#ifndef NDEBUG
|
| -#define TRACE_DISPLAY_ITEMS(i, expected, actual) \
|
| - String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).asDebugString() + " Actual: " + (actual).asDebugString(); \
|
| - SCOPED_TRACE(trace.utf8().data());
|
| -#else
|
| -#define TRACE_DISPLAY_ITEMS(i, expected, actual)
|
| -#endif
|
| -
|
| -#define EXPECT_DISPLAY_LIST_BASE(actual, expectedSize, ...) \
|
| - do { \
|
| - EXPECT_EQ((size_t)expectedSize, actual.size()); \
|
| - if (expectedSize != actual.size()) \
|
| - break; \
|
| - const TestDisplayItem expected[] = { __VA_ARGS__ }; \
|
| - for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedSize); index++) { \
|
| - TRACE_DISPLAY_ITEMS(index, expected[index], actual[index]); \
|
| - EXPECT_EQ(expected[index].client(), actual[index].client()); \
|
| - EXPECT_EQ(expected[index].type(), actual[index].type()); \
|
| - } \
|
| - } while (false);
|
| -
|
| -#ifndef NDEBUG
|
| -#define EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(actual, expectedSizeWithoutFill, ...) \
|
| - EXPECT_DISPLAY_LIST_BASE( \
|
| - actual, expectedSizeWithoutFill + 1, \
|
| - TestDisplayItem(*document().layoutView()->layer()->graphicsLayerBacking(), DisplayItem::DebugRedFill), \
|
| - __VA_ARGS__)
|
| -#define EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(actual, expectedSizeWithoutFill, ...) \
|
| - EXPECT_DISPLAY_LIST_BASE( \
|
| - actual, expectedSizeWithoutFill + 1, \
|
| - TestDisplayItem(*document().layoutView()->layer()->graphicsLayerBacking(), DisplayItem::drawingTypeToCachedDrawingType(DisplayItem::DebugRedFill)), \
|
| - __VA_ARGS__)
|
| -#else
|
| -#define EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG EXPECT_DISPLAY_LIST_BASE
|
| -#define EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG EXPECT_DISPLAY_LIST_BASE
|
| -#endif
|
| -
|
| TEST_F(DisplayItemListPaintTest, FullDocumentPaintingWithCaret)
|
| {
|
| setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>XYZ</div>");
|
|
|