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..526e31f3803ef5004c744e5acbe64df962087aa3 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,19 @@ struct MainThreadScrollingReason { |
| return (reasons & reasons_set_by_compositor) == reasons; |
| } |
| + // Usually a scroller won't be composited with the following reasons |
| + // unless we force the promotion. e.g. Apply will-change:transform. |
|
bokan
2017/04/06 21:45:09
I would remove the first two lines. To me it impli
yigu
2017/04/07 16:35:32
Done.
|
| + // Returns true if the MainThreadScrollingReason is one of the follow |
| + // reasons that prevented a scroller from being composited. |
| + static bool NonCompositedScrollReasons(uint32_t reasons) { |
| + uint32_t non_composited_reasons = |
| + kHasOpacityAndLCDText | kHasTransformAndLCDText | |
| + kBackgroundNotOpaqueInRectAndLCDText | kHasBorderRadius | |
| + kHasClipRelatedProperty | kHasBoxShadowFromNonRootLayer; |
| + return reasons && |
| + (non_composited_reasons == (reasons | non_composited_reasons)); |
| + } |
| + |
| static std::string mainThreadScrollingReasonsAsText(uint32_t reasons) { |
| base::trace_event::TracedValue tracedValue; |
| mainThreadScrollingReasonsAsTracedValue(reasons, &tracedValue); |
| @@ -148,20 +160,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 |