Chromium Code Reviews| Index: cc/input/main_thread_scrolling_reason.h |
| diff --git a/cc/input/main_thread_scrolling_reason.h b/cc/input/main_thread_scrolling_reason.h |
| index 9746d9425740d96ff63e52707b498f08b4878d80..5e0a66177772192f32d02b514fec49af8df8201d 100644 |
| --- a/cc/input/main_thread_scrolling_reason.h |
| +++ b/cc/input/main_thread_scrolling_reason.h |
| @@ -37,12 +37,14 @@ struct MainThreadScrollingReason { |
| // These *AndLCDText reasons are due to subpixel text rendering which can |
| // only be applied by blending glyphs with the background at a specific |
| // screen position; transparency and transforms break this. |
| + kNonCompositedReasonsFirst = 16, |
| kHasOpacityAndLCDText = 1 << 16, |
| kHasTransformAndLCDText = 1 << 17, |
| kBackgroundNotOpaqueInRectAndLCDText = 1 << 18, |
| kHasBorderRadius = 1 << 19, |
| kHasClipRelatedProperty = 1 << 20, |
| kHasBoxShadowFromNonRootLayer = 1 << 21, |
| + kNonCompositedReasonsLast = 21, |
| // Transient scrolling reasons. These are computed for each scroll begin. |
| kNonFastScrollableRegion = 1 << 5, |
| @@ -67,10 +69,7 @@ struct MainThreadScrollingReason { |
| kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | |
| kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | |
| kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | |
| - kCustomScrollbarScrolling | kHasOpacityAndLCDText | |
| - kHasTransformAndLCDText | kBackgroundNotOpaqueInRectAndLCDText | |
| - kHasBorderRadius | kHasClipRelatedProperty | |
| - kHasBoxShadowFromNonRootLayer; |
| + kCustomScrollbarScrolling; |
| return (reasons & reasons_set_by_main_thread) == reasons; |
| } |
| @@ -84,6 +83,16 @@ struct MainThreadScrollingReason { |
| return (reasons & reasons_set_by_compositor) == reasons; |
| } |
| + // Returns true if there are any reasons that prevented the scroller |
| + // from being composited. |
| + static bool HasNonCompositedScrollReasons(uint32_t reasons) { |
| + uint32_t non_composited_reasons = |
| + kHasOpacityAndLCDText | kHasTransformAndLCDText | |
| + kBackgroundNotOpaqueInRectAndLCDText | kHasBorderRadius | |
| + kHasClipRelatedProperty | kHasBoxShadowFromNonRootLayer; |
|
tdresser
2017/04/11 18:50:47
Can we just do some math with the first & last val
yigu
2017/04/11 21:28:10
As discussed, introducing other logic doesn't bene
|
| + return (reasons & non_composited_reasons) != 0; |
| + } |
| + |
| static std::string mainThreadScrollingReasonsAsText(uint32_t reasons) { |
| base::trace_event::TracedValue tracedValue; |
| mainThreadScrollingReasonsAsTracedValue(reasons, &tracedValue); |
| @@ -148,20 +157,6 @@ struct MainThreadScrollingReason { |
| tracedValue->AppendString("Page-based scrolling"); |
| tracedValue->EndArray(); |
| } |
| - |
| - // For a given reason, return its index in enum |
| - static int getReasonIndex(uint32_t reason) { |
| - // Multiple reasons provided |
| - if (reason & (reason - 1)) |
| - return -1; |
| - |
| - int index = -1; |
| - while (reason > 0) { |
| - reason = reason >> 1; |
| - ++index; |
| - } |
| - return index; |
| - } |
| }; |
| } // namespace cc |