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

Side by Side Diff: Source/core/paint/ViewDisplayListTest.cpp

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove unnecessary numbers Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/ViewDisplayList.h" 6 #include "core/paint/ViewDisplayList.h"
7 7
8 #include "core/paint/ClipRecorder.h"
9 #include "core/paint/DrawingRecorder.h" 8 #include "core/paint/DrawingRecorder.h"
9 #include "core/paint/LayerClipRecorder.h"
10 #include "core/rendering/RenderView.h" 10 #include "core/rendering/RenderView.h"
11 #include "core/rendering/RenderingTestHelper.h" 11 #include "core/rendering/RenderingTestHelper.h"
12 #include "core/rendering/compositing/RenderLayerCompositor.h" 12 #include "core/rendering/compositing/RenderLayerCompositor.h"
13 #include "platform/graphics/GraphicsContext.h" 13 #include "platform/graphics/GraphicsContext.h"
14 #include <gtest/gtest.h> 14 #include <gtest/gtest.h>
15 15
16 namespace blink { 16 namespace blink {
17 namespace { 17 namespace {
18 18
19 class ViewDisplayListTest : public RenderingTest { 19 class ViewDisplayListTest : public RenderingTest {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 { 57 {
58 DrawingRecorder drawingRecorder(context, renderer, phase, bound); 58 DrawingRecorder drawingRecorder(context, renderer, phase, bound);
59 IntRect rect(0, 0, 10, 10); 59 IntRect rect(0, 0, 10, 10);
60 context->drawRect(rect); 60 context->drawRect(rect);
61 } 61 }
62 62
63 void drawClippedRect(GraphicsContext* context, RenderLayerModelObject* renderer, PaintPhase phase, const FloatRect& bound) 63 void drawClippedRect(GraphicsContext* context, RenderLayerModelObject* renderer, PaintPhase phase, const FloatRect& bound)
64 { 64 {
65 IntRect rect(1, 1, 9, 9); 65 IntRect rect(1, 1, 9, 9);
66 ClipRect clipRect(rect); 66 ClipRect clipRect(rect);
67 ClipRecorder clipRecorder(renderer, context, DisplayItem::ClipLayerForegroun d, clipRect, 0, LayoutPoint(), PaintLayerFlags()); 67 LayerClipRecorder layerClipRecorder(renderer, context, DisplayItem::ClipLaye rForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags());
68 drawRect(context, renderer, phase, bound); 68 drawRect(context, renderer, phase, bound);
69 } 69 }
70 70
71 TEST_F(ViewDisplayListTest, ViewDisplayListTest_NestedRecorders) 71 TEST_F(ViewDisplayListTest, ViewDisplayListTest_NestedRecorders)
72 { 72 {
73 GraphicsContext* context = new GraphicsContext(nullptr); 73 GraphicsContext* context = new GraphicsContext(nullptr);
74 FloatRect bound = renderView()->viewRect(); 74 FloatRect bound = renderView()->viewRect();
75 75
76 drawClippedRect(context, renderView(), PaintPhaseForeground, bound); 76 drawClippedRect(context, renderView(), PaintPhaseForeground, bound);
77 77
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateClip) 356 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateClip)
357 { 357 {
358 setBodyInnerHTML("<div id='first'><div id='second'></div></div>"); 358 setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
359 RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document(). body()->firstChild()->renderer()); 359 RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document(). body()->firstChild()->renderer());
360 RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document() .body()->firstChild()->firstChild()->renderer()); 360 RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document() .body()->firstChild()->firstChild()->renderer());
361 GraphicsContext* context = new GraphicsContext(nullptr); 361 GraphicsContext* context = new GraphicsContext(nullptr);
362 362
363 ClipRect firstClipRect(IntRect(1, 1, 2, 2)); 363 ClipRect firstClipRect(IntRect(1, 1, 2, 2));
364 { 364 {
365 ClipRecorder clipRecorder(firstRenderer, context, DisplayItem::ClipLayer Foreground, firstClipRect, 0, LayoutPoint(), PaintLayerFlags()); 365 LayerClipRecorder layerClipRecorder(firstRenderer, context, DisplayItem: :ClipLayerForeground, firstClipRect, 0, LayoutPoint(), PaintLayerFlags());
366 drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(10 0, 100, 150, 150)); 366 drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(10 0, 100, 150, 150));
367 drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150)); 367 drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150));
368 } 368 }
369 369
370 EXPECT_DISPLAY_LIST(renderView()->viewDisplayList().paintList(), 4, 370 EXPECT_DISPLAY_LIST(renderView()->viewDisplayList().paintList(), 4,
371 TestDisplayItem(firstRenderer, DisplayItem::ClipLayerForeground), 371 TestDisplayItem(firstRenderer, DisplayItem::ClipLayerForeground),
372 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 372 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
373 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round), 373 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round),
374 TestDisplayItem(firstRenderer, DisplayItem::EndClip)); 374 TestDisplayItem(firstRenderer, DisplayItem::EndClip));
375 375
376 renderView()->viewDisplayList().invalidate(firstRenderer); 376 renderView()->viewDisplayList().invalidate(firstRenderer);
377 drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 1 00, 150, 150)); 377 drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 1 00, 150, 150));
378 drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 378 drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
379 379
380 EXPECT_DISPLAY_LIST(renderView()->viewDisplayList().paintList(), 2, 380 EXPECT_DISPLAY_LIST(renderView()->viewDisplayList().paintList(), 2,
381 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 381 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
382 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round)); 382 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round));
383 383
384 renderView()->viewDisplayList().invalidate(secondRenderer); 384 renderView()->viewDisplayList().invalidate(secondRenderer);
385 drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 1 00, 150, 150)); 385 drawRect(context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 1 00, 150, 150));
386 ClipRect secondClipRect(IntRect(1, 1, 2, 2)); 386 ClipRect secondClipRect(IntRect(1, 1, 2, 2));
387 { 387 {
388 ClipRecorder clipRecorder(secondRenderer, context, DisplayItem::ClipLaye rForeground, secondClipRect, 0, LayoutPoint(), PaintLayerFlags()); 388 LayerClipRecorder layerClipRecorder(secondRenderer, context, DisplayItem ::ClipLayerForeground, secondClipRect, 0, LayoutPoint(), PaintLayerFlags());
389 drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150)); 389 drawRect(context, secondRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150));
390 } 390 }
391 391
392 EXPECT_DISPLAY_LIST(renderView()->viewDisplayList().paintList(), 4, 392 EXPECT_DISPLAY_LIST(renderView()->viewDisplayList().paintList(), 4,
393 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 393 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
394 TestDisplayItem(secondRenderer, DisplayItem::ClipLayerForeground), 394 TestDisplayItem(secondRenderer, DisplayItem::ClipLayerForeground),
395 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round), 395 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round),
396 TestDisplayItem(secondRenderer, DisplayItem::EndClip)); 396 TestDisplayItem(secondRenderer, DisplayItem::EndClip));
397 } 397 }
398 398
399 } // anonymous namespace 399 } // anonymous namespace
400 } // namespace blink 400 } // namespace blink
OLDNEW
« Source/core/paint/ViewDisplayList.cpp ('K') | « Source/core/paint/ViewDisplayList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698