| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground))); | 85 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground))); |
| 86 } | 86 } |
| 87 | 87 |
| 88 template <typename T> | 88 template <typename T> |
| 89 FloatRect drawAndGetCullRect(PaintController& controller, const LayoutObject& la
youtObject, const T& bounds) | 89 FloatRect drawAndGetCullRect(PaintController& controller, const LayoutObject& la
youtObject, const T& bounds) |
| 90 { | 90 { |
| 91 controller.invalidateAll(); | 91 controller.invalidateAll(); |
| 92 { | 92 { |
| 93 // Draw some things which will produce a non-null picture. | 93 // Draw some things which will produce a non-null picture. |
| 94 GraphicsContext context(controller); | 94 GraphicsContext context(controller); |
| 95 LayoutObjectDrawingRecorder recorder(context, layoutObject, DisplayItem:
:BoxDecorationBackground, bounds); | 95 LayoutObjectDrawingRecorder recorder(context, layoutObject, DisplayItem:
:kBoxDecorationBackground, bounds); |
| 96 context.drawRect(enclosedIntRect(FloatRect(bounds))); | 96 context.drawRect(enclosedIntRect(FloatRect(bounds))); |
| 97 } | 97 } |
| 98 controller.commitNewDisplayItems(); | 98 controller.commitNewDisplayItems(); |
| 99 const auto& drawing = static_cast<const DrawingDisplayItem&>(controller.getD
isplayItemList()[0]); | 99 const auto& drawing = static_cast<const DrawingDisplayItem&>(controller.getD
isplayItemList()[0]); |
| 100 return drawing.picture()->cullRect(); | 100 return drawing.picture()->cullRect(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 TEST_F(LayoutObjectDrawingRecorderTest, CullRectMatchesProvidedClip) | 103 TEST_F(LayoutObjectDrawingRecorderTest, CullRectMatchesProvidedClip) |
| 104 { | 104 { |
| 105 // It's safe for the picture's cull rect to be expanded (though doing so | 105 // It's safe for the picture's cull rect to be expanded (though doing so |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Ensure the new paint offset can be used. | 159 // Ensure the new paint offset can be used. |
| 160 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context,
layoutView(), PaintPhaseForeground)); | 160 EXPECT_TRUE(LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context,
layoutView(), PaintPhaseForeground)); |
| 161 rootPaintController().commitNewDisplayItems(); | 161 rootPaintController().commitNewDisplayItems(); |
| 162 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1, | 162 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1, |
| 163 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground))); | 163 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground))); |
| 164 } | 164 } |
| 165 #endif | 165 #endif |
| 166 | 166 |
| 167 } // namespace | 167 } // namespace |
| 168 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |