| Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| index abd711d097e33fed7cec2f2ad8f59fe7989654c9..8145c245f57b981b1ec2c07fb505ccf56d4f1e28 100644
|
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| @@ -281,22 +281,20 @@ void CompositedLayerMapping::UpdateBackdropFilters(const ComputedStyle& style) {
|
| OwningLayer().CreateCompositorFilterOperationsForBackdropFilter(style));
|
| }
|
|
|
| +bool CompositedLayerMapping::UsesCompositedStickyPosition() const {
|
| + return GetLayoutObject().Style()->GetPosition() == EPosition::kSticky &&
|
| + (owning_layer_.AncestorOverflowLayer()->IsRootLayer()
|
| + ? GetLayoutObject().View()->GetFrameView()->IsScrollable()
|
| + : owning_layer_.AncestorOverflowLayer()
|
| + ->NeedsCompositedScrolling());
|
| +}
|
| +
|
| void CompositedLayerMapping::UpdateStickyConstraints(
|
| const ComputedStyle& style) {
|
| - bool sticky = style.GetPosition() == EPosition::kSticky;
|
| const PaintLayer* ancestor_overflow_layer =
|
| owning_layer_.AncestorOverflowLayer();
|
| - // TODO(flackr): Do we still need this?
|
| - if (sticky) {
|
| - if (!ancestor_overflow_layer->IsRootLayer()) {
|
| - sticky = ancestor_overflow_layer->NeedsCompositedScrolling();
|
| - } else {
|
| - sticky = GetLayoutObject().View()->GetFrameView()->IsScrollable();
|
| - }
|
| - }
|
| -
|
| WebLayerStickyPositionConstraint web_constraint;
|
| - if (sticky) {
|
| + if (UsesCompositedStickyPosition()) {
|
| const StickyConstraintsMap& constraints_map =
|
| ancestor_overflow_layer->GetScrollableArea()->GetStickyConstraintsMap();
|
| const StickyPositionScrollingConstraints& constraints =
|
| @@ -1128,16 +1126,11 @@ void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry(
|
| const IntRect& relative_compositing_bounds,
|
| const IntRect& local_compositing_bounds,
|
| const IntPoint& graphics_layer_parent_location) {
|
| - graphics_layer_->SetPosition(FloatPoint(
|
| - relative_compositing_bounds.Location() - graphics_layer_parent_location));
|
| - graphics_layer_->SetOffsetFromLayoutObject(
|
| - ToIntSize(local_compositing_bounds.Location()));
|
| - // Find the layout offset of the unshifted sticky box within its parent
|
| - // composited layer. This information is used by the compositor side to
|
| - // compute the additional offset required to keep the element stuck under
|
| - // compositor scrolling.
|
| - FloatSize main_thread_sticky_offset;
|
| - if (GetLayoutObject().Style()->GetPosition() == EPosition::kSticky) {
|
| + // Find and remove the offset applied for sticky position if the compositor
|
| + // will shift the layer for sticky position to avoid offsetting the layer
|
| + // twice.
|
| + FloatSize offset_for_sticky_position;
|
| + if (UsesCompositedStickyPosition()) {
|
| const StickyConstraintsMap& constraints_map =
|
| owning_layer_.AncestorOverflowLayer()
|
| ->GetScrollableArea()
|
| @@ -1145,11 +1138,15 @@ void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry(
|
| const StickyPositionScrollingConstraints& constraints =
|
| constraints_map.at(&owning_layer_);
|
|
|
| - main_thread_sticky_offset =
|
| + offset_for_sticky_position =
|
| constraints.GetOffsetForStickyPosition(constraints_map);
|
| }
|
| - graphics_layer_->SetOffsetForStickyPosition(
|
| - RoundedIntSize(main_thread_sticky_offset));
|
| + graphics_layer_->SetPosition(
|
| + FloatPoint(relative_compositing_bounds.Location() -
|
| + graphics_layer_parent_location) -
|
| + offset_for_sticky_position);
|
| + graphics_layer_->SetOffsetFromLayoutObject(
|
| + ToIntSize(local_compositing_bounds.Location()));
|
|
|
| FloatSize old_size = graphics_layer_->Size();
|
| const FloatSize contents_size(relative_compositing_bounds.Size());
|
|
|