OLD | NEW |
---|---|
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 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 // These *AndLCDText reasons are due to subpixel text rendering which can | 37 // These *AndLCDText reasons are due to subpixel text rendering which can |
38 // only be applied by blending glyphs with the background at a specific | 38 // only be applied by blending glyphs with the background at a specific |
39 // screen position; transparency and transforms break this. | 39 // screen position; transparency and transforms break this. |
40 kNonCompositedReasonsFirst = 16, | 40 kNonCompositedReasonsFirst = 16, |
41 kHasOpacityAndLCDText = 1 << 16, | 41 kHasOpacityAndLCDText = 1 << 16, |
42 kHasTransformAndLCDText = 1 << 17, | 42 kHasTransformAndLCDText = 1 << 17, |
43 kBackgroundNotOpaqueInRectAndLCDText = 1 << 18, | 43 kBackgroundNotOpaqueInRectAndLCDText = 1 << 18, |
44 kHasBorderRadius = 1 << 19, | 44 kHasBorderRadius = 1 << 19, |
45 kHasClipRelatedProperty = 1 << 20, | 45 kHasClipRelatedProperty = 1 << 20, |
46 kHasBoxShadowFromNonRootLayer = 1 << 21, | 46 kHasBoxShadowFromNonRootLayer = 1 << 21, |
47 kNonCompositedReasonsLast = 21, | 47 kIsNotStackingContextAndLCDText = 1 << 22, |
48 kHasOverflowClipAndLCDText = 1 << 23, | |
bokan
2017/04/25 18:04:15
I think this name should be more specific - having
yigu
2017/04/26 15:38:36
Updated. It also requires that the layout object's
| |
49 kNonCompositedReasonsLast = 23, | |
48 | 50 |
49 // Transient scrolling reasons. These are computed for each scroll begin. | 51 // Transient scrolling reasons. These are computed for each scroll begin. |
50 kNonFastScrollableRegion = 1 << 5, | 52 kNonFastScrollableRegion = 1 << 5, |
51 kFailedHitTest = 1 << 7, | 53 kFailedHitTest = 1 << 7, |
52 kNoScrollingLayer = 1 << 8, | 54 kNoScrollingLayer = 1 << 8, |
53 kNotScrollable = 1 << 9, | 55 kNotScrollable = 1 << 9, |
54 kContinuingMainThreadScroll = 1 << 10, | 56 kContinuingMainThreadScroll = 1 << 10, |
55 kNonInvertibleTransform = 1 << 11, | 57 kNonInvertibleTransform = 1 << 11, |
56 kPageBasedScrolling = 1 << 12, | 58 kPageBasedScrolling = 1 << 12, |
57 | 59 |
58 // The maximum number of flags in this struct (excluding itself). | 60 // The maximum number of flags in this struct (excluding itself). |
59 // New flags should increment this number but it should never be decremented | 61 // New flags should increment this number but it should never be decremented |
60 // because the values are used in UMA histograms. It should also be noted | 62 // because the values are used in UMA histograms. It should also be noted |
61 // that it excludes the kNotScrollingOnMain value. | 63 // that it excludes the kNotScrollingOnMain value. |
62 kMainThreadScrollingReasonCount = 22, | 64 kMainThreadScrollingReasonCount = 24, |
63 }; | 65 }; |
64 | 66 |
65 static const uint32_t kNonCompositedReasons = | 67 static const uint32_t kNonCompositedReasons = |
66 kHasOpacityAndLCDText | kHasTransformAndLCDText | | 68 kHasOpacityAndLCDText | kHasTransformAndLCDText | |
67 kBackgroundNotOpaqueInRectAndLCDText | kHasBorderRadius | | 69 kBackgroundNotOpaqueInRectAndLCDText | kHasBorderRadius | |
68 kHasClipRelatedProperty | kHasBoxShadowFromNonRootLayer; | 70 kHasClipRelatedProperty | kHasBoxShadowFromNonRootLayer | |
71 kIsNotStackingContextAndLCDText | kHasOverflowClipAndLCDText; | |
69 | 72 |
70 // Returns true if the given MainThreadScrollingReason can be set by the main | 73 // Returns true if the given MainThreadScrollingReason can be set by the main |
71 // thread. | 74 // thread. |
72 static bool MainThreadCanSetScrollReasons(uint32_t reasons) { | 75 static bool MainThreadCanSetScrollReasons(uint32_t reasons) { |
73 uint32_t reasons_set_by_main_thread = | 76 uint32_t reasons_set_by_main_thread = |
74 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | | 77 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | |
75 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | | 78 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | |
76 kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | | 79 kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | |
77 kCustomScrollbarScrolling; | 80 kCustomScrollbarScrolling; |
78 return (reasons & reasons_set_by_main_thread) == reasons; | 81 return (reasons & reasons_set_by_main_thread) == reasons; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText) { | 136 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText) { |
134 tracedValue->AppendString( | 137 tracedValue->AppendString( |
135 "Background is not opaque in rect and LCD text"); | 138 "Background is not opaque in rect and LCD text"); |
136 } | 139 } |
137 if (reasons & MainThreadScrollingReason::kHasBorderRadius) | 140 if (reasons & MainThreadScrollingReason::kHasBorderRadius) |
138 tracedValue->AppendString("Has border radius"); | 141 tracedValue->AppendString("Has border radius"); |
139 if (reasons & MainThreadScrollingReason::kHasClipRelatedProperty) | 142 if (reasons & MainThreadScrollingReason::kHasClipRelatedProperty) |
140 tracedValue->AppendString("Has clip related property"); | 143 tracedValue->AppendString("Has clip related property"); |
141 if (reasons & MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer) | 144 if (reasons & MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer) |
142 tracedValue->AppendString("Has box shadow from non-root layer"); | 145 tracedValue->AppendString("Has box shadow from non-root layer"); |
146 if (reasons & MainThreadScrollingReason::kIsNotStackingContextAndLCDText) | |
147 tracedValue->AppendString("Is not stacking context and LCD text"); | |
148 if (reasons & MainThreadScrollingReason::kHasOverflowClipAndLCDText) | |
149 tracedValue->AppendString("Has overflow clip and LCD text"); | |
143 | 150 |
144 // Transient scrolling reasons. | 151 // Transient scrolling reasons. |
145 if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion) | 152 if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion) |
146 tracedValue->AppendString("Non fast scrollable region"); | 153 tracedValue->AppendString("Non fast scrollable region"); |
147 if (reasons & MainThreadScrollingReason::kFailedHitTest) | 154 if (reasons & MainThreadScrollingReason::kFailedHitTest) |
148 tracedValue->AppendString("Failed hit test"); | 155 tracedValue->AppendString("Failed hit test"); |
149 if (reasons & MainThreadScrollingReason::kNoScrollingLayer) | 156 if (reasons & MainThreadScrollingReason::kNoScrollingLayer) |
150 tracedValue->AppendString("No scrolling layer"); | 157 tracedValue->AppendString("No scrolling layer"); |
151 if (reasons & MainThreadScrollingReason::kNotScrollable) | 158 if (reasons & MainThreadScrollingReason::kNotScrollable) |
152 tracedValue->AppendString("Not scrollable"); | 159 tracedValue->AppendString("Not scrollable"); |
153 if (reasons & MainThreadScrollingReason::kContinuingMainThreadScroll) | 160 if (reasons & MainThreadScrollingReason::kContinuingMainThreadScroll) |
154 tracedValue->AppendString("Continuing main thread scroll"); | 161 tracedValue->AppendString("Continuing main thread scroll"); |
155 if (reasons & MainThreadScrollingReason::kNonInvertibleTransform) | 162 if (reasons & MainThreadScrollingReason::kNonInvertibleTransform) |
156 tracedValue->AppendString("Non-invertible transform"); | 163 tracedValue->AppendString("Non-invertible transform"); |
157 if (reasons & MainThreadScrollingReason::kPageBasedScrolling) | 164 if (reasons & MainThreadScrollingReason::kPageBasedScrolling) |
158 tracedValue->AppendString("Page-based scrolling"); | 165 tracedValue->AppendString("Page-based scrolling"); |
159 tracedValue->EndArray(); | 166 tracedValue->EndArray(); |
160 } | 167 } |
161 }; | 168 }; |
162 | 169 |
163 } // namespace cc | 170 } // namespace cc |
164 | 171 |
165 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ | 172 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ |
OLD | NEW |