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.
5 #ifndef ClipRectsCache_h
6 #define ClipRectsCache_h
8 #include "core/layout/ClipRects.h"
11 #include "core/layout/LayoutBox.h" // For OverlayScrollbarSizeRelevancy.
16 class DeprecatedPaintLayer
;
18 enum ClipRectsCacheSlot
{
19 // Relative to the ancestor treated as the root (e.g. transformed layer). Used for hit testing.
20 RootRelativeClipRects
,
21 RootRelativeClipRectsIgnoringViewportClip
,
23 // Relative to the LayoutView's layer. Used for compositing overlap testing.
26 // Relative to painting ancestor. Used for painting.
28 PaintingClipRectsIgnoringOverflowClip
,
30 NumberOfClipRectsCacheSlots
,
34 class ClipRectsCache
{
35 WTF_MAKE_FAST_ALLOCATED(ClipRectsCache
);
41 , scrollbarRelevancy(IgnoreOverlayScrollbarSize
)
45 const DeprecatedPaintLayer
* root
;
46 RefPtr
<ClipRects
> clipRects
;
48 OverlayScrollbarSizeRelevancy scrollbarRelevancy
;
51 Entry
& get(ClipRectsCacheSlot slot
)
53 ASSERT(slot
< NumberOfClipRectsCacheSlots
);
54 return m_entries
[slot
];
56 void clear(ClipRectsCacheSlot slot
)
58 ASSERT(slot
< NumberOfClipRectsCacheSlots
);
59 m_entries
[slot
] = Entry();
62 Entry m_entries
[NumberOfClipRectsCacheSlots
];
67 #endif // ClipRectsCache_h