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

Side by Side Diff: third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp

Issue 2107103002: Find cached display items directly during painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/paint/LayoutObjectDrawingRecorder.h" 5 #include "core/paint/LayoutObjectDrawingRecorder.h"
6 6
7 #include "core/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/PaintControllerPaintTest.h" 9 #include "core/paint/PaintControllerPaintTest.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 drawRect(context, layoutView(), PaintPhaseForeground, bound); 69 drawRect(context, layoutView(), PaintPhaseForeground, bound);
70 rootPaintController().commitNewDisplayItems(); 70 rootPaintController().commitNewDisplayItems();
71 71
72 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, 72 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2,
73 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseSelfBlockBackgroundOnly)), 73 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseSelfBlockBackgroundOnly)),
74 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground))); 74 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)));
75 75
76 drawNothing(context, layoutView(), PaintPhaseSelfBlockBackgroundOnly, bound) ; 76 drawNothing(context, layoutView(), PaintPhaseSelfBlockBackgroundOnly, bound) ;
77 drawRect(context, layoutView(), PaintPhaseForeground, bound); 77 drawRect(context, layoutView(), PaintPhaseForeground, bound);
78 78
79 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 2, 79 EXPECT_EQ(2, numCachedNewItems());
80 TestDisplayItem(layoutView(), DisplayItem::drawingTypeToCachedDrawingTyp e(DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfBlockBackgroundOnly))),
81 TestDisplayItem(layoutView(), DisplayItem::drawingTypeToCachedDrawingTyp e(DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground))));
82 80
83 rootPaintController().commitNewDisplayItems(); 81 rootPaintController().commitNewDisplayItems();
84 82
85 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, 83 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2,
86 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseSelfBlockBackgroundOnly)), 84 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseSelfBlockBackgroundOnly)),
87 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground))); 85 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)));
88 } 86 }
89 87
90 template <typename T> 88 template <typename T>
91 FloatRect drawAndGetCullRect(PaintController& controller, const LayoutObject& la youtObject, const T& bounds) 89 FloatRect drawAndGetCullRect(PaintController& controller, const LayoutObject& la youtObject, const T& bounds)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Ensure the new paint offset can be used. 159 // Ensure the new paint offset can be used.
162 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutView(), PaintPhaseForeground)); 160 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutView(), PaintPhaseForeground));
163 rootPaintController().commitNewDisplayItems(); 161 rootPaintController().commitNewDisplayItems();
164 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1, 162 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1,
165 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground))); 163 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)));
166 } 164 }
167 #endif 165 #endif
168 166
169 } // namespace 167 } // namespace
170 } // namespace blink 168 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698