OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |