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
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_INVALIDATION_REASON_H_
6 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_INVALIDATION_REASON_H_
7 
8 #include <iosfwd>
9 #include "third_party/blink/renderer/platform/platform_export.h"
10 #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
11 
12 namespace blink {
13 
14 enum class PaintInvalidationReason : uint8_t {
15   kNone,
16   kIncremental,
17   kRectangle,
18   kSelection,
19   // Hit test changes do not require raster invalidation.
20   kHitTest,
21   // The following reasons will all cause full paint invalidation.
22   // Any unspecified reason of full invalidation.
23   kFull,
24   kStyle,
25   // Layout or visual geometry change.
26   kBackplate,
27   kGeometry,
28   kCompositing,
29   kAppeared,
30   kDisappeared,
31   kScroll,
32   // Scroll bars, scroll corner, etc.
33   kScrollControl,
34   kOutline,
35   // The object is invalidated as a part of a subtree full invalidation (forced
36   // by LayoutObject::SetSubtreeShouldDoFullPaintInvalidation()).
37   kSubtree,
38   kSVGResource,
39   kBackground,
40   kCaret,
41   kDocumentMarker,
42   kImage,
43   kUncacheable,
44   // The initial PaintInvalidationReason of a DisplayItemClient.
45   kJustCreated,
46   kReordered,
47   kChunkAppeared,
48   kChunkDisappeared,
49   kChunkUncacheable,
50   kChunkReordered,
51   kPaintProperty,
52   // For tracking of direct raster invalidation of full composited layers. The
53   // invalidation may be implicit, e.g. when a layer is created.
54   kFullLayer,
55   kForTesting,
56   kMax = kForTesting,
57 };
58 
59 PLATFORM_EXPORT const char* PaintInvalidationReasonToString(
60     PaintInvalidationReason);
61 
IsFullPaintInvalidationReason(PaintInvalidationReason reason)62 inline bool IsFullPaintInvalidationReason(PaintInvalidationReason reason) {
63   return reason >= PaintInvalidationReason::kFull;
64 }
65 
66 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&,
67                                          PaintInvalidationReason);
68 
69 }  // namespace blink
70 
71 #endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_INVALIDATION_REASON_H_
72