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

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

Issue 892293002: First version of new merge algorithm (not enabled yet) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove scope-related code (accidentally mixed in this CL) Created 5 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: Source/core/paint/LayerClipRecorderTest.cpp
diff --git a/Source/core/paint/LayerClipRecorderTest.cpp b/Source/core/paint/LayerClipRecorderTest.cpp
index 2671a13a0c9611a81de2c85dc81327277fa0e2c8..4fd552c50e1770bf47651f1b9ffa72d2b0aac64c 100644
--- a/Source/core/paint/LayerClipRecorderTest.cpp
+++ b/Source/core/paint/LayerClipRecorderTest.cpp
@@ -6,6 +6,7 @@
#include "core/paint/LayerClipRecorder.h"
#include "core/layout/compositing/RenderLayerCompositor.h"
+#include "core/paint/RenderDrawingRecorder.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/RenderingTestHelper.h"
#include "platform/graphics/GraphicsContext.h"
@@ -39,22 +40,46 @@ private:
RenderView* m_renderView;
};
-void drawClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound)
+void drawEmptyClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound)
{
IntRect rect(1, 1, 9, 9);
ClipRect clipRect(rect);
LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootRenderLayer()->renderer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags());
}
-TEST_F(LayerClipRecorderTest, LayerClipRecorderTest_Single)
+void drawRectInClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound)
+{
+ IntRect rect(1, 1, 9, 9);
+ ClipRect clipRect(rect);
+ LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootRenderLayer()->renderer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags());
+ RenderDrawingRecorder drawingRecorder(context, *renderer, phase, bound);
+ if (!drawingRecorder.canUseCachedDrawing())
+ context->drawRect(rect);
+}
+
+TEST_F(LayerClipRecorderTest, Single)
{
GraphicsContext context(nullptr, &rootDisplayItemList());
FloatRect bound = renderView()->viewRect();
EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
- drawClip(&context, renderView(), PaintPhaseForeground, bound);
+ drawRectInClip(&context, renderView(), PaintPhaseForeground, bound);
rootDisplayItemList().endNewPaints();
- EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
+ EXPECT_EQ((size_t)3, rootDisplayItemList().paintList().size());
+ EXPECT_TRUE(rootDisplayItemList().paintList()[0]->isClip());
+ EXPECT_TRUE(rootDisplayItemList().paintList()[1]->isDrawing());
+ EXPECT_TRUE(rootDisplayItemList().paintList()[2]->isEndClip());
+}
+
+TEST_F(LayerClipRecorderTest, Empty)
+{
+ GraphicsContext context(nullptr, &rootDisplayItemList());
+ FloatRect bound = renderView()->viewRect();
+ EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
+
+ drawEmptyClip(&context, renderView(), PaintPhaseForeground, bound);
+ rootDisplayItemList().endNewPaints();
+ EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
}
}

Powered by Google App Engine
This is Rietveld 408576698