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 #ifndef LayoutObjectDrawingRecorder_h | 5 #ifndef LayoutObjectDrawingRecorder_h |
6 #define LayoutObjectDrawingRecorder_h | 6 #define LayoutObjectDrawingRecorder_h |
7 | 7 |
8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
9 #include "core/paint/PaintPhase.h" | 9 #include "core/paint/PaintPhase.h" |
10 #include "platform/geometry/LayoutPoint.h" | 10 #include "platform/geometry/LayoutPoint.h" |
11 #include "platform/geometry/LayoutRect.h" | 11 #include "platform/geometry/LayoutRect.h" |
12 #include "platform/graphics/paint/DisplayItemCacheSkipper.h" | 12 #include "platform/graphics/paint/DisplayItemCacheSkipper.h" |
13 #include "platform/graphics/paint/DrawingRecorder.h" | 13 #include "platform/graphics/paint/DrawingRecorder.h" |
14 #include "wtf/Allocator.h" | 14 #include "wtf/Allocator.h" |
15 #include "wtf/Optional.h" | 15 #include "wtf/Optional.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class GraphicsContext; | 19 class GraphicsContext; |
20 | 20 |
21 // Convenience wrapper of DrawingRecorder for LayoutObject painters. | 21 // Convenience wrapper of DrawingRecorder for LayoutObject painters. |
22 class LayoutObjectDrawingRecorder final { | 22 class LayoutObjectDrawingRecorder final { |
23 ALLOW_ONLY_INLINE_ALLOCATION(); | 23 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
24 public: | 24 public: |
25 static bool useCachedDrawingIfPossible(GraphicsContext& context, const Layou
tObject& layoutObject, DisplayItem::Type displayItemType, const LayoutPoint& pai
ntOffset) | 25 static bool useCachedDrawingIfPossible(GraphicsContext& context, const Layou
tObject& layoutObject, DisplayItem::Type displayItemType, const LayoutPoint& pai
ntOffset) |
26 { | 26 { |
27 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && layou
tObject.paintOffsetChanged(paintOffset)) | 27 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && layou
tObject.paintOffsetChanged(paintOffset)) |
28 return false; | 28 return false; |
29 if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelay
edFull) | 29 if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelay
edFull) |
30 return false; | 30 return false; |
31 return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject
, displayItemType); | 31 return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject
, displayItemType); |
32 } | 32 } |
33 | 33 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 layoutObject.mutableForPainting().setPreviousPaintOffset(paintOffset); | 75 layoutObject.mutableForPainting().setPreviousPaintOffset(paintOffset); |
76 } | 76 } |
77 | 77 |
78 Optional<DisplayItemCacheSkipper> m_cacheSkipper; | 78 Optional<DisplayItemCacheSkipper> m_cacheSkipper; |
79 Optional<DrawingRecorder> m_drawingRecorder; | 79 Optional<DrawingRecorder> m_drawingRecorder; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
83 | 83 |
84 #endif // LayoutObjectDrawingRecorder_h | 84 #endif // LayoutObjectDrawingRecorder_h |
OLD | NEW |