Commit c231bdd2 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Avoid re-computing rel-pos offset during paint.

This is an expensive operation. See LayoutBoxModelObject::RelativePositionOffset.

Bug: 984965

Change-Id: I487d2eaa96ee63c8cff88d12a062feec53ddb05a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726896Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682944}
parent 0cdb3da7
...@@ -328,9 +328,7 @@ void PaintLayer::UpdateLayerPositionsAfterLayout() { ...@@ -328,9 +328,7 @@ void PaintLayer::UpdateLayerPositionsAfterLayout() {
void PaintLayer::UpdateLayerPositionRecursive() { void PaintLayer::UpdateLayerPositionRecursive() {
auto old_location = location_without_position_offset_; auto old_location = location_without_position_offset_;
auto old_offset_for_in_flow_rel_position = auto old_offset_for_in_flow_rel_position = OffsetForInFlowRelPosition();
rare_data_ ? rare_data_->offset_for_in_flow_rel_position
: PhysicalOffset();
UpdateLayerPosition(); UpdateLayerPosition();
if (location_without_position_offset_ != old_location) { if (location_without_position_offset_ != old_location) {
...@@ -1525,9 +1523,13 @@ static inline const PaintLayer* AccumulateOffsetTowardsAncestor( ...@@ -1525,9 +1523,13 @@ static inline const PaintLayer* AccumulateOffsetTowardsAncestor(
return nullptr; return nullptr;
location += layer->LocationWithoutPositionOffset(); location += layer->LocationWithoutPositionOffset();
if (layer->GetLayoutObject().IsInFlowPositioned()) if (layer->GetLayoutObject().IsRelPositioned()) {
location += layer->OffsetForInFlowRelPosition();
} else if (layer->GetLayoutObject().IsInFlowPositioned()) {
location += layer->GetLayoutObject().OffsetForInFlowPosition(); location += layer->GetLayoutObject().OffsetForInFlowPosition();
}
location -= PhysicalOffset(containing_layer->ScrolledContentOffset()); location -= PhysicalOffset(containing_layer->ScrolledContentOffset());
return containing_layer; return containing_layer;
} }
......
...@@ -1112,6 +1112,11 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -1112,6 +1112,11 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
return needs_visual_overflow_recalc_; return needs_visual_overflow_recalc_;
} }
PhysicalOffset OffsetForInFlowRelPosition() const {
return rare_data_ ? rare_data_->offset_for_in_flow_rel_position
: PhysicalOffset();
}
private: private:
void SetNeedsCompositingInputsUpdateInternal(); void SetNeedsCompositingInputsUpdateInternal();
......
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