Commit 92958ccd authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Only invalidate child clipping mask layer when needed

This patch only invalidates the child clipping mask layer if the size
actually changes. https://crrev.com/564140 regressed performance by
calling this unconditionally.

Because the same bug was made in https://crrev.com/565415, this patch
also updates the two GraphicsLayer::SetSize callsites from that patch.

Bug: 851105
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I74bcda83054e8e21332e723d0fc816910086e2e4
Reviewed-on: https://chromium-review.googlesource.com/1111208Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569645}
parent 77426482
...@@ -1513,10 +1513,13 @@ void CompositedLayerMapping::UpdateChildContainmentLayerGeometry() { ...@@ -1513,10 +1513,13 @@ void CompositedLayerMapping::UpdateChildContainmentLayerGeometry() {
if (child_clipping_mask_layer_ && !scrolling_layer_ && if (child_clipping_mask_layer_ && !scrolling_layer_ &&
!GetLayoutObject().Style()->ClipPath()) { !GetLayoutObject().Style()->ClipPath()) {
child_clipping_mask_layer_->SetSize(child_containment_layer_->Size()); if (child_clipping_mask_layer_->Size() !=
child_containment_layer_->Size()) {
child_clipping_mask_layer_->SetSize(child_containment_layer_->Size());
child_clipping_mask_layer_->SetNeedsDisplay();
}
child_clipping_mask_layer_->SetOffsetFromLayoutObject( child_clipping_mask_layer_->SetOffsetFromLayoutObject(
child_containment_layer_->OffsetFromLayoutObject()); child_containment_layer_->OffsetFromLayoutObject());
child_clipping_mask_layer_->SetNeedsDisplay();
} }
} }
...@@ -1612,10 +1615,12 @@ void CompositedLayerMapping::UpdateScrollingLayerGeometry( ...@@ -1612,10 +1615,12 @@ void CompositedLayerMapping::UpdateScrollingLayerGeometry(
if (child_clipping_mask_layer_ && !GetLayoutObject().Style()->ClipPath()) { if (child_clipping_mask_layer_ && !GetLayoutObject().Style()->ClipPath()) {
child_clipping_mask_layer_->SetPosition(scrolling_layer_->GetPosition()); child_clipping_mask_layer_->SetPosition(scrolling_layer_->GetPosition());
child_clipping_mask_layer_->SetSize(scrolling_layer_->Size()); if (child_clipping_mask_layer_->Size() != scrolling_layer_->Size()) {
child_clipping_mask_layer_->SetSize(scrolling_layer_->Size());
child_clipping_mask_layer_->SetNeedsDisplay();
}
child_clipping_mask_layer_->SetOffsetFromLayoutObject( child_clipping_mask_layer_->SetOffsetFromLayoutObject(
ToIntSize(overflow_clip_rect.Location())); ToIntSize(overflow_clip_rect.Location()));
child_clipping_mask_layer_->SetNeedsDisplay();
} }
bool overflow_clip_rect_offset_changed = bool overflow_clip_rect_offset_changed =
...@@ -1682,10 +1687,12 @@ void CompositedLayerMapping::UpdateChildClippingMaskLayerGeometry() { ...@@ -1682,10 +1687,12 @@ void CompositedLayerMapping::UpdateChildClippingMaskLayerGeometry() {
IntRect padding_box = EnclosingIntRect(layout_box.PaddingBoxRect()); IntRect padding_box = EnclosingIntRect(layout_box.PaddingBoxRect());
child_clipping_mask_layer_->SetPosition(graphics_layer_->GetPosition()); child_clipping_mask_layer_->SetPosition(graphics_layer_->GetPosition());
child_clipping_mask_layer_->SetSize(graphics_layer_->Size()); if (child_clipping_mask_layer_->Size() != graphics_layer_->Size()) {
child_clipping_mask_layer_->SetSize(graphics_layer_->Size());
child_clipping_mask_layer_->SetNeedsDisplay();
}
child_clipping_mask_layer_->SetOffsetFromLayoutObject( child_clipping_mask_layer_->SetOffsetFromLayoutObject(
ToIntSize(padding_box.Location())); ToIntSize(padding_box.Location()));
child_clipping_mask_layer_->SetNeedsDisplay();
// NOTE: also some stuff happening in updateChildContainmentLayerGeometry(). // NOTE: also some stuff happening in updateChildContainmentLayerGeometry().
} }
......
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