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 kHasOverflowClipAndLayoutObjectBackgroundNotOpaqueAndLCDText = 1 << 23, | |
bokan
2017/04/26 15:52:15
I'd just call it kHasOverflowClipNotOpaqueAndLCDTe
yigu
2017/04/27 15:28:27
We have another BackgroundNotOpaque used for Paint
bokan
2017/04/27 15:40:31
But the difference between the two is that this re
flackr
2017/04/27 18:42:35
I thought all of these were reasons not to promote
yigu
2017/04/28 14:46:05
This reason has been removed from this patch.
| |
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 | | |
72 kHasOverflowClipAndLayoutObjectBackgroundNotOpaqueAndLCDText; | |
69 | 73 |
70 // Returns true if the given MainThreadScrollingReason can be set by the main | 74 // Returns true if the given MainThreadScrollingReason can be set by the main |
71 // thread. | 75 // thread. |
72 static bool MainThreadCanSetScrollReasons(uint32_t reasons) { | 76 static bool MainThreadCanSetScrollReasons(uint32_t reasons) { |
73 uint32_t reasons_set_by_main_thread = | 77 uint32_t reasons_set_by_main_thread = |
74 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | | 78 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | |
75 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | | 79 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | |
76 kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | | 80 kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | |
77 kCustomScrollbarScrolling; | 81 kCustomScrollbarScrolling; |
78 return (reasons & reasons_set_by_main_thread) == reasons; | 82 return (reasons & reasons_set_by_main_thread) == reasons; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText) { | 137 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText) { |
134 tracedValue->AppendString( | 138 tracedValue->AppendString( |
135 "Background is not opaque in rect and LCD text"); | 139 "Background is not opaque in rect and LCD text"); |
136 } | 140 } |
137 if (reasons & MainThreadScrollingReason::kHasBorderRadius) | 141 if (reasons & MainThreadScrollingReason::kHasBorderRadius) |
138 tracedValue->AppendString("Has border radius"); | 142 tracedValue->AppendString("Has border radius"); |
139 if (reasons & MainThreadScrollingReason::kHasClipRelatedProperty) | 143 if (reasons & MainThreadScrollingReason::kHasClipRelatedProperty) |
140 tracedValue->AppendString("Has clip related property"); | 144 tracedValue->AppendString("Has clip related property"); |
141 if (reasons & MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer) | 145 if (reasons & MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer) |
142 tracedValue->AppendString("Has box shadow from non-root layer"); | 146 tracedValue->AppendString("Has box shadow from non-root layer"); |
147 if (reasons & MainThreadScrollingReason::kIsNotStackingContextAndLCDText) | |
148 tracedValue->AppendString("Is not stacking context and LCD text"); | |
149 if (reasons & | |
150 MainThreadScrollingReason:: | |
151 kHasOverflowClipAndLayoutObjectBackgroundNotOpaqueAndLCDText) | |
152 tracedValue->AppendString( | |
153 "Has overflow clip and layout object background not opaque and LCD " | |
154 "text"); | |
143 | 155 |
144 // Transient scrolling reasons. | 156 // Transient scrolling reasons. |
145 if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion) | 157 if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion) |
146 tracedValue->AppendString("Non fast scrollable region"); | 158 tracedValue->AppendString("Non fast scrollable region"); |
147 if (reasons & MainThreadScrollingReason::kFailedHitTest) | 159 if (reasons & MainThreadScrollingReason::kFailedHitTest) |
148 tracedValue->AppendString("Failed hit test"); | 160 tracedValue->AppendString("Failed hit test"); |
149 if (reasons & MainThreadScrollingReason::kNoScrollingLayer) | 161 if (reasons & MainThreadScrollingReason::kNoScrollingLayer) |
150 tracedValue->AppendString("No scrolling layer"); | 162 tracedValue->AppendString("No scrolling layer"); |
151 if (reasons & MainThreadScrollingReason::kNotScrollable) | 163 if (reasons & MainThreadScrollingReason::kNotScrollable) |
152 tracedValue->AppendString("Not scrollable"); | 164 tracedValue->AppendString("Not scrollable"); |
153 if (reasons & MainThreadScrollingReason::kContinuingMainThreadScroll) | 165 if (reasons & MainThreadScrollingReason::kContinuingMainThreadScroll) |
154 tracedValue->AppendString("Continuing main thread scroll"); | 166 tracedValue->AppendString("Continuing main thread scroll"); |
155 if (reasons & MainThreadScrollingReason::kNonInvertibleTransform) | 167 if (reasons & MainThreadScrollingReason::kNonInvertibleTransform) |
156 tracedValue->AppendString("Non-invertible transform"); | 168 tracedValue->AppendString("Non-invertible transform"); |
157 if (reasons & MainThreadScrollingReason::kPageBasedScrolling) | 169 if (reasons & MainThreadScrollingReason::kPageBasedScrolling) |
158 tracedValue->AppendString("Page-based scrolling"); | 170 tracedValue->AppendString("Page-based scrolling"); |
159 tracedValue->EndArray(); | 171 tracedValue->EndArray(); |
160 } | 172 } |
161 }; | 173 }; |
162 | 174 |
163 } // namespace cc | 175 } // namespace cc |
164 | 176 |
165 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ | 177 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ |
OLD | NEW |