Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1409)

Unified Diff: Source/core/paint/ViewDisplayListTest.cpp

Issue 702633002: Move ViewDisplayList to GraphicsLayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: copy & pasted test expectation from the wrong window. sorry. :( Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/ViewDisplayList.cpp ('k') | Source/core/rendering/PaintPhase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ViewDisplayListTest.cpp
diff --git a/Source/core/paint/ViewDisplayListTest.cpp b/Source/core/paint/ViewDisplayListTest.cpp
index ddbfdfa848ad77c5f0a0e1c63f8127d88d9c60ff..280b7effe1ae1e5f6710adaeab949b93c24cce0a 100644
--- a/Source/core/paint/ViewDisplayListTest.cpp
+++ b/Source/core/paint/ViewDisplayListTest.cpp
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "config.h"
-#include "core/paint/ViewDisplayList.h"
#include "core/paint/ClipRecorder.h"
#include "core/paint/DrawingRecorder.h"
@@ -11,6 +10,8 @@
#include "core/rendering/RenderingTestHelper.h"
#include "core/rendering/compositing/RenderLayerCompositor.h"
#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/GraphicsLayer.h"
+#include "platform/graphics/paint/DisplayItemList.h"
#include <gtest/gtest.h>
namespace blink {
@@ -22,6 +23,7 @@ public:
protected:
RenderView* renderView() { return m_renderView; }
+ DisplayItemList& rootDisplayItemList() { return renderView()->layer()->graphicsLayerBacking()->displayItemList(); }
private:
virtual void SetUp() override
@@ -29,6 +31,7 @@ private:
RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
RenderingTest::SetUp();
+ enableCompositing();
m_renderView = document().view()->renderView();
ASSERT_TRUE(m_renderView);
@@ -58,7 +61,7 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_NestedRecorders)
FloatRect bound = renderView()->viewRect();
drawClippedRect(context, renderView(), PaintPhaseForeground, bound);
- EXPECT_EQ((size_t)3, renderView()->viewDisplayList().paintList().size());
+ EXPECT_EQ((size_t)3, rootDisplayItemList().paintList().size());
// TODO(schenney): Check that the IDs are what we expect.
}
@@ -74,12 +77,12 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateBasic)
drawRect(context, second, PaintPhaseChildBlockBackground, FloatRect(100, 100, 200, 200));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300));
- EXPECT_EQ((size_t)3, renderView()->viewDisplayList().paintList().size());
+ EXPECT_EQ((size_t)3, rootDisplayItemList().paintList().size());
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(second);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300, 300));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300));
- EXPECT_EQ((size_t)2, renderView()->viewDisplayList().paintList().size());
+ EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
}
TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateSwapOrder)
@@ -94,21 +97,21 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateSwapOrder)
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
drawRect(context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300, 10, 10));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)3, firstList.size());
- EXPECT_EQ(first, firstList[0]->renderer());
- EXPECT_EQ(second, firstList[1]->renderer());
- EXPECT_EQ(unaffected, firstList[2]->renderer());
+ EXPECT_EQ(first, firstList[0]->client());
+ EXPECT_EQ(second, firstList[1]->client());
+ EXPECT_EQ(unaffected, firstList[2]->client());
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(second);
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100, 100));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)3, secondList.size());
- EXPECT_EQ(second, secondList[0]->renderer());
- EXPECT_EQ(first, secondList[1]->renderer());
- EXPECT_EQ(unaffected, secondList[2]->renderer());
+ EXPECT_EQ(second, secondList[0]->client());
+ EXPECT_EQ(first, secondList[1]->client());
+ EXPECT_EQ(unaffected, secondList[2]->client());
}
TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateNewItemInMiddle)
@@ -122,21 +125,21 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateNewItemInMiddle)
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100, 100));
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, firstList.size());
- EXPECT_EQ(first, firstList[0]->renderer());
- EXPECT_EQ(second, firstList[1]->renderer());
+ EXPECT_EQ(first, firstList[0]->client());
+ EXPECT_EQ(second, firstList[1]->client());
- renderView()->viewDisplayList().invalidate(third);
+ rootDisplayItemList().invalidate(third);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100, 100));
drawRect(context, third, PaintPhaseBlockBackground, FloatRect(125, 100, 200, 50));
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)3, secondList.size());
- EXPECT_EQ(first, secondList[0]->renderer());
- EXPECT_EQ(third, secondList[1]->renderer());
- EXPECT_EQ(second, secondList[2]->renderer());
+ EXPECT_EQ(first, secondList[0]->client());
+ EXPECT_EQ(third, secondList[1]->client());
+ EXPECT_EQ(second, secondList[2]->client());
}
TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateInvalidationWithPhases)
@@ -157,15 +160,15 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateInvalidationWithPhases)
drawRect(context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200));
drawRect(context, third, PaintPhaseOutline, FloatRect(300, 100, 50, 50));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)9, firstList.size());
for (int item = 0; item < 9; item += 3) {
- EXPECT_EQ(first, firstList[item % 3 + 0]->renderer());
- EXPECT_EQ(second, firstList[item % 3 + 1]->renderer());
- EXPECT_EQ(third, firstList[item % 3 + 2]->renderer());
+ EXPECT_EQ(first, firstList[item % 3 + 0]->client());
+ EXPECT_EQ(second, firstList[item % 3 + 1]->client());
+ EXPECT_EQ(third, firstList[item % 3 + 2]->client());
}
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(second);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100, 100));
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
drawRect(context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100));
@@ -173,20 +176,20 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateInvalidationWithPhases)
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100));
drawRect(context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)9, secondList.size());
for (int item = 0; item < 9; item += 3) {
- EXPECT_EQ(first, secondList[item % 3 + 0]->renderer());
- EXPECT_EQ(second, secondList[item % 3 + 1]->renderer());
- EXPECT_EQ(third, secondList[item % 3 + 2]->renderer());
+ EXPECT_EQ(first, secondList[item % 3 + 0]->client());
+ EXPECT_EQ(second, secondList[item % 3 + 1]->client());
+ EXPECT_EQ(third, secondList[item % 3 + 2]->client());
}
- renderView()->viewDisplayList().invalidate(second);
- const PaintList& thirdList = renderView()->viewDisplayList().paintList();
+ rootDisplayItemList().invalidate(second);
+ const PaintList& thirdList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)6, thirdList.size());
for (int item = 0; item < 6; item += 2) {
- EXPECT_EQ(first, thirdList[item % 2 + 0]->renderer());
- EXPECT_EQ(third, thirdList[item % 2 + 1]->renderer());
+ EXPECT_EQ(first, thirdList[item % 2 + 0]->client());
+ EXPECT_EQ(third, thirdList[item % 2 + 1]->client());
}
}
@@ -200,27 +203,27 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddFirstNoOverlap)
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50, 50));
drawRect(context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, firstList.size());
- EXPECT_EQ(second, firstList[0]->renderer());
- EXPECT_EQ(second, firstList[1]->renderer());
+ EXPECT_EQ(second, firstList[0]->client());
+ EXPECT_EQ(second, firstList[1]->client());
- renderView()->viewDisplayList().invalidate(first);
+ rootDisplayItemList().invalidate(first);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 50));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 50, 50));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)4, secondList.size());
- EXPECT_EQ(first, secondList[0]->renderer());
- EXPECT_EQ(first, secondList[1]->renderer());
- EXPECT_EQ(second, secondList[2]->renderer());
- EXPECT_EQ(second, secondList[3]->renderer());
+ EXPECT_EQ(first, secondList[0]->client());
+ EXPECT_EQ(first, secondList[1]->client());
+ EXPECT_EQ(second, secondList[2]->client());
+ EXPECT_EQ(second, secondList[3]->client());
- renderView()->viewDisplayList().invalidate(first);
- const PaintList& thirdList = renderView()->viewDisplayList().paintList();
+ rootDisplayItemList().invalidate(first);
+ const PaintList& thirdList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, thirdList.size());
- EXPECT_EQ(second, thirdList[0]->renderer());
- EXPECT_EQ(second, thirdList[1]->renderer());
+ EXPECT_EQ(second, thirdList[0]->client());
+ EXPECT_EQ(second, thirdList[1]->client());
}
TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddFirstOverlap)
@@ -233,33 +236,33 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddFirstOverlap)
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50, 50));
drawRect(context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, firstList.size());
- EXPECT_EQ(second, firstList[0]->renderer());
- EXPECT_EQ(second, firstList[1]->renderer());
+ EXPECT_EQ(second, firstList[0]->client());
+ EXPECT_EQ(second, firstList[1]->client());
- renderView()->viewDisplayList().invalidate(first);
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(first);
+ rootDisplayItemList().invalidate(second);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150));
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50, 50));
drawRect(context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)4, secondList.size());
- EXPECT_EQ(first, secondList[0]->renderer());
- EXPECT_EQ(first, secondList[1]->renderer());
- EXPECT_EQ(second, secondList[2]->renderer());
- EXPECT_EQ(second, secondList[3]->renderer());
+ EXPECT_EQ(first, secondList[0]->client());
+ EXPECT_EQ(first, secondList[1]->client());
+ EXPECT_EQ(second, secondList[2]->client());
+ EXPECT_EQ(second, secondList[3]->client());
- renderView()->viewDisplayList().invalidate(first);
+ rootDisplayItemList().invalidate(first);
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50, 50));
drawRect(context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
- const PaintList& thirdList = renderView()->viewDisplayList().paintList();
+ const PaintList& thirdList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, thirdList.size());
- EXPECT_EQ(second, thirdList[0]->renderer());
- EXPECT_EQ(second, thirdList[1]->renderer());
+ EXPECT_EQ(second, thirdList[0]->client());
+ EXPECT_EQ(second, thirdList[1]->client());
}
TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastNoOverlap)
@@ -272,27 +275,27 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastNoOverlap)
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 50));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 50, 50));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, firstList.size());
- EXPECT_EQ(first, firstList[0]->renderer());
- EXPECT_EQ(first, firstList[1]->renderer());
+ EXPECT_EQ(first, firstList[0]->client());
+ EXPECT_EQ(first, firstList[1]->client());
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(second);
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50, 50));
drawRect(context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)4, secondList.size());
- EXPECT_EQ(second, secondList[0]->renderer());
- EXPECT_EQ(second, secondList[1]->renderer());
- EXPECT_EQ(first, secondList[2]->renderer());
- EXPECT_EQ(first, secondList[3]->renderer());
+ EXPECT_EQ(second, secondList[0]->client());
+ EXPECT_EQ(second, secondList[1]->client());
+ EXPECT_EQ(first, secondList[2]->client());
+ EXPECT_EQ(first, secondList[3]->client());
- renderView()->viewDisplayList().invalidate(second);
- const PaintList& thirdList = renderView()->viewDisplayList().paintList();
+ rootDisplayItemList().invalidate(second);
+ const PaintList& thirdList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, thirdList.size());
- EXPECT_EQ(first, thirdList[0]->renderer());
- EXPECT_EQ(first, thirdList[1]->renderer());
+ EXPECT_EQ(first, thirdList[0]->client());
+ EXPECT_EQ(first, thirdList[1]->client());
}
TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastOverlap)
@@ -305,34 +308,34 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastOverlap)
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150));
- const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ const PaintList& firstList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, firstList.size());
- EXPECT_EQ(first, firstList[0]->renderer());
- EXPECT_EQ(first, firstList[1]->renderer());
+ EXPECT_EQ(first, firstList[0]->client());
+ EXPECT_EQ(first, firstList[1]->client());
- renderView()->viewDisplayList().invalidate(first);
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(first);
+ rootDisplayItemList().invalidate(second);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150));
drawRect(context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50, 50));
drawRect(context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
- const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ const PaintList& secondList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)4, secondList.size());
- EXPECT_EQ(first, secondList[0]->renderer());
- EXPECT_EQ(first, secondList[1]->renderer());
- EXPECT_EQ(second, secondList[2]->renderer());
- EXPECT_EQ(second, secondList[3]->renderer());
+ EXPECT_EQ(first, secondList[0]->client());
+ EXPECT_EQ(first, secondList[1]->client());
+ EXPECT_EQ(second, secondList[2]->client());
+ EXPECT_EQ(second, secondList[3]->client());
- renderView()->viewDisplayList().invalidate(first);
- renderView()->viewDisplayList().invalidate(second);
+ rootDisplayItemList().invalidate(first);
+ rootDisplayItemList().invalidate(second);
drawRect(context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
drawRect(context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150));
- const PaintList& thirdList = renderView()->viewDisplayList().paintList();
+ const PaintList& thirdList = rootDisplayItemList().paintList();
EXPECT_EQ((size_t)2, thirdList.size());
- EXPECT_EQ(first, thirdList[0]->renderer());
- EXPECT_EQ(first, thirdList[1]->renderer());
+ EXPECT_EQ(first, thirdList[0]->client());
+ EXPECT_EQ(first, thirdList[1]->client());
}
}
« no previous file with comments | « Source/core/paint/ViewDisplayList.cpp ('k') | Source/core/rendering/PaintPhase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698