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

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

Issue 834173003: Change about caret painting in slimming paint mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add tests Created 5 years, 11 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
« no previous file with comments | « Source/core/paint/BlockPainter.cpp ('k') | Source/core/rendering/PaintInfo.cpp » ('j') | 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 c456889c28fc227f7b259e26eae6fdf08f5fe3f3..eeca86223ee7deccbdb8d45deb4a35316b5dc2ca 100644
--- a/Source/core/paint/ViewDisplayListTest.cpp
+++ b/Source/core/paint/ViewDisplayListTest.cpp
@@ -5,6 +5,7 @@
#include "config.h"
#include "core/paint/LayerClipRecorder.h"
+#include "core/paint/LayerPainter.h"
#include "core/paint/RenderDrawingRecorder.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/RenderingTestHelper.h"
@@ -51,10 +52,19 @@ public:
#endif
};
+#ifndef NDEBUG
+#define TRACE_DISPLAY_ITEMS(expected, actual) \
+ String trace = "Expected: " + (expected).asDebugString() + " Actual: " + (actual).asDebugString(); \
+ SCOPED_TRACE(trace.utf8().data());
+#else
+#define TRACE_DISPLAY_ITEMS(expected, actual)
+#endif
+
#define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) { \
EXPECT_EQ((size_t)expectedSize, actual.size()); \
const TestDisplayItem expected[] = { __VA_ARGS__ }; \
for (size_t index = 0; index < expectedSize; index++) { \
+ TRACE_DISPLAY_ITEMS(expected[index], *actual[index]); \
EXPECT_EQ(expected[index].client(), actual[index]->client()); \
EXPECT_EQ(expected[index].type(), actual[index]->type()); \
} \
@@ -445,5 +455,34 @@ TEST_F(ViewDisplayListTest, CachedDisplayItems)
EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(secondRenderer->displayItemClient()));
}
+TEST_F(ViewDisplayListTest, FullDocumentPaintingWithCaret)
+{
+ setBodyInnerHTML("<div id='div' contentEditable='true'>XYZ</div>");
+ RenderView* renderView = document().renderView();
+ RenderLayer* rootLayer = renderView->layer();
+ RenderObject* htmlRenderer = document().documentElement()->renderer();
+ Element* div = toElement(document().body()->firstChild());
+ RenderObject* divRenderer = document().body()->firstChild()->renderer();
+ RenderObject* textRenderer = div->firstChild()->renderer();
+
+ SkCanvas canvas(800, 600);
+ GraphicsContext context(&canvas, &rootDisplayItemList());
+ LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintBehaviorNormal, LayoutSize());
+ LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+
+ EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
+ TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackground),
+ TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground));
+
+ div->focus();
+ document().view()->updateLayoutAndStyleForPainting();
+ LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+
+ EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
+ TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackground),
+ TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground),
+ TestDisplayItem(divRenderer, DisplayItem::DrawingPaintPhaseCaret));
+}
+
} // anonymous namespace
} // namespace blink
« no previous file with comments | « Source/core/paint/BlockPainter.cpp ('k') | Source/core/rendering/PaintInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698