Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1252)

Side by Side Diff: cc/input/main_thread_scrolling_reason.h

Issue 2085853003: cc: Make custom scrollbar scroll on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ 5 #ifndef CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_
6 #define CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ 6 #define CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_
7 7
8 namespace cc { 8 namespace cc {
9 9
10 // Ensure this stays in sync with MainThreadScrollingReason in histograms.xml. 10 // Ensure this stays in sync with MainThreadScrollingReason in histograms.xml.
11 // When adding a new MainThreadScrollingReason, make sure the corresponding 11 // When adding a new MainThreadScrollingReason, make sure the corresponding
12 // [MainThread/Compositor]CanSetScrollReasons function is also updated. 12 // [MainThread/Compositor]CanSetScrollReasons function is also updated.
13 struct MainThreadScrollingReason { 13 struct MainThreadScrollingReason {
14 // Non-transient scrolling reasons. 14 // Non-transient scrolling reasons.
15 enum : uint32_t { kNotScrollingOnMain = 0 }; 15 enum : uint32_t { kNotScrollingOnMain = 0 };
16 enum : uint32_t { kHasBackgroundAttachmentFixedObjects = 1 << 0 }; 16 enum : uint32_t { kHasBackgroundAttachmentFixedObjects = 1 << 0 };
17 enum : uint32_t { kHasNonLayerViewportConstrainedObjects = 1 << 1 }; 17 enum : uint32_t { kHasNonLayerViewportConstrainedObjects = 1 << 1 };
18 enum : uint32_t { kThreadedScrollingDisabled = 1 << 2 }; 18 enum : uint32_t { kThreadedScrollingDisabled = 1 << 2 };
19 enum : uint32_t { kScrollbarScrolling = 1 << 3 }; 19 enum : uint32_t { kScrollbarScrolling = 1 << 3 };
20 enum : uint32_t { kPageOverlay = 1 << 4 }; 20 enum : uint32_t { kPageOverlay = 1 << 4 };
21 enum : uint32_t { kAnimatingScrollOnMainThread = 1 << 13 }; 21 enum : uint32_t { kAnimatingScrollOnMainThread = 1 << 13 };
22 enum : uint32_t { kHasStickyPositionObjects = 1 << 14 }; 22 enum : uint32_t { kHasStickyPositionObjects = 1 << 14 };
23 enum : uint32_t { kCustomScrollbarScrolling = 1 << 15 };
23 24
24 // Transient scrolling reasons. These are computed for each scroll begin. 25 // Transient scrolling reasons. These are computed for each scroll begin.
25 enum : uint32_t { kNonFastScrollableRegion = 1 << 5 }; 26 enum : uint32_t { kNonFastScrollableRegion = 1 << 5 };
26 enum : uint32_t { kEventHandlers = 1 << 6 }; 27 enum : uint32_t { kEventHandlers = 1 << 6 };
27 enum : uint32_t { kFailedHitTest = 1 << 7 }; 28 enum : uint32_t { kFailedHitTest = 1 << 7 };
28 enum : uint32_t { kNoScrollingLayer = 1 << 8 }; 29 enum : uint32_t { kNoScrollingLayer = 1 << 8 };
29 enum : uint32_t { kNotScrollable = 1 << 9 }; 30 enum : uint32_t { kNotScrollable = 1 << 9 };
30 enum : uint32_t { kContinuingMainThreadScroll = 1 << 10 }; 31 enum : uint32_t { kContinuingMainThreadScroll = 1 << 10 };
31 enum : uint32_t { kNonInvertibleTransform = 1 << 11 }; 32 enum : uint32_t { kNonInvertibleTransform = 1 << 11 };
32 enum : uint32_t { kPageBasedScrolling = 1 << 12 }; 33 enum : uint32_t { kPageBasedScrolling = 1 << 12 };
33 34
34 // The number of flags in this struct (excluding itself). 35 // The number of flags in this struct (excluding itself).
35 enum : uint32_t { kMainThreadScrollingReasonCount = 16 }; 36 enum : uint32_t { kMainThreadScrollingReasonCount = 17 };
36 37
37 // Returns true if the given MainThreadScrollingReason can be set by the main 38 // Returns true if the given MainThreadScrollingReason can be set by the main
38 // thread. 39 // thread.
39 static bool MainThreadCanSetScrollReasons(uint32_t reasons) { 40 static bool MainThreadCanSetScrollReasons(uint32_t reasons) {
40 uint32_t reasons_set_by_main_thread = 41 uint32_t reasons_set_by_main_thread =
41 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | 42 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects |
42 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | 43 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled |
43 kScrollbarScrolling | kPageOverlay | kAnimatingScrollOnMainThread | 44 kScrollbarScrolling | kPageOverlay | kAnimatingScrollOnMainThread |
44 kHasStickyPositionObjects; 45 kHasStickyPositionObjects | kCustomScrollbarScrolling;
ajuma 2016/06/22 14:41:41 Would it make sense to just reuse kScrollbarScroll
45 return (reasons & reasons_set_by_main_thread) == reasons; 46 return (reasons & reasons_set_by_main_thread) == reasons;
46 } 47 }
47 48
48 // Returns true if the given MainThreadScrollingReason can be set by the 49 // Returns true if the given MainThreadScrollingReason can be set by the
49 // compositor. 50 // compositor.
50 static bool CompositorCanSetScrollReasons(uint32_t reasons) { 51 static bool CompositorCanSetScrollReasons(uint32_t reasons) {
51 uint32_t reasons_set_by_compositor = 52 uint32_t reasons_set_by_compositor =
52 kNonFastScrollableRegion | kEventHandlers | kFailedHitTest | 53 kNonFastScrollableRegion | kEventHandlers | kFailedHitTest |
53 kNoScrollingLayer | kNotScrollable | kContinuingMainThreadScroll | 54 kNoScrollingLayer | kNotScrollable | kContinuingMainThreadScroll |
54 kNonInvertibleTransform | kPageBasedScrolling; 55 kNonInvertibleTransform | kPageBasedScrolling;
55 return (reasons & reasons_set_by_compositor) == reasons; 56 return (reasons & reasons_set_by_compositor) == reasons;
56 } 57 }
57 }; 58 };
58 59
59 } // namespace cc 60 } // namespace cc
60 61
61 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ 62 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698