| 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/LayerClipRecorder.h" | 5 #include "core/paint/LayerClipRecorder.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
| 8 #include "core/layout/compositing/PaintLayerCompositor.h" | 8 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 9 #include "core/paint/LayoutObjectDrawingRecorder.h" | 9 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 10 #include "core/paint/PaintControllerPaintTest.h" | 10 #include "core/paint/PaintControllerPaintTest.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 enableCompositing(); | 24 enableCompositing(); |
| 25 } | 25 } |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 void drawEmptyClip(GraphicsContext& context, | 28 void drawEmptyClip(GraphicsContext& context, |
| 29 LayoutView& layoutView, | 29 LayoutView& layoutView, |
| 30 PaintPhase phase) { | 30 PaintPhase phase) { |
| 31 LayoutRect rect(1, 1, 9, 9); | 31 LayoutRect rect(1, 1, 9, 9); |
| 32 ClipRect clipRect(rect); | 32 ClipRect clipRect(rect); |
| 33 LayerClipRecorder LayerClipRecorder( | 33 LayerClipRecorder LayerClipRecorder( |
| 34 context, *layoutView.compositor()->rootLayer()->layoutObject(), | 34 context, layoutView.compositor()->rootLayer()->layoutObject(), |
| 35 DisplayItem::kClipLayerForeground, clipRect, 0, LayoutPoint(), | 35 DisplayItem::kClipLayerForeground, clipRect, 0, LayoutPoint(), |
| 36 PaintLayerFlags()); | 36 PaintLayerFlags()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void drawRectInClip(GraphicsContext& context, | 39 void drawRectInClip(GraphicsContext& context, |
| 40 LayoutView& layoutView, | 40 LayoutView& layoutView, |
| 41 PaintPhase phase, | 41 PaintPhase phase, |
| 42 const LayoutRect& bound) { | 42 const LayoutRect& bound) { |
| 43 IntRect rect(1, 1, 9, 9); | 43 IntRect rect(1, 1, 9, 9); |
| 44 ClipRect clipRect((LayoutRect(rect))); | 44 ClipRect clipRect((LayoutRect(rect))); |
| 45 LayerClipRecorder LayerClipRecorder( | 45 LayerClipRecorder LayerClipRecorder( |
| 46 context, *layoutView.compositor()->rootLayer()->layoutObject(), | 46 context, layoutView.compositor()->rootLayer()->layoutObject(), |
| 47 DisplayItem::kClipLayerForeground, clipRect, 0, LayoutPoint(), | 47 DisplayItem::kClipLayerForeground, clipRect, 0, LayoutPoint(), |
| 48 PaintLayerFlags()); | 48 PaintLayerFlags()); |
| 49 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 49 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
| 50 context, layoutView, phase)) { | 50 context, layoutView, phase)) { |
| 51 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase, | 51 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase, |
| 52 bound); | 52 bound); |
| 53 context.drawRect(rect); | 53 context.drawRect(rect); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 76 GraphicsContext context(rootPaintController()); | 76 GraphicsContext context(rootPaintController()); |
| 77 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); | 77 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); |
| 78 | 78 |
| 79 drawEmptyClip(context, layoutView(), PaintPhaseForeground); | 79 drawEmptyClip(context, layoutView(), PaintPhaseForeground); |
| 80 rootPaintController().commitNewDisplayItems(); | 80 rootPaintController().commitNewDisplayItems(); |
| 81 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); | 81 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |