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

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

Issue 719353004: [Slimming Paint] Track clip renderers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address reviewer comments 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') | no next file » | 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..d2da6bffd8500c4316b561aea12793d78201cc6b 100644
--- a/Source/core/paint/ViewDisplayListTest.cpp
+++ b/Source/core/paint/ViewDisplayListTest.cpp
@@ -48,7 +48,7 @@ void drawClippedRect(GraphicsContext* context, RenderView* renderView, PaintPhas
{
IntRect rect(1, 1, 9, 9);
ClipRect clipRect(rect);
- ClipRecorder clipRecorder(renderView->compositor()->rootRenderLayer(), context, DisplayItem::ClipLayerForeground, clipRect);
+ ClipRecorder clipRecorder(renderView->compositor()->rootRenderLayer()->renderer(), context, DisplayItem::ClipLayerForeground, clipRect);
drawRect(context, renderView, phase, bound);
}
@@ -335,6 +335,57 @@ TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastOverlap)
EXPECT_EQ(first, thirdList[1]->renderer());
}
+TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateClip)
+{
+ setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
+ RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document().body()->firstChild()->renderer());
+ RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document().body()->firstChild()->firstChild()->renderer());
+ GraphicsContext* context = new GraphicsContext(nullptr);
+
+ ClipRect firstClipRect(IntRect(1, 1, 2, 2));
+ {
+ ClipRecorder clipRecorder(firstRenderer, context, DisplayItem::ClipLayerForeground, firstClipRect);
+ drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
+ drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
+ }
+
+ const PaintList& firstList = renderView()->viewDisplayList().paintList();
+ EXPECT_EQ((size_t)4, firstList.size());
chrishtr 2014/11/13 18:42:46 This is tedious and hard to read. Add some helper
+ EXPECT_EQ(DisplayItem::ClipLayerForeground, firstList[0]->type());
+ EXPECT_EQ(firstRenderer, firstList[1]->renderer());
+ EXPECT_EQ(DisplayItem::DrawingPaintPhaseBlockBackground, firstList[1]->type());
+ EXPECT_EQ(secondRenderer, firstList[2]->renderer());
+ EXPECT_EQ(DisplayItem::DrawingPaintPhaseBlockBackground, firstList[2]->type());
+ EXPECT_EQ(DisplayItem::EndClip, firstList[3]->type());
+
+ renderView()->viewDisplayList().invalidate(firstRenderer);
+ drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
+ drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
+
+ const PaintList& secondList = renderView()->viewDisplayList().paintList();
+ EXPECT_EQ((size_t)2, secondList.size());
+ EXPECT_EQ(DisplayItem::DrawingPaintPhaseBlockBackground, secondList[0]->type());
+ EXPECT_EQ(DisplayItem::DrawingPaintPhaseBlockBackground, secondList[1]->type());
+
+ renderView()->viewDisplayList().invalidate(secondRenderer);
+ drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
+ ClipRect secondClipRect(IntRect(1, 1, 2, 2));
+ {
+ ClipRecorder clipRecorder(secondRenderer, context, DisplayItem::ClipLayerForeground, secondClipRect);
+ drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
+ }
+
+ const PaintList& thirdList = renderView()->viewDisplayList().paintList();
+ EXPECT_EQ((size_t)4, thirdList.size());
+ EXPECT_EQ(firstRenderer, thirdList[0]->renderer());
+ EXPECT_EQ(DisplayItem::DrawingPaintPhaseBlockBackground, thirdList[0]->type());
+ EXPECT_EQ(DisplayItem::ClipLayerForeground, thirdList[1]->type());
+ EXPECT_EQ(secondRenderer, thirdList[1]->renderer());
+ EXPECT_EQ(secondRenderer, thirdList[2]->renderer());
+ EXPECT_EQ(DisplayItem::DrawingPaintPhaseBlockBackground, thirdList[2]->type());
+ EXPECT_EQ(DisplayItem::EndClip, thirdList[3]->type());
+}
+
}
}
« no previous file with comments | « Source/core/paint/ViewDisplayList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698