| Index: Source/core/paint/ViewDisplayListTest.cpp
|
| diff --git a/Source/core/paint/ViewDisplayListTest.cpp b/Source/core/paint/ViewDisplayListTest.cpp
|
| index ddbfdfa848ad77c5f0a0e1c63f8127d88d9c60ff..08227b71dd071d6326c6cfc464db9cefa89d8e74 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()->clippingContainer(), renderView->compositor()->rootRenderLayer(), 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>");
|
| + RenderObject* firstRenderer = document().body()->firstChild()->renderer();
|
| + RenderObject* secondRenderer = document().body()->firstChild()->firstChild()->renderer();
|
| + GraphicsContext* context = new GraphicsContext(nullptr);
|
| +
|
| + ClipRect firstClipRect(IntRect(1, 1, 2, 2));
|
| + {
|
| + ClipRecorder clipRecorder(firstRenderer, renderView()->compositor()->rootRenderLayer(), 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());
|
| + 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, renderView()->compositor()->rootRenderLayer(), 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());
|
| +}
|
| +
|
| }
|
|
|
| }
|
|
|