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

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

Issue 1355753008: RuntimeEnabledFeatures::slimmingPaintOffsetCaching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 #include "core/paint/LayoutObjectDrawingRecorder.h" 6 #include "core/paint/LayoutObjectDrawingRecorder.h"
7 7
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/DeprecatedPaintLayer.h" 10 #include "core/paint/DeprecatedPaintLayer.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // 112 //
113 // This rect is chosen so that in the x direction, pixel snapping rounds in 113 // This rect is chosen so that in the x direction, pixel snapping rounds in
114 // the opposite direction to enclosing, and in the y direction, the edges 114 // the opposite direction to enclosing, and in the y direction, the edges
115 // are exactly on a half-pixel boundary. The numbers chosen map nicely to 115 // are exactly on a half-pixel boundary. The numbers chosen map nicely to
116 // both float and LayoutUnit, to make equality checking reliable. 116 // both float and LayoutUnit, to make equality checking reliable.
117 FloatRect rect(20.75, -5.5, 5.375, 10); 117 FloatRect rect(20.75, -5.5, 5.375, 10);
118 EXPECT_EQ(rect, drawAndGetCullRect(rootDisplayItemList(), layoutView(), rect )); 118 EXPECT_EQ(rect, drawAndGetCullRect(rootDisplayItemList(), layoutView(), rect ));
119 EXPECT_EQ(rect, drawAndGetCullRect(rootDisplayItemList(), layoutView(), Layo utRect(rect))); 119 EXPECT_EQ(rect, drawAndGetCullRect(rootDisplayItemList(), layoutView(), Layo utRect(rect)));
120 } 120 }
121 121
122 TEST_F(LayoutObjectDrawingRecorderTestForSlimmingPaintV2, PaintOffsetCache) 122 TEST_F(LayoutObjectDrawingRecorderTest, PaintOffsetCache)
123 { 123 {
124 RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(true);
125
124 GraphicsContext context(&rootDisplayItemList()); 126 GraphicsContext context(&rootDisplayItemList());
125 LayoutRect bounds = layoutView().viewRect(); 127 LayoutRect bounds = layoutView().viewRect();
126 LayoutPoint paintOffset(1, 2); 128 LayoutPoint paintOffset(1, 2);
127 129
128 rootDisplayItemList().invalidateAll(); 130 rootDisplayItemList().invalidateAll();
129 EXPECT_FALSE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context , layoutView(), PaintPhaseForeground, paintOffset)); 131 EXPECT_FALSE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context , layoutView(), PaintPhaseForeground, paintOffset));
130 { 132 {
131 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView(), Paint PhaseForeground, bounds, paintOffset); 133 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView(), Paint PhaseForeground, bounds, paintOffset);
132 IntRect rect(0, 0, 10, 10); 134 IntRect rect(0, 0, 10, 10);
133 context.drawRect(rect); 135 context.drawRect(rect);
(...skipping 23 matching lines...) Expand all
157 159
158 // Ensure the new paint offset can be used. 160 // Ensure the new paint offset can be used.
159 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutView(), PaintPhaseForeground, newPaintOffset)); 161 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutView(), PaintPhaseForeground, newPaintOffset));
160 rootDisplayItemList().commitNewDisplayItems(); 162 rootDisplayItemList().commitNewDisplayItems();
161 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 1, 163 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 1,
162 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground))); 164 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)));
163 } 165 }
164 166
165 } // namespace 167 } // namespace
166 } // namespace blink 168 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/LayoutObjectDrawingRecorder.h ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698