Commit ec4da9b3 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[RLS] Remove !RLS code in CLM and background_image_geometry

This patch removes the !RLS codepaths in CompositedLayerMapping (CLM)
and background_image_geometry now that Root Layer Scrolling (RLS) has
launched.

Bug: 823365
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Id07239b22bb96fa7e4d0d3c41d82b61aa9eb5090
Reviewed-on: https://chromium-review.googlesource.com/1071871
Commit-Queue: Philip Rogers <pdr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561588}
parent 34277063
...@@ -450,17 +450,12 @@ LayoutRect FixedAttachmentPositioningArea(const LayoutBoxModelObject& obj, ...@@ -450,17 +450,12 @@ LayoutRect FixedAttachmentPositioningArea(const LayoutBoxModelObject& obj,
if (FixedBackgroundPaintsInLocalCoordinates(obj, flags)) if (FixedBackgroundPaintsInLocalCoordinates(obj, flags))
return rect; return rect;
if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // The LayoutView is the only object that can paint a fixed background into
// The LayoutView is the only object that can paint a fixed background into // its scrolling contents layer, so it gets a special adjustment here.
// its scrolling contents layer, so it gets a special adjustment here. if (obj.IsLayoutView()) {
if (obj.IsLayoutView()) { auto* mapping = obj.Layer()->GetCompositedLayerMapping();
CompositedLayerMapping* mapping = if (mapping && mapping->BackgroundPaintsOntoScrollingContentsLayer())
obj.Layer()->GetCompositedLayerMapping(); rect.SetLocation(IntPoint(ToLayoutView(obj).ScrolledContentOffset()));
if (mapping && mapping->BackgroundPaintsOntoScrollingContentsLayer())
rect.SetLocation(IntPoint(ToLayoutView(obj).ScrolledContentOffset()));
}
} else {
rect.SetLocation(IntPoint(frame_view->ScrollOffsetInt()));
} }
// Compensate the translations created by ScrollRecorders. // Compensate the translations created by ScrollRecorders.
......
...@@ -554,24 +554,12 @@ GraphicsLayer* CompositedLayerMapping::FrameContentsGraphicsLayer() const { ...@@ -554,24 +554,12 @@ GraphicsLayer* CompositedLayerMapping::FrameContentsGraphicsLayer() const {
void CompositedLayerMapping::UpdateAfterPartResize() { void CompositedLayerMapping::UpdateAfterPartResize() {
if (GetLayoutObject().IsLayoutEmbeddedContent()) { if (GetLayoutObject().IsLayoutEmbeddedContent()) {
FloatPoint parent_posn = child_containment_layer_ if (GraphicsLayer* document_layer = FrameContentsGraphicsLayer()) {
? child_containment_layer_->GetPosition() FloatPoint parent_position = child_containment_layer_
: FloatPoint(); ? child_containment_layer_->GetPosition()
if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { : FloatPoint();
if (GraphicsLayer* document_layer = FrameContentsGraphicsLayer()) { document_layer->SetPosition(FlooredIntPoint(
document_layer->SetPosition(FlooredIntPoint( FloatPoint(ContentsBox().Location()) - parent_position));
FloatPoint(ContentsBox().Location()) - parent_posn));
}
} else if (PaintLayerCompositor* inner_compositor =
PaintLayerCompositor::FrameContentsCompositor(
ToLayoutEmbeddedContent(GetLayoutObject()))) {
inner_compositor->FrameViewDidChangeSize();
FloatSize offset = FloatPoint(ContentsBox().Location()) - parent_posn;
// Assert our frameviews are always aligned to pixel boundaries.
DCHECK(offset.Width() == floor(offset.Width()) &&
offset.Height() == floor(offset.Height()));
inner_compositor->FrameViewDidChangeLocation(
IntPoint(floor(offset.Width()), floor(offset.Height())));
} }
} }
} }
...@@ -1281,7 +1269,7 @@ void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry( ...@@ -1281,7 +1269,7 @@ void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry(
// the <iframe> element in the parent frame's DOM. // the <iframe> element in the parent frame's DOM.
bool is_iframe_doc = GetLayoutObject().IsLayoutView() && bool is_iframe_doc = GetLayoutObject().IsLayoutView() &&
!GetLayoutObject().GetFrame()->IsLocalRoot(); !GetLayoutObject().GetFrame()->IsLocalRoot();
if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled() || !is_iframe_doc) { if (!is_iframe_doc) {
graphics_layer_->SetPosition( graphics_layer_->SetPosition(
FloatPoint(relative_compositing_bounds.Location() - FloatPoint(relative_compositing_bounds.Location() -
graphics_layer_parent_location)); graphics_layer_parent_location));
...@@ -1313,12 +1301,8 @@ void CompositedLayerMapping::ComputeGraphicsLayerParentLocation( ...@@ -1313,12 +1301,8 @@ void CompositedLayerMapping::ComputeGraphicsLayerParentLocation(
IntPoint(compositing_container->GetCompositedLayerMapping() IntPoint(compositing_container->GetCompositedLayerMapping()
->ParentForSublayers() ->ParentForSublayers()
->OffsetFromLayoutObject()); ->OffsetFromLayoutObject());
} else if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) {
graphics_layer_parent_location =
GetLayoutObject().View()->DocumentRect().Location();
} else if (!GetLayoutObject().GetFrame()->IsLocalRoot()) { // TODO(oopif) } else if (!GetLayoutObject().GetFrame()->IsLocalRoot()) { // TODO(oopif)
DCHECK(RuntimeEnabledFeatures::RootLayerScrollingEnabled() && DCHECK(!compositing_container);
!compositing_container);
graphics_layer_parent_location = IntPoint(); graphics_layer_parent_location = IntPoint();
} }
...@@ -2569,19 +2553,12 @@ void CompositedLayerMapping::RegisterScrollingLayers() { ...@@ -2569,19 +2553,12 @@ void CompositedLayerMapping::RegisterScrollingLayers() {
scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_); scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_);
// In non-RLS mode, the fixed container will actually be the special viewport bool is_fixed_container =
// scrolling layers, higher up in the hierarchy, above the LayoutView "root owning_layer_.GetLayoutObject().CanContainFixedPositionObjects();
// layer". So avoid marking the LayoutView's layer a container in that case.
// The layout viewport scrolling layer will be correctly marked as such by
// PaintLayerCompositor.
bool is_container =
owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() &&
(!owning_layer_.IsRootLayer() ||
RuntimeEnabledFeatures::RootLayerScrollingEnabled());
bool resized_by_url_bar = bool resized_by_url_bar =
owning_layer_.GetLayoutObject().IsLayoutView() && owning_layer_.GetLayoutObject().IsLayoutView() &&
owning_layer_.Compositor()->IsRootScrollerAncestor(); owning_layer_.Compositor()->IsRootScrollerAncestor();
graphics_layer_->SetIsContainerForFixedPositionLayers(is_container); graphics_layer_->SetIsContainerForFixedPositionLayers(is_fixed_container);
graphics_layer_->SetIsResizedByBrowserControls(resized_by_url_bar); graphics_layer_->SetIsResizedByBrowserControls(resized_by_url_bar);
// Fixed-pos descendants inherits the space that has all CSS property applied, // Fixed-pos descendants inherits the space that has all CSS property applied,
// including perspective, overflow scroll/clip. Thus we also mark every layers // including perspective, overflow scroll/clip. Thus we also mark every layers
...@@ -2589,8 +2566,8 @@ void CompositedLayerMapping::RegisterScrollingLayers() { ...@@ -2589,8 +2566,8 @@ void CompositedLayerMapping::RegisterScrollingLayers() {
// skipped. // skipped.
ApplyToGraphicsLayers( ApplyToGraphicsLayers(
this, this,
[is_container, resized_by_url_bar](GraphicsLayer* layer) { [is_fixed_container, resized_by_url_bar](GraphicsLayer* layer) {
layer->SetIsContainerForFixedPositionLayers(is_container); layer->SetIsContainerForFixedPositionLayers(is_fixed_container);
layer->SetIsResizedByBrowserControls(resized_by_url_bar); layer->SetIsResizedByBrowserControls(resized_by_url_bar);
if (resized_by_url_bar) if (resized_by_url_bar)
layer->SetMasksToBounds(false); layer->SetMasksToBounds(false);
...@@ -3259,9 +3236,7 @@ IntRect CompositedLayerMapping::RecomputeInterestRect( ...@@ -3259,9 +3236,7 @@ IntRect CompositedLayerMapping::RecomputeInterestRect(
anchor_layout_object = &owning_layer_.GetLayoutObject(); anchor_layout_object = &owning_layer_.GetLayoutObject();
IntSize offset = graphics_layer->OffsetFromLayoutObject(); IntSize offset = graphics_layer->OffsetFromLayoutObject();
should_apply_anchor_overflow_clip = should_apply_anchor_overflow_clip =
AdjustForCompositedScrolling(graphics_layer, offset) && AdjustForCompositedScrolling(graphics_layer, offset);
(RuntimeEnabledFeatures::RootLayerScrollingEnabled() ||
!owning_layer_.IsRootLayer());
offset_from_anchor_layout_object = FloatSize(offset); offset_from_anchor_layout_object = FloatSize(offset);
} }
...@@ -3287,16 +3262,14 @@ IntRect CompositedLayerMapping::RecomputeInterestRect( ...@@ -3287,16 +3262,14 @@ IntRect CompositedLayerMapping::RecomputeInterestRect(
anchor_layout_object->MapToVisualRectInAncestorSpace( anchor_layout_object->MapToVisualRectInAncestorSpace(
root_view, graphics_layer_bounds_in_root_view_space, kUseGeometryMapper); root_view, graphics_layer_bounds_in_root_view_space, kUseGeometryMapper);
// In RLS, the root_view is scrolled. However, MapToVisualRectInAncestorSpace // MapToVisualRectInAncestorSpace doesn't account for the root scroll because
// doesn't account for this scroll, since it earlies out as soon as we reach // it earlies out as soon as we reach this ancestor. That is, it only maps to
// this ancestor. That is, it only maps to the space of the root_view, not // the space of the root_view, not accounting for the fact that the root_view
// accounting for the fact that the root_view itself can be scrolled. If the // itself can be scrolled. If the root_view is our anchor_layout_object, then
// root_view is our anchor_layout_object, then this extra offset is counted in // this extra offset is counted in offset_from_anchor_layout_object. In other
// offset_from_anchor_layout_object. In other cases, we need to account for it // cases, we need to account for it here. Otherwise, the paint clip below
// here. Otherwise, the paint clip below might clip the whole (visible) rect // might clip the whole (visible) rect out.
// out. if (root_view != anchor_layout_object) {
if (RuntimeEnabledFeatures::RootLayerScrollingEnabled() &&
root_view != anchor_layout_object) {
if (auto* scrollable_area = root_view->GetScrollableArea()) { if (auto* scrollable_area = root_view->GetScrollableArea()) {
graphics_layer_bounds_in_root_view_space.MoveBy( graphics_layer_bounds_in_root_view_space.MoveBy(
-scrollable_area->VisibleContentRect().Location()); -scrollable_area->VisibleContentRect().Location());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment