| OLD | NEW |
| (Empty) |
| 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 ClipRectsCache_h | |
| 6 #define ClipRectsCache_h | |
| 7 | |
| 8 #include "core/layout/ClipRects.h" | |
| 9 | |
| 10 #if DCHECK_IS_ON() | |
| 11 #include "platform/scroll/ScrollTypes.h" // For OverlayScrollbarClipBehavior. | |
| 12 #endif | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class PaintLayer; | |
| 17 | |
| 18 enum ClipRectsCacheSlot { | |
| 19 // Relative to the ancestor treated as the root (e.g. transformed layer). | |
| 20 // Used for hit testing. | |
| 21 RootRelativeClipRects, | |
| 22 RootRelativeClipRectsIgnoringViewportClip, | |
| 23 | |
| 24 // Relative to the LayoutView's layer. Used for compositing overlap testing. | |
| 25 AbsoluteClipRects, | |
| 26 | |
| 27 // Relative to painting ancestor. Used for painting. | |
| 28 PaintingClipRects, | |
| 29 PaintingClipRectsIgnoringOverflowClip, | |
| 30 | |
| 31 NumberOfClipRectsCacheSlots, | |
| 32 UncachedClipRects, | |
| 33 }; | |
| 34 | |
| 35 class ClipRectsCache { | |
| 36 USING_FAST_MALLOC(ClipRectsCache); | |
| 37 | |
| 38 public: | |
| 39 struct Entry { | |
| 40 Entry() | |
| 41 : root(nullptr) | |
| 42 #if DCHECK_IS_ON() | |
| 43 , | |
| 44 overlayScrollbarClipBehavior(IgnoreOverlayScrollbarSize) | |
| 45 #endif | |
| 46 { | |
| 47 } | |
| 48 const PaintLayer* root; | |
| 49 RefPtr<ClipRects> clipRects; | |
| 50 #if DCHECK_IS_ON() | |
| 51 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior; | |
| 52 #endif | |
| 53 }; | |
| 54 Entry& get(ClipRectsCacheSlot slot) { | |
| 55 DCHECK(slot < NumberOfClipRectsCacheSlots); | |
| 56 return m_entries[slot]; | |
| 57 } | |
| 58 void clear(ClipRectsCacheSlot slot) { | |
| 59 DCHECK(slot < NumberOfClipRectsCacheSlots); | |
| 60 m_entries[slot] = Entry(); | |
| 61 } | |
| 62 | |
| 63 private: | |
| 64 Entry m_entries[NumberOfClipRectsCacheSlots]; | |
| 65 }; | |
| 66 | |
| 67 } // namespace blink | |
| 68 | |
| 69 #endif // ClipRectsCache_h | |
| OLD | NEW |