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

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

Issue 2128903002: Use enclosingIntRect for the cull rect of DrawingDisplayItems. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rtree
Patch Set: none 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/platform/graphics/paint/DrawingRecorder.cpp » ('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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 TEST_F(LayoutObjectDrawingRecorderTest, CullRectMatchesProvidedClip) 105 TEST_F(LayoutObjectDrawingRecorderTest, CullRectMatchesProvidedClip)
106 { 106 {
107 // It's safe for the picture's cull rect to be expanded (though doing so 107 // It's safe for the picture's cull rect to be expanded (though doing so
108 // excessively may harm performance), but it cannot be contracted. 108 // excessively may harm performance), but it cannot be contracted.
109 // For now, this test expects the two rects to match completely. 109 // For now, this test expects the two rects to match completely.
110 // 110 //
111 // This rect is chosen so that in the x direction, pixel snapping rounds in 111 // This rect is chosen so that in the x direction, pixel snapping rounds in
112 // the opposite direction to enclosing, and in the y direction, the edges 112 // the opposite direction to enclosing, and in the y direction, the edges
113 // are exactly on a half-pixel boundary. The numbers chosen map nicely to 113 // are exactly on a half-pixel boundary. The numbers chosen map nicely to
114 // both float and LayoutUnit, to make equality checking reliable. 114 // both float and LayoutUnit, to make equality checking reliable.
115 //
116 // The final cull rect should be the enclosing int rect of this rect.
115 FloatRect rect(20.75, -5.5, 5.375, 10); 117 FloatRect rect(20.75, -5.5, 5.375, 10);
116 EXPECT_EQ(rect, drawAndGetCullRect(rootPaintController(), layoutView(), rect )); 118 EXPECT_EQ(enclosingIntRect(rect), drawAndGetCullRect(rootPaintController(), layoutView(), rect));
117 EXPECT_EQ(rect, drawAndGetCullRect(rootPaintController(), layoutView(), Layo utRect(rect))); 119 EXPECT_EQ(enclosingIntRect(rect), drawAndGetCullRect(rootPaintController(), layoutView(), LayoutRect(rect)));
118 } 120 }
119 121
120 #if 0 // TODO(wangxianzhu): Rewrite this test for slimmingPaintInvalidation. 122 #if 0 // TODO(wangxianzhu): Rewrite this test for slimmingPaintInvalidation.
121 TEST_F(LayoutObjectDrawingRecorderTest, PaintOffsetCache) 123 TEST_F(LayoutObjectDrawingRecorderTest, PaintOffsetCache)
122 { 124 {
123 RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(true); 125 RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(true);
124 126
125 GraphicsContext context(rootPaintController()); 127 GraphicsContext context(rootPaintController());
126 LayoutRect bounds = layoutView().viewRect(); 128 LayoutRect bounds = layoutView().viewRect();
127 LayoutPoint paintOffset(1, 2); 129 LayoutPoint paintOffset(1, 2);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Ensure the new paint offset can be used. 161 // Ensure the new paint offset can be used.
160 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutView(), PaintPhaseForeground)); 162 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutView(), PaintPhaseForeground));
161 rootPaintController().commitNewDisplayItems(); 163 rootPaintController().commitNewDisplayItems();
162 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1, 164 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1,
163 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground))); 165 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)));
164 } 166 }
165 #endif 167 #endif
166 168
167 } // namespace 169 } // namespace
168 } // namespace blink 170 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698