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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject
, displayItemType); | 31 return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject
, displayItemType); |
32 } | 32 } |
33 | 33 |
34 static bool useCachedDrawingIfPossible(GraphicsContext& context, const Layou
tObject& layoutObject, PaintPhase phase, const LayoutPoint& paintOffset) | 34 static bool useCachedDrawingIfPossible(GraphicsContext& context, const Layou
tObject& layoutObject, PaintPhase phase, const LayoutPoint& paintOffset) |
35 { | 35 { |
36 return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::pa
intPhaseToDrawingType(phase), paintOffset); | 36 return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::pa
intPhaseToDrawingType(phase), paintOffset); |
37 } | 37 } |
38 | 38 |
39 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const FloatRect& clip, const Layo
utPoint& paintOffset) | 39 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const FloatRect& clip, const Layo
utPoint& paintOffset) |
40 { | 40 { |
41 updatePaintOffsetIfNeeded(context.displayItemList(), layoutObject, paint
Offset); | 41 updatePaintOffsetIfNeeded(context.paintController(), layoutObject, paint
Offset); |
42 // We may paint a delayed-invalidation object before it's actually inval
idated. | 42 // We may paint a delayed-invalidation object before it's actually inval
idated. |
43 if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelay
edFull) | 43 if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelay
edFull) |
44 m_cacheSkipper.emplace(context); | 44 m_cacheSkipper.emplace(context); |
45 m_drawingRecorder.emplace(context, layoutObject, displayItemType, clip); | 45 m_drawingRecorder.emplace(context, layoutObject, displayItemType, clip); |
46 } | 46 } |
47 | 47 |
48 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const LayoutRect& clip, const Lay
outPoint& paintOffset) | 48 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const LayoutRect& clip, const Lay
outPoint& paintOffset) |
49 : LayoutObjectDrawingRecorder(context, layoutObject, displayItemType, Fl
oatRect(clip), paintOffset) { } | 49 : LayoutObjectDrawingRecorder(context, layoutObject, displayItemType, Fl
oatRect(clip), paintOffset) { } |
50 | 50 |
51 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const FloatRect& clip, const LayoutPoint& paintOff
set) | 51 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const FloatRect& clip, const LayoutPoint& paintOff
set) |
52 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), clip, paintOffset) { } | 52 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), clip, paintOffset) { } |
53 | 53 |
54 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOf
fset) | 54 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOf
fset) |
55 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } | 55 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
56 | 56 |
57 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffse
t) | 57 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffse
t) |
58 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } | 58 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
59 | 59 |
60 #if ENABLE(ASSERT) | 60 #if ENABLE(ASSERT) |
61 void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationC
heckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); } | 61 void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationC
heckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); } |
62 #endif | 62 #endif |
63 | 63 |
64 private: | 64 private: |
65 static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, cons
t LayoutObject& layoutObject, const LayoutPoint& paintOffset) | 65 static void updatePaintOffsetIfNeeded(PaintController* paintController, cons
t LayoutObject& layoutObject, const LayoutPoint& paintOffset) |
66 { | 66 { |
67 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() || disp
layItemList->skippingCache()) | 67 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() || pain
tController->skippingCache()) |
68 return; | 68 return; |
69 | 69 |
70 if (layoutObject.paintOffsetChanged(paintOffset)) | 70 if (layoutObject.paintOffsetChanged(paintOffset)) |
71 displayItemList->invalidatePaintOffset(layoutObject); | 71 paintController->invalidatePaintOffset(layoutObject); |
72 else | 72 else |
73 ASSERT(!displayItemList->paintOffsetWasInvalidated(layoutObject.disp
layItemClient()) || !displayItemList->clientCacheIsValid(layoutObject.displayIte
mClient())); | 73 ASSERT(!paintController->paintOffsetWasInvalidated(layoutObject.disp
layItemClient()) || !paintController->clientCacheIsValid(layoutObject.displayIte
mClient())); |
74 | 74 |
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 |