| 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/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/layout/api/LayoutAPIShim.h" | 9 #include "core/layout/api/LayoutAPIShim.h" |
| 10 #include "core/layout/compositing/PaintLayerCompositor.h" | 10 #include "core/layout/compositing/PaintLayerCompositor.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 ASSERT_TRUE(m_layoutView); | 37 ASSERT_TRUE(m_layoutView); |
| 38 } | 38 } |
| 39 | 39 |
| 40 LayoutView* m_layoutView; | 40 LayoutView* m_layoutView; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 void drawEmptyClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase) | 43 void drawEmptyClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase) |
| 44 { | 44 { |
| 45 LayoutRect rect(1, 1, 9, 9); | 45 LayoutRect rect(1, 1, 9, 9); |
| 46 ClipRect clipRect(rect); | 46 ClipRect clipRect(rect); |
| 47 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 47 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::kClipLayerForeground, clipRect, 0, LayoutPo
int(), PaintLayerFlags()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void drawRectInClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase, const LayoutRect& bound) | 50 void drawRectInClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase, const LayoutRect& bound) |
| 51 { | 51 { |
| 52 IntRect rect(1, 1, 9, 9); | 52 IntRect rect(1, 1, 9, 9); |
| 53 ClipRect clipRect((LayoutRect(rect))); | 53 ClipRect clipRect((LayoutRect(rect))); |
| 54 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 54 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::kClipLayerForeground, clipRect, 0, LayoutPo
int(), PaintLayerFlags()); |
| 55 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layout
View, phase)) { | 55 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layout
View, phase)) { |
| 56 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase,
bound); | 56 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase,
bound); |
| 57 context.drawRect(rect); | 57 context.drawRect(rect); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 TEST_F(LayerClipRecorderTest, Single) | 61 TEST_F(LayerClipRecorderTest, Single) |
| 62 { | 62 { |
| 63 rootPaintController().invalidateAll(); | 63 rootPaintController().invalidateAll(); |
| 64 GraphicsContext context(rootPaintController()); | 64 GraphicsContext context(rootPaintController()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 GraphicsContext context(rootPaintController()); | 79 GraphicsContext context(rootPaintController()); |
| 80 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); | 80 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); |
| 81 | 81 |
| 82 drawEmptyClip(context, layoutView(), PaintPhaseForeground); | 82 drawEmptyClip(context, layoutView(), PaintPhaseForeground); |
| 83 rootPaintController().commitNewDisplayItems(); | 83 rootPaintController().commitNewDisplayItems(); |
| 84 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); | 84 EXPECT_EQ((size_t)0, rootPaintController().getDisplayItemList().size()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |