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

Properly invalidate backings of squashed content when it loses its squashing layer.

Previously, in such situations we failed to mark the layer as needing layer requirements
update, which already has code to issue an invalidation on the new backing of the content
now that it lost squashing.

Bug: 865415

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I807bf1426e45ce71ed42024512e9c77481f018cc
Reviewed-on: https://chromium-review.googlesource.com/1145896
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarTien-Ren Chen <trchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577404}
parent 7a57a895
...@@ -637,7 +637,8 @@ void CompositingRequirementsUpdater::UpdateRecursive( ...@@ -637,7 +637,8 @@ void CompositingRequirementsUpdater::UpdateRecursive(
// Layer assignment is needed for allocating or removing composited // Layer assignment is needed for allocating or removing composited
// layers related to this PaintLayer; hence the below conditions. // layers related to this PaintLayer; hence the below conditions.
if (reasons_to_composite || layer->GetCompositingState() != kNotComposited) if (reasons_to_composite || layer->GetCompositingState() != kNotComposited ||
layer->LostGroupedMapping())
layer->SetNeedsCompositingLayerAssignment(); layer->SetNeedsCompositingLayerAssignment();
// At this point we have finished collecting all reasons to composite this // At this point we have finished collecting all reasons to composite this
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
namespace blink { namespace blink {
...@@ -129,4 +130,50 @@ TEST_F(CompositingRequirementsUpdaterTest, ...@@ -129,4 +130,50 @@ TEST_F(CompositingRequirementsUpdaterTest,
target->GetCompositingReasons()); target->GetCompositingReasons());
} }
// This test sets up a situation where a squashed PaintLayer loses its
// backing, but does not change visual rect. Therefore the compositing system
// must invalidate it because of change of backing.
TEST_F(CompositingRequirementsUpdaterTest,
NeedsLayerAssignmentAfterSquashingRemoval) {
SetBodyInnerHTML(R"HTML(
<style>
* {
margin: 0
}
#target {
width: 100px; height: 100px; backface-visibility: hidden
}
div {
width: 100px; height: 100px;
position: absolute;
background: lightblue;
top: 0px;
}
</style>
<div id=target></div>
<div id=squashed></div>
)HTML");
PaintLayer* squashed =
ToLayoutBoxModelObject(GetLayoutObjectByElementId("squashed"))->Layer();
EXPECT_EQ(kPaintsIntoGroupedBacking, squashed->GetCompositingState());
GetDocument().View()->SetTracksPaintInvalidations(true);
GetDocument().getElementById("target")->setAttribute(HTMLNames::styleAttr,
"display: none");
GetDocument().View()->UpdateAllLifecyclePhases();
EXPECT_EQ(kNotComposited, squashed->GetCompositingState());
auto* tracking = GetDocument()
.View()
->GetLayoutView()
->Layer()
->GraphicsLayerBacking()
->GetRasterInvalidationTracking();
EXPECT_TRUE(tracking->HasInvalidations());
EXPECT_EQ(IntRect(0, 0, 100, 100), tracking->Invalidations()[0].rect);
}
} // namespace blink } // namespace blink
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