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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp

Issue 2698673007: Only create PaintChunks at drawing and foreignLayer boundaries (Closed)
Patch Set: Great expectations Created 3 years, 10 months 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
Index: third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
index 0f55ae596b840d4495e13ba8cff0d75568932107..2c834d0ff8f05c1bca47ca90c6229d891222355c 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
@@ -378,5 +378,79 @@ TEST_F(PaintChunkerTest, ChunkIdsSkippingCache) {
PaintChunk(6, 7, nullptr, defaultPaintChunkProperties())));
}
+TEST_F(PaintChunkerTest, NoNonDrawingChunks) {
+ // Non-drawing/foreignLayer items should not create chunks for:
+ // <xform>, <drawing>, </xform>
+ // with all items in the same property tree state.
+ PaintChunker chunker;
+
+ TestDisplayItem beginTransform(m_client, DisplayItem::kBeginTransform);
+ chunker.updateCurrentPaintChunkProperties(nullptr,
+ defaultPaintChunkProperties());
+ chunker.incrementDisplayItemIndex(beginTransform);
+
+ TestDisplayItem drawing(m_client, DisplayItem::kDrawingFirst);
+ chunker.incrementDisplayItemIndex(drawing);
+
+ TestDisplayItem endTransform(m_client, DisplayItem::kEndTransform);
+ chunker.incrementDisplayItemIndex(endTransform);
+
+ EXPECT_THAT(
+ chunker.releasePaintChunks(),
+ ElementsAre(PaintChunk(1, 2, nullptr, defaultPaintChunkProperties())));
+}
+
+TEST_F(PaintChunkerTest, NoNonDrawingChunksWithDifferentProperties) {
+ // Non-drawing/foreignLayer items should not create chunks for:
+ // <xform>, <drawing>, </xform>
+ // with items in different property tree states.
+ PaintChunker chunker;
+
+ TestDisplayItem beginTransform(m_client, DisplayItem::kBeginTransform);
+ PaintChunkProperties simpleTransform = defaultPaintChunkProperties();
+ simpleTransform.propertyTreeState.setTransform(
+ TransformPaintPropertyNode::create(nullptr,
+ TransformationMatrix(0, 1, 2, 3, 4, 5),
+ FloatPoint3D(9, 8, 7))
+ .get());
+ chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransform);
+ chunker.incrementDisplayItemIndex(beginTransform);
+
+ TestDisplayItem drawing(m_client, DisplayItem::kDrawingFirst);
+ chunker.updateCurrentPaintChunkProperties(nullptr,
+ defaultPaintChunkProperties());
+ chunker.incrementDisplayItemIndex(drawing);
+
+ TestDisplayItem endTransform(m_client, DisplayItem::kEndTransform);
+ chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransform);
+ chunker.incrementDisplayItemIndex(endTransform);
+
+ EXPECT_THAT(
+ chunker.releasePaintChunks(),
+ ElementsAre(PaintChunk(1, 2, nullptr, defaultPaintChunkProperties())));
+}
+
+TEST_F(PaintChunkerTest, NoNonForeignLayerChunks) {
+ // Non-drawing/foreignLayer items should not create chunks for:
+ // <xform>, <foreignLayer>, </xform>
+ PaintChunker chunker;
+
+ TestDisplayItem beginTransform(m_client, DisplayItem::kBeginTransform);
+ chunker.updateCurrentPaintChunkProperties(nullptr,
+ defaultPaintChunkProperties());
+ chunker.incrementDisplayItemIndex(beginTransform);
+
+ TestDisplayItem foreignLayer(m_client, DisplayItem::kForeignLayerCanvas);
+ DisplayItem::Id layerId = foreignLayer.getId();
+ chunker.incrementDisplayItemIndex(foreignLayer);
+
+ TestDisplayItem endTransform(m_client, DisplayItem::kEndTransform);
+ chunker.incrementDisplayItemIndex(endTransform);
+
+ EXPECT_THAT(
+ chunker.releasePaintChunks(),
+ ElementsAre(PaintChunk(1, 2, &layerId, defaultPaintChunkProperties())));
+}
+
} // namespace
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698