diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/chromium/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/chromium/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index 01c3537f381..3255f724c37 100644 --- a/chromium/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/chromium/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc @@ -1002,6 +1002,9 @@ void PaintLayerScrollableArea::UpdateAfterLayout() { if (NeedsScrollbarReconstruction()) { SetHasHorizontalScrollbar(false); SetHasVerticalScrollbar(false); + // In case that DelayScrollOffsetClampScope prevented destruction of the + // scrollbars. + scrollbar_manager_.DestroyDetachedScrollbars(); } UpdateScrollDimensions(); @@ -2376,14 +2379,20 @@ void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() { // If we have fixed elements and we scroll the root layer we might // change compositing since the fixed elements might now overlap a // composited layer. - if (!base::FeatureList::IsEnabled( - features::kAssumeOverlapAfterFixedOrStickyPosition)) { - if (Layer()->IsRootLayer()) { - LocalFrame* frame = GetLayoutBox()->GetFrame(); - if (frame && frame->View() && - frame->View()->HasViewportConstrainedObjects()) { + if (Layer()->IsRootLayer()) { + LocalFrame* frame = GetLayoutBox()->GetFrame(); + if (frame && frame->View()) { + LocalFrameView* view = frame->View(); + // When kMaxOverlapBoundsForFixed is enabled, the maximum possible + // overlap (for all possible scroll offsets) of the fixed content has + // been included in the overlap test, so we can skip the compositing + // update on scroll changes for fixed content. + bool requires_compositing_inputs_update = + !base::FeatureList::IsEnabled(features::kMaxOverlapBoundsForFixed) + ? view->HasViewportConstrainedObjects() + : view->HasStickyViewportConstrainedObject(); + if (requires_compositing_inputs_update) Layer()->SetNeedsCompositingInputsUpdate(); - } } } } else { @@ -2459,8 +2468,7 @@ bool PaintLayerScrollableArea::ComputeNeedsCompositedScrolling( auto old_background_paint_location = box->GetBackgroundPaintLocation(); non_composited_main_thread_scrolling_reasons_ = 0; auto new_background_paint_location = - box->ComputeBackgroundPaintLocationIfComposited( - &non_composited_main_thread_scrolling_reasons_); + box->ComputeBackgroundPaintLocationIfComposited(); bool needs_composited_scrolling = ComputeNeedsCompositedScrollingInternal( new_background_paint_location, force_prefer_compositing_to_lcd_text); if (!needs_composited_scrolling) @@ -2507,42 +2515,39 @@ bool PaintLayerScrollableArea::ComputeNeedsCompositedScrollingInternal( bool needs_composited_scrolling = true; - // TODO(flackr): Allow integer transforms as long as all of the ancestor - // transforms are also integer. - bool background_supports_lcd_text = - box->StyleRef().IsStackingContext() && - (background_paint_location_if_composited & - kBackgroundPaintInScrollingContents) && - layer_->BackgroundIsKnownToBeOpaqueInRect(box->PhysicalPaddingBoxRect(), - true) && - !layer_->CompositesWithTransform() && !layer_->CompositesWithOpacity(); - if (!force_prefer_compositing_to_lcd_text && !box->GetDocument() .GetSettings() - ->GetPreferCompositingToLCDTextEnabled() && - !background_supports_lcd_text) { - if (layer_->CompositesWithOpacity()) { - non_composited_main_thread_scrolling_reasons_ |= - cc::MainThreadScrollingReason::kHasOpacityAndLCDText; - } + ->GetPreferCompositingToLCDTextEnabled()) { + // TODO(crbug.com/1025927): We may remove this condition. if (layer_->CompositesWithTransform()) { non_composited_main_thread_scrolling_reasons_ |= cc::MainThreadScrollingReason::kHasTransformAndLCDText; + needs_composited_scrolling = false; } if (!layer_->BackgroundIsKnownToBeOpaqueInRect( box->PhysicalPaddingBoxRect(), true)) { non_composited_main_thread_scrolling_reasons_ |= cc::MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; + needs_composited_scrolling = false; } if (!box->StyleRef().IsStackingContext()) { non_composited_main_thread_scrolling_reasons_ |= cc::MainThreadScrollingReason::kIsNotStackingContextAndLCDText; + needs_composited_scrolling = false; + } + if (!(background_paint_location_if_composited & + kBackgroundPaintInScrollingContents) && + box->StyleRef().HasBackground()) { + non_composited_main_thread_scrolling_reasons_ |= + cc::MainThreadScrollingReason::kCantPaintScrollingBackground; + needs_composited_scrolling = false; } - - needs_composited_scrolling = false; } + // TODO(crbug.com/645957): We may remove this condition. This is also + // duplicate and inconsistent with the condition in + // LayoutBoxModelObject::ComputeBackgroundPaintLocationIfComposited(). if (box->HasClip() || layer_->HasDescendantWithClipPath() || !!layer_->ClipPathAncestor()) { non_composited_main_thread_scrolling_reasons_ |= @@ -3164,11 +3169,15 @@ PaintLayerScrollableArea::ScrollingBackgroundDisplayItemClient::VisualRect() if (const auto* document_element = document.documentElement()) { if (const auto* document_element_object = document_element->GetLayoutObject()) { - TransformationMatrix matrix; - document_element_object->GetTransformFromContainer( - box, PhysicalOffset(), matrix); - if (matrix.IsInvertible()) - result.Unite(matrix.Inverse().MapRect(result)); + const PropertyTreeState& document_element_state = + document_element_object->FirstFragment().LocalBorderBoxProperties(); + const PropertyTreeState& view_contents_state = + box->FirstFragment().ContentsProperties(); + IntRect result_in_view = result; + GeometryMapper::SourceToDestinationRect( + view_contents_state.Transform(), document_element_state.Transform(), + result_in_view); + result.Unite(result_in_view); } } } |