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

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

Issue 847783003: New display item caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Working patch 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 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 6
7 #include "core/paint/LayerClipRecorder.h" 7 #include "core/paint/LayerClipRecorder.h"
8 #include "core/paint/LayerPainter.h" 8 #include "core/paint/LayerPainter.h"
9 #include "core/paint/RenderDrawingRecorder.h" 9 #include "core/paint/RenderDrawingRecorder.h"
10 #include "core/rendering/RenderView.h" 10 #include "core/rendering/RenderView.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 document().view()->updateLayoutAndStyleForPainting(); 512 document().view()->updateLayoutAndStyleForPainting();
513 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases); 513 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases);
514 rootDisplayItemList().endNewPaints(); 514 rootDisplayItemList().endNewPaints();
515 515
516 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 516 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
517 TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackgro und), 517 TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackgro und),
518 TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground), 518 TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground),
519 TestDisplayItem(divRenderer, DisplayItem::DrawingPaintPhaseCaret)); 519 TestDisplayItem(divRenderer, DisplayItem::DrawingPaintPhaseCaret));
520 } 520 }
521 521
522 TEST_F(ViewDisplayListTest, ComplexUpdateSwapOrder)
523 {
524 setBodyInnerHTML("<div id='container1'><div id='content1'></div></div>"
525 "<div id='container2'><div id='content2'></div></div>");
526 RenderObject* container1 = document().body()->firstChild()->renderer();
527 RenderObject* content1 = document().body()->firstChild()->firstChild()->rend erer();
528 RenderObject* container2 = document().body()->firstChild()->nextSibling()->r enderer();
529 RenderObject* content2 = document().body()->firstChild()->nextSibling()->fir stChild()->renderer();
530 GraphicsContext context(nullptr, &rootDisplayItemList());
531
532 drawRect(&context, container1, PaintPhaseBlockBackground, FloatRect(100, 100 , 100, 100));
533 drawRect(&context, content1, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
534 drawRect(&context, content1, PaintPhaseForeground, FloatRect(100, 100, 50, 2 00));
535 drawRect(&context, container1, PaintPhaseForeground, FloatRect(100, 100, 100 , 100));
536 drawRect(&context, container2, PaintPhaseBlockBackground, FloatRect(100, 200 , 100, 100));
537 drawRect(&context, content2, PaintPhaseBlockBackground, FloatRect(100, 200, 50, 200));
538 drawRect(&context, content2, PaintPhaseForeground, FloatRect(100, 200, 50, 2 00));
539 drawRect(&context, container2, PaintPhaseForeground, FloatRect(100, 200, 100 , 100));
540 rootDisplayItemList().endNewPaints();
541
542 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 8,
543 TestDisplayItem(container1, DisplayItem::DrawingPaintPhaseBlockBackgroun d),
544 TestDisplayItem(content1, DisplayItem::DrawingPaintPhaseBlockBackground) ,
545 TestDisplayItem(content1, DisplayItem::DrawingPaintPhaseForeground),
546 TestDisplayItem(container1, DisplayItem::DrawingPaintPhaseForeground),
547 TestDisplayItem(container2, DisplayItem::DrawingPaintPhaseBlockBackgroun d),
548 TestDisplayItem(content2, DisplayItem::DrawingPaintPhaseBlockBackground) ,
549 TestDisplayItem(content2, DisplayItem::DrawingPaintPhaseForeground),
550 TestDisplayItem(container2, DisplayItem::DrawingPaintPhaseForeground));
551
552 rootDisplayItemList().invalidate(container1->displayItemClient());
553 drawRect(&context, container2, PaintPhaseBlockBackground, FloatRect(100, 200 , 100, 100));
554 drawRect(&context, content2, PaintPhaseBlockBackground, FloatRect(100, 200, 50, 200));
555 drawRect(&context, content2, PaintPhaseForeground, FloatRect(100, 200, 50, 2 00));
556 drawRect(&context, container2, PaintPhaseForeground, FloatRect(100, 200, 100 , 100));
557 drawRect(&context, container1, PaintPhaseBlockBackground, FloatRect(100, 100 , 100, 100));
558 drawRect(&context, content1, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
559 drawRect(&context, content1, PaintPhaseForeground, FloatRect(100, 100, 50, 2 00));
560 drawRect(&context, container1, PaintPhaseForeground, FloatRect(100, 100, 100 , 100));
561 rootDisplayItemList().endNewPaints();
562
563 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 8,
564 TestDisplayItem(container2, DisplayItem::DrawingPaintPhaseBlockBackgroun d),
565 TestDisplayItem(content2, DisplayItem::DrawingPaintPhaseBlockBackground) ,
566 TestDisplayItem(content2, DisplayItem::DrawingPaintPhaseForeground),
567 TestDisplayItem(container2, DisplayItem::DrawingPaintPhaseForeground),
568 TestDisplayItem(container1, DisplayItem::DrawingPaintPhaseBlockBackgroun d),
569 TestDisplayItem(content1, DisplayItem::DrawingPaintPhaseBlockBackground) ,
570 TestDisplayItem(content1, DisplayItem::DrawingPaintPhaseForeground),
571 TestDisplayItem(container1, DisplayItem::DrawingPaintPhaseForeground));
572 }
573
522 } // anonymous namespace 574 } // anonymous namespace
523 } // namespace blink 575 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/RuntimeEnabledFeatures.in » ('j') | Source/platform/graphics/paint/DisplayItemList.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698