| Index: Source/core/paint/DisplayItemListPaintTest.cpp
|
| diff --git a/Source/core/paint/DisplayItemListPaintTest.cpp b/Source/core/paint/DisplayItemListPaintTest.cpp
|
| index 7a161d5da682c29ef42e148539d6f54c457ca88a..f22747ad6d1ea93740d7fb1c25f361be0783c544 100644
|
| --- a/Source/core/paint/DisplayItemListPaintTest.cpp
|
| +++ b/Source/core/paint/DisplayItemListPaintTest.cpp
|
| @@ -67,6 +67,10 @@ protected:
|
| DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graphicsLayerBacking()->displayItemList(); }
|
| const DisplayItems& newPaintListBeforeUpdate() { return rootDisplayItemList().m_newDisplayItems; }
|
|
|
| + // Expose some document lifecycle steps.
|
| + void updateLifecyclePhasesToPaintForSlimmingPaintV2Clean() { document().view()->updateLifecyclePhasesInternal(FrameView::OnlyUpToPaintForSlimmingPaintV2Clean); }
|
| + void compositeForSlimmingPaintV2() { document().view()->compositeForSlimmingPaintV2(); }
|
| +
|
| private:
|
| void SetUp() override
|
| {
|
| @@ -255,4 +259,41 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
|
| TestDisplayItem(divBlock, DisplayItem::paintPhaseToEndSubtreeType(PaintPhaseForeground)));
|
| }
|
|
|
| +TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, SubtreeCache)
|
| +{
|
| + setBodyInnerHTML(
|
| + "<div id='container1' style='width: 200px; height: 200px; background-color: blue'>"
|
| + " <div id='content1a'>AAA</div>"
|
| + " <div id='content1b' style='width: 100px; height: 100px; background-color: red'>BBB</div>"
|
| + "</div>"
|
| + "<div id='container2' style='width: 200px; height: 200px; background-color: blue'>"
|
| + " <div id='content2a'>CCC</div>"
|
| + " <div id='content2b' style='width: 100px; height: 100px; background-color: green'>DDD</div>"
|
| + "</div>");
|
| + document().view()->updateAllLifecyclePhases();
|
| +
|
| + size_t displayItemCount = rootDisplayItemList().displayItems().size();
|
| +
|
| + Element& content1b = *document().getElementById("content1b");
|
| + content1b.setAttribute(HTMLNames::styleAttr, "width: 100px; height: 100px; background-color: green");
|
| +
|
| + updateLifecyclePhasesToPaintForSlimmingPaintV2Clean();
|
| + const LayoutObject* container2 = document().getElementById("container2")->layoutObject();
|
| + int cachedSubtreeCount = 0;
|
| + for (auto& item : newPaintListBeforeUpdate()) {
|
| + if (item.isCachedSubtree()) {
|
| + ++cachedSubtreeCount;
|
| + EXPECT_EQ(container2->displayItemClient(), item.client());
|
| + if (cachedSubtreeCount == 1)
|
| + EXPECT_EQ(item.type(), DisplayItem::paintPhaseToCachedSubtreeType(PaintPhaseChildBlockBackground));
|
| + else if (cachedSubtreeCount == 2)
|
| + EXPECT_EQ(item.type(), DisplayItem::paintPhaseToCachedSubtreeType(PaintPhaseForeground));
|
| + }
|
| + }
|
| + EXPECT_EQ(2, cachedSubtreeCount);
|
| +
|
| + compositeForSlimmingPaintV2();
|
| + EXPECT_EQ(displayItemCount, rootDisplayItemList().displayItems().size());
|
| +}
|
| +
|
| } // namespace blink
|
|
|