| 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 88564c1998ba2953560f23f7d4a073a71ebab6db..f62548131c1ca800f22e935852e95bfef583f61c 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
|
| @@ -114,7 +114,7 @@ PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer)
|
| m_scrollCorner(nullptr),
|
| m_resizer(nullptr),
|
| m_scrollAnchor(this),
|
| - m_reasons(0)
|
| + m_nonCompositedMainThreadScrollingReasons(0)
|
| #if DCHECK_IS_ON()
|
| ,
|
| m_hasBeenDisposed(false)
|
| @@ -152,7 +152,7 @@ void PaintLayerScrollableArea::dispose() {
|
| }
|
| }
|
|
|
| - removeStyleRelatedMainThreadScrollingReasons();
|
| + m_nonCompositedMainThreadScrollingReasons = 0;
|
|
|
| if (ScrollingCoordinator* scrollingCoordinator = getScrollingCoordinator())
|
| scrollingCoordinator->willDestroyScrollableArea(this);
|
| @@ -1773,6 +1773,7 @@ bool PaintLayerScrollableArea::shouldScrollOnMainThread() const {
|
| bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
|
| const LCDTextMode mode,
|
| const PaintLayer* layer) {
|
| + m_nonCompositedMainThreadScrollingReasons = 0;
|
| if (!layer->scrollsOverflow())
|
| return false;
|
|
|
| @@ -1787,14 +1788,14 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
|
| return false;
|
|
|
| bool needsCompositedScrolling = true;
|
| - uint32_t mainThreadScrollingReasons = 0;
|
|
|
| // TODO(flackr): Allow integer transforms as long as all of the ancestor
|
| // transforms are also integer.
|
| bool backgroundSupportsLCDText =
|
| RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() &&
|
| layer->layoutObject().style()->isStackingContext() &&
|
| - layer->backgroundPaintLocation(&mainThreadScrollingReasons) &
|
| + layer->backgroundPaintLocation(
|
| + &m_nonCompositedMainThreadScrollingReasons) &
|
| BackgroundPaintInScrollingContents &&
|
| layer->backgroundIsKnownToBeOpaqueInRect(
|
| toLayoutBox(layer->layoutObject()).paddingBoxRect()) &&
|
| @@ -1804,16 +1805,16 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
|
| !layer->compositor()->preferCompositingToLCDTextEnabled() &&
|
| !backgroundSupportsLCDText) {
|
| if (layer->compositesWithOpacity()) {
|
| - mainThreadScrollingReasons |=
|
| + m_nonCompositedMainThreadScrollingReasons |=
|
| MainThreadScrollingReason::kHasOpacityAndLCDText;
|
| }
|
| if (layer->compositesWithTransform()) {
|
| - mainThreadScrollingReasons |=
|
| + m_nonCompositedMainThreadScrollingReasons |=
|
| MainThreadScrollingReason::kHasTransformAndLCDText;
|
| }
|
| if (!layer->backgroundIsKnownToBeOpaqueInRect(
|
| toLayoutBox(layer->layoutObject()).paddingBoxRect())) {
|
| - mainThreadScrollingReasons |=
|
| + m_nonCompositedMainThreadScrollingReasons |=
|
| MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText;
|
| }
|
|
|
| @@ -1825,67 +1826,22 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
|
| // behind dashed borders). Resolve this case, or not, and update this check
|
| // with the results.
|
| if (layer->layoutObject().style()->hasBorderRadius()) {
|
| - mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius;
|
| + m_nonCompositedMainThreadScrollingReasons |=
|
| + MainThreadScrollingReason::kHasBorderRadius;
|
| needsCompositedScrolling = false;
|
| }
|
| if (layer->layoutObject().hasClip() || layer->hasDescendantWithClipPath() ||
|
| layer->hasAncestorWithClipPath()) {
|
| - mainThreadScrollingReasons |=
|
| + m_nonCompositedMainThreadScrollingReasons |=
|
| MainThreadScrollingReason::kHasClipRelatedProperty;
|
| needsCompositedScrolling = false;
|
| }
|
|
|
| - if (mainThreadScrollingReasons) {
|
| - addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons);
|
| - }
|
| -
|
| return needsCompositedScrolling;
|
| }
|
|
|
| -void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons(
|
| - const uint32_t reasons) {
|
| - LocalFrame* frame = box().frame();
|
| - if (!frame)
|
| - return;
|
| - FrameView* frameView = frame->view();
|
| - if (!frameView)
|
| - return;
|
| -
|
| - for (uint32_t reason = 1;
|
| - reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount;
|
| - reason <<= 1) {
|
| - if (reasons & reason) {
|
| - frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true);
|
| - m_reasons |= reason;
|
| - }
|
| - }
|
| -}
|
| -
|
| -void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() {
|
| - LocalFrame* frame = box().frame();
|
| - if (!frame)
|
| - return;
|
| - FrameView* frameView = frame->view();
|
| - if (!frameView)
|
| - return;
|
| -
|
| - // Decrease the number of layers that have any main thread
|
| - // scrolling reasons stored in FrameView
|
| - for (uint32_t i = 0;
|
| - i < MainThreadScrollingReason::kMainThreadScrollingReasonCount; ++i) {
|
| - uint32_t reason = 1 << i;
|
| - if (hasMainThreadScrollingReason(reason)) {
|
| - m_reasons &= ~reason;
|
| - frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, false);
|
| - }
|
| - }
|
| -}
|
| -
|
| void PaintLayerScrollableArea::updateNeedsCompositedScrolling(
|
| LCDTextMode mode) {
|
| - // Clear all style related main thread scrolling reasons, if any,
|
| - // before calling computeNeedsCompositedScrolling
|
| - removeStyleRelatedMainThreadScrollingReasons();
|
| const bool needsCompositedScrolling =
|
| computeNeedsCompositedScrolling(mode, layer());
|
|
|
|
|