| 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 638fee9b21f556ec1fbc90022b7def3c8a49bb28..3eda3a9d35244eb7b1a9b8b71c857b8e5156560d 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)
|
| scroll_corner_(nullptr),
|
| resizer_(nullptr),
|
| scroll_anchor_(this),
|
| - reasons_(0)
|
| + non_composited_main_thread_scrolling_reasons_(0)
|
| #if DCHECK_IS_ON()
|
| ,
|
| has_been_disposed_(false)
|
| @@ -152,7 +152,7 @@ void PaintLayerScrollableArea::Dispose() {
|
| }
|
| }
|
|
|
| - RemoveStyleRelatedMainThreadScrollingReasons();
|
| + non_composited_main_thread_scrolling_reasons_ = 0;
|
|
|
| if (ScrollingCoordinator* scrolling_coordinator = GetScrollingCoordinator())
|
| scrolling_coordinator->WillDestroyScrollableArea(this);
|
| @@ -1796,6 +1796,7 @@ bool PaintLayerScrollableArea::ShouldScrollOnMainThread() const {
|
| bool PaintLayerScrollableArea::ComputeNeedsCompositedScrolling(
|
| const LCDTextMode mode,
|
| const PaintLayer* layer) {
|
| + non_composited_main_thread_scrolling_reasons_ = 0;
|
| if (!layer->ScrollsOverflow())
|
| return false;
|
|
|
| @@ -1810,14 +1811,14 @@ bool PaintLayerScrollableArea::ComputeNeedsCompositedScrolling(
|
| return false;
|
|
|
| bool needs_composited_scrolling = true;
|
| - uint32_t main_thread_scrolling_reasons = 0;
|
|
|
| // TODO(flackr): Allow integer transforms as long as all of the ancestor
|
| // transforms are also integer.
|
| bool background_supports_lcd_text =
|
| RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() &&
|
| layer->GetLayoutObject().Style()->IsStackingContext() &&
|
| - layer->GetBackgroundPaintLocation(&main_thread_scrolling_reasons) &
|
| + layer->GetBackgroundPaintLocation(
|
| + &non_composited_main_thread_scrolling_reasons_) &
|
| kBackgroundPaintInScrollingContents &&
|
| layer->BackgroundIsKnownToBeOpaqueInRect(
|
| ToLayoutBox(layer->GetLayoutObject()).PaddingBoxRect()) &&
|
| @@ -1827,16 +1828,16 @@ bool PaintLayerScrollableArea::ComputeNeedsCompositedScrolling(
|
| !layer->Compositor()->PreferCompositingToLCDTextEnabled() &&
|
| !background_supports_lcd_text) {
|
| if (layer->CompositesWithOpacity()) {
|
| - main_thread_scrolling_reasons |=
|
| + non_composited_main_thread_scrolling_reasons_ |=
|
| MainThreadScrollingReason::kHasOpacityAndLCDText;
|
| }
|
| if (layer->CompositesWithTransform()) {
|
| - main_thread_scrolling_reasons |=
|
| + non_composited_main_thread_scrolling_reasons_ |=
|
| MainThreadScrollingReason::kHasTransformAndLCDText;
|
| }
|
| if (!layer->BackgroundIsKnownToBeOpaqueInRect(
|
| ToLayoutBox(layer->GetLayoutObject()).PaddingBoxRect())) {
|
| - main_thread_scrolling_reasons |=
|
| + non_composited_main_thread_scrolling_reasons_ |=
|
| MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText;
|
| }
|
|
|
| @@ -1848,68 +1849,24 @@ bool PaintLayerScrollableArea::ComputeNeedsCompositedScrolling(
|
| // behind dashed borders). Resolve this case, or not, and update this check
|
| // with the results.
|
| if (layer->GetLayoutObject().Style()->HasBorderRadius()) {
|
| - main_thread_scrolling_reasons |=
|
| + non_composited_main_thread_scrolling_reasons_ |=
|
| MainThreadScrollingReason::kHasBorderRadius;
|
| needs_composited_scrolling = false;
|
| }
|
| if (layer->GetLayoutObject().HasClip() ||
|
| layer->HasDescendantWithClipPath() || layer->HasAncestorWithClipPath()) {
|
| - main_thread_scrolling_reasons |=
|
| + non_composited_main_thread_scrolling_reasons_ |=
|
| MainThreadScrollingReason::kHasClipRelatedProperty;
|
| needs_composited_scrolling = false;
|
| }
|
|
|
| - if (main_thread_scrolling_reasons) {
|
| - AddStyleRelatedMainThreadScrollingReasons(main_thread_scrolling_reasons);
|
| - }
|
| -
|
| + DCHECK(!(non_composited_main_thread_scrolling_reasons_ &
|
| + ~MainThreadScrollingReason::kNonCompositedReasons));
|
| return needs_composited_scrolling;
|
| }
|
|
|
| -void PaintLayerScrollableArea::AddStyleRelatedMainThreadScrollingReasons(
|
| - const uint32_t reasons) {
|
| - LocalFrame* frame = Box().GetFrame();
|
| - if (!frame)
|
| - return;
|
| - FrameView* frame_view = frame->View();
|
| - if (!frame_view)
|
| - return;
|
| -
|
| - for (uint32_t reason = 1;
|
| - reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount;
|
| - reason <<= 1) {
|
| - if (reasons & reason) {
|
| - frame_view->AdjustStyleRelatedMainThreadScrollingReasons(reason, true);
|
| - reasons_ |= reason;
|
| - }
|
| - }
|
| -}
|
| -
|
| -void PaintLayerScrollableArea::RemoveStyleRelatedMainThreadScrollingReasons() {
|
| - LocalFrame* frame = Box().GetFrame();
|
| - if (!frame)
|
| - return;
|
| - FrameView* frame_view = frame->View();
|
| - if (!frame_view)
|
| - 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)) {
|
| - reasons_ &= ~reason;
|
| - frame_view->AdjustStyleRelatedMainThreadScrollingReasons(reason, false);
|
| - }
|
| - }
|
| -}
|
| -
|
| void PaintLayerScrollableArea::UpdateNeedsCompositedScrolling(
|
| LCDTextMode mode) {
|
| - // Clear all style related main thread scrolling reasons, if any,
|
| - // before calling computeNeedsCompositedScrolling
|
| - RemoveStyleRelatedMainThreadScrollingReasons();
|
| const bool needs_composited_scrolling =
|
| ComputeNeedsCompositedScrolling(mode, Layer());
|
|
|
|
|