Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| index 58f4ef34c8fafea1ed661c7ab4a9986c04be3bba..869ac38ec914728c5fab0d2e3f4efee664f6f11e 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| @@ -1756,6 +1756,9 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling( |
| return false; |
| bool needsCompositedScrolling = true; |
| + uint32_t mainThreadScrollingReasons = 0; |
| + uint32_t* mainThreadScrollingReasonsDueToBackgroundPaintLocation = |
|
bokan
2017/01/23 19:55:51
Why keep this separate variable? Just pass mainThr
yigu
2017/01/23 20:21:23
Done.
|
| + &mainThreadScrollingReasons; |
| // TODO(flackr): Allow integer transforms as long as all of the ancestor |
| // transforms are also integer. |
| @@ -1771,18 +1774,23 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling( |
| !layer->compositor()->preferCompositingToLCDTextEnabled() && |
| !backgroundSupportsLCDText) { |
| if (layer->compositesWithOpacity()) { |
| - addStyleRelatedMainThreadScrollingReasons( |
| - MainThreadScrollingReason::kHasOpacityAndLCDText); |
| + mainThreadScrollingReasons |= |
| + MainThreadScrollingReason::kHasOpacityAndLCDText; |
| } |
| if (layer->compositesWithTransform()) { |
| - addStyleRelatedMainThreadScrollingReasons( |
| - MainThreadScrollingReason::kHasTransformAndLCDText); |
| + mainThreadScrollingReasons |= |
| + MainThreadScrollingReason::kHasTransformAndLCDText; |
| } |
| if (!layer->backgroundIsKnownToBeOpaqueInRect( |
| toLayoutBox(layer->layoutObject())->paddingBoxRect())) { |
| - addStyleRelatedMainThreadScrollingReasons( |
| - MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); |
| + mainThreadScrollingReasons |= |
| + MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; |
| } |
| + if (layer->backgroundPaintLocation() & BackgroundPaintInGraphicsLayer) { |
| + layer->layoutObject()->backgroundPaintLocation( |
| + mainThreadScrollingReasonsDueToBackgroundPaintLocation); |
| + } |
| + |
| needsCompositedScrolling = false; |
| } |
| @@ -1791,16 +1799,27 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling( |
| // behind dashed borders). Resolve this case, or not, and update this check |
| // with the results. |
| if (layer->layoutObject()->style()->hasBorderRadius()) { |
| - addStyleRelatedMainThreadScrollingReasons( |
| - MainThreadScrollingReason::kHasBorderRadius); |
| + mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius; |
| needsCompositedScrolling = false; |
| } |
| if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || |
| layer->hasAncestorWithClipPath()) { |
| - addStyleRelatedMainThreadScrollingReasons( |
| - MainThreadScrollingReason::kHasClipRelatedProperty); |
| + mainThreadScrollingReasons |= |
| + MainThreadScrollingReason::kHasClipRelatedProperty; |
| needsCompositedScrolling = false; |
| } |
| + |
| + if (mainThreadScrollingReasons) { |
| + for (uint32_t reason = 1; |
|
bokan
2017/01/23 19:55:51
Just fold this loop into addStyleRelatedMainThread
yigu
2017/01/23 20:21:23
Done.
|
| + reason < |
| + 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount; |
| + reason <<= 1) { |
| + if (mainThreadScrollingReasons & reason) { |
| + addStyleRelatedMainThreadScrollingReasons(reason); |
| + } |
| + } |
| + } |
| + |
| return needsCompositedScrolling; |
| } |