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/layout/line/InlineBox.h" | 9 #include "core/layout/line/InlineBox.h" |
10 #include "core/paint/PaintPhase.h" | 10 #include "core/paint/PaintPhase.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return DrawingRecorder::useCachedDrawingIfPossible(context, inlineBox, d
isplayItemType); | 46 return DrawingRecorder::useCachedDrawingIfPossible(context, inlineBox, d
isplayItemType); |
47 } | 47 } |
48 | 48 |
49 static bool useCachedDrawingIfPossible(GraphicsContext& context, const Inlin
eBox& inlineBox, PaintPhase phase, const LayoutPoint& paintOffset) | 49 static bool useCachedDrawingIfPossible(GraphicsContext& context, const Inlin
eBox& inlineBox, PaintPhase phase, const LayoutPoint& paintOffset) |
50 { | 50 { |
51 return useCachedDrawingIfPossible(context, inlineBox, DisplayItem::paint
PhaseToDrawingType(phase), paintOffset); | 51 return useCachedDrawingIfPossible(context, inlineBox, DisplayItem::paint
PhaseToDrawingType(phase), paintOffset); |
52 } | 52 } |
53 | 53 |
54 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const FloatRect& clip, const Layo
utPoint& paintOffset) | 54 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const FloatRect& clip, const Layo
utPoint& paintOffset) |
55 { | 55 { |
56 updatePaintOffsetIfNeeded(context.displayItemList(), layoutObject.displa
yItemClient(), paintOffset); | 56 updatePaintOffsetIfNeeded(context.displayItemList(), layoutObject, paint
Offset); |
57 // We may paint a delayed-invalidation object before it's actually inval
idated. | 57 // We may paint a delayed-invalidation object before it's actually inval
idated. |
58 if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelay
edFull) | 58 if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelay
edFull) |
59 m_cacheSkipper.emplace(context); | 59 m_cacheSkipper.emplace(context); |
60 m_drawingRecorder.emplace(context, layoutObject, displayItemType, clip); | 60 m_drawingRecorder.emplace(context, layoutObject, displayItemType, clip); |
61 } | 61 } |
62 | 62 |
63 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const LayoutRect& clip, const Lay
outPoint& paintOffset) | 63 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, DisplayItem::Type displayItemType, const LayoutRect& clip, const Lay
outPoint& paintOffset) |
64 : LayoutObjectDrawingRecorder(context, layoutObject, displayItemType, Fl
oatRect(clip), paintOffset) { } | 64 : LayoutObjectDrawingRecorder(context, layoutObject, displayItemType, Fl
oatRect(clip), paintOffset) { } |
65 | 65 |
66 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const FloatRect& clip, const LayoutPoint& paintOff
set) | 66 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const FloatRect& clip, const LayoutPoint& paintOff
set) |
67 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), clip, paintOffset) { } | 67 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), clip, paintOffset) { } |
68 | 68 |
69 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOf
fset) | 69 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOf
fset) |
70 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } | 70 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
71 | 71 |
72 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffse
t) | 72 LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& la
youtObject, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffse
t) |
73 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } | 73 : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintP
haseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
74 | 74 |
75 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoin
t& paintOffset) | 75 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoin
t& paintOffset) |
76 { | 76 { |
77 updatePaintOffsetIfNeeded(context.displayItemList(), inlineBox.displayIt
emClient(), paintOffset); | 77 updatePaintOffsetIfNeeded(context.displayItemList(), inlineBox, paintOff
set); |
78 m_drawingRecorder.emplace(context, inlineBox, displayItemType, clip); | 78 m_drawingRecorder.emplace(context, inlineBox, displayItemType, clip); |
79 } | 79 } |
80 | 80 |
81 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, DisplayItem::Type displayItemType, const LayoutRect& clip, const LayoutPoi
nt& paintOffset) | 81 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, DisplayItem::Type displayItemType, const LayoutRect& clip, const LayoutPoi
nt& paintOffset) |
82 : LayoutObjectDrawingRecorder(context, inlineBox, displayItemType, Float
Rect(clip), paintOffset) { } | 82 : LayoutObjectDrawingRecorder(context, inlineBox, displayItemType, Float
Rect(clip), paintOffset) { } |
83 | 83 |
84 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOffset) | 84 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOffset) |
85 : LayoutObjectDrawingRecorder(context, inlineBox, DisplayItem::paintPhas
eToDrawingType(phase), FloatRect(clip), paintOffset) { } | 85 : LayoutObjectDrawingRecorder(context, inlineBox, DisplayItem::paintPhas
eToDrawingType(phase), FloatRect(clip), paintOffset) { } |
86 | 86 |
87 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffset) | 87 LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlin
eBox, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffset) |
88 : LayoutObjectDrawingRecorder(context, inlineBox, DisplayItem::paintPhas
eToDrawingType(phase), FloatRect(clip), paintOffset) { } | 88 : LayoutObjectDrawingRecorder(context, inlineBox, DisplayItem::paintPhas
eToDrawingType(phase), FloatRect(clip), paintOffset) { } |
89 | 89 |
90 #if ENABLE(ASSERT) | 90 #if ENABLE(ASSERT) |
91 void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationC
heckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); } | 91 void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationC
heckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); } |
92 #endif | 92 #endif |
93 | 93 |
94 private: | 94 private: |
95 static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, Disp
layItemClient displayItemClient, const LayoutPoint& paintOffset) | 95 static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, cons
t DisplayItemClientWrapper& client, const LayoutPoint& paintOffset) |
96 { | 96 { |
97 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 97 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
98 return; | 98 return; |
99 | 99 |
100 // TODO(pdr): The paint offset cache should be stored on LayoutObject bu
t is temporarily on the DisplayItemList. | 100 // TODO(pdr): The paint offset cache should be stored on LayoutObject bu
t is temporarily on the DisplayItemList. |
101 if (!displayItemList->paintOffsetIsUnchanged(displayItemClient, paintOff
set)) { | 101 if (!displayItemList->paintOffsetIsUnchanged(client.displayItemClient(),
paintOffset)) { |
102 displayItemList->recordPaintOffset(displayItemClient, paintOffset); | 102 displayItemList->recordPaintOffset(client.displayItemClient(), paint
Offset); |
103 displayItemList->invalidatePaintOffset(displayItemClient); | 103 displayItemList->invalidatePaintOffset(client); |
104 } else { | 104 } else { |
105 ASSERT(!displayItemList->paintOffsetWasInvalidated(displayItemClient
) || !displayItemList->clientCacheIsValid(displayItemClient)); | 105 ASSERT(!displayItemList->paintOffsetWasInvalidated(client.displayIte
mClient()) || !displayItemList->clientCacheIsValid(client.displayItemClient())); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 Optional<DisplayItemCacheSkipper> m_cacheSkipper; | 109 Optional<DisplayItemCacheSkipper> m_cacheSkipper; |
110 Optional<DrawingRecorder> m_drawingRecorder; | 110 Optional<DrawingRecorder> m_drawingRecorder; |
111 }; | 111 }; |
112 | 112 |
113 } // namespace blink | 113 } // namespace blink |
114 | 114 |
115 #endif // LayoutObjectDrawingRecorder_h | 115 #endif // LayoutObjectDrawingRecorder_h |
OLD | NEW |