Commit afbc3514 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Fix ObjectPaintInvalidatorTest for LayoutNG

LayoutNG allows an inline to contain floating objects, so the original
logic for floating objects escaping inline containers doesn't apply.

Bug: 922645
Change-Id: Id736d7051a6356325be92cb7fa25949a21304c1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1913027Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715184}
parent 57ee9cf0
......@@ -22,18 +22,24 @@ template <typename Functor>
static void TraverseNonCompositingDescendantsInPaintOrder(const LayoutObject&,
const Functor&);
static bool MayBeSkippedContainerForFloating(const LayoutObject& object) {
return !object.IsInLayoutNGInlineFormattingContext() &&
!object.IsLayoutBlock();
}
template <typename Functor>
static void
TraverseNonCompositingDescendantsBelongingToAncestorPaintInvalidationContainer(
const LayoutObject& object,
const Functor& functor) {
// |object| is a paint invalidation container, but is not a stacking context
// or is a non-block, so the paint invalidation container of stacked
// descendants may not belong to |object| but belong to an ancestor. This
// function traverses all such descendants. See Case 1a and Case 2 below for
// details.
// (legacy layout only: or is a non-block), so the paint invalidation
// container of stacked descendants may not belong to |object| but belong to
// an ancestor. This function traverses all such descendants. See (legacy
// layout only: Case 1a and) Case 2 below for details.
DCHECK(object.IsPaintInvalidationContainer() &&
(!object.StyleRef().IsStackingContext() || !object.IsLayoutBlock()));
(!object.StyleRef().IsStackingContext() ||
MayBeSkippedContainerForFloating(object)));
LayoutObject* descendant = object.NextInPreOrder(&object);
while (descendant) {
......@@ -43,7 +49,10 @@ TraverseNonCompositingDescendantsBelongingToAncestorPaintInvalidationContainer(
// invalidation container in the same situation as |object|, or its paint
// invalidation container is in such situation. Keep searching until a
// stacked layer is found.
if (!object.IsLayoutBlock() && descendant->IsFloating()) {
if (MayBeSkippedContainerForFloating(object) &&
descendant->IsFloating()) {
// The following is for legacy layout only because LayoutNG allows an
// inline to contain floats.
// Case 1a (rare): However, if the descendant is a floating object below
// a composited non-block object, the subtree may belong to an ancestor
// in paint order, thus recur into the subtree. Note that for
......@@ -65,12 +74,13 @@ TraverseNonCompositingDescendantsBelongingToAncestorPaintInvalidationContainer(
TraverseNonCompositingDescendantsInPaintOrder(*descendant, functor);
descendant = descendant->NextInPreOrderAfterChildren(&object);
} else if (descendant->StyleRef().IsStackingContext() &&
descendant->IsLayoutBlock()) {
!MayBeSkippedContainerForFloating(*descendant)) {
// Case 3: The descendant is an invalidation container and is a stacking
// context. No objects in the subtree can have invalidation container
// outside of it, thus skip the whole subtree.
// This excludes non-block because there might be floating objects under
// the descendant belonging to some ancestor in paint order (Case 1a).
// Legacy layout only: This excludes non-block because there might be
// floating objects under the descendant belonging to some ancestor in
// paint order (Case 1a).
descendant = descendant->NextInPreOrderAfterChildren(&object);
} else {
// Case 4: The descendant is an invalidation container but not a stacking
......@@ -92,12 +102,13 @@ static void TraverseNonCompositingDescendantsInPaintOrder(
functor(*descendant);
descendant = descendant->NextInPreOrder(&object);
} else if (descendant->StyleRef().IsStackingContext() &&
descendant->IsLayoutBlock()) {
!MayBeSkippedContainerForFloating(*descendant)) {
// The descendant is an invalidation container and is a stacking context.
// No objects in the subtree can have invalidation container outside of
// it, thus skip the whole subtree.
// This excludes non-blocks because there might be floating objects under
// the descendant belonging to some ancestor in paint order (Case 1a).
// Legacy layout only: This excludes non-blocks because there might be
// floating objects under the descendant belonging to some ancestor in
// paint order (Case 1a).
descendant = descendant->NextInPreOrderAfterChildren(&object);
} else {
// If a paint invalidation container is not a stacking context, or the
......@@ -116,7 +127,9 @@ static void SetPaintingLayerNeedsRepaintDuringTraverse(
ToLayoutBoxModelObject(object).HasSelfPaintingLayer()) {
ToLayoutBoxModelObject(object).Layer()->SetNeedsRepaint();
} else if (object.IsFloating() && object.Parent() &&
!object.Parent()->IsLayoutBlock()) {
MayBeSkippedContainerForFloating(*object.Parent())) {
// The following is for legacy layout only because LayoutNG allows an
// inline to contain floats.
object.PaintingLayer()->SetNeedsRepaint();
}
}
......
......@@ -21,9 +21,16 @@ class ObjectPaintInvalidatorTest : public RenderingTest {
EnableCompositing();
RenderingTest::SetUp();
}
static void ValidateDisplayItemClient(const DisplayItemClient* client) {
client->Validate();
}
static bool IsValidDisplayItemClient(const DisplayItemClient* client) {
return client->IsValid();
}
};
using PaintInvalidation = LocalFrameView::ObjectPaintInvalidation;
using ::testing::ElementsAre;
TEST_F(ObjectPaintInvalidatorTest,
......@@ -54,43 +61,73 @@ TEST_F(ObjectPaintInvalidatorTest,
</div>
)HTML");
GetDocument().View()->SetTracksPaintInvalidations(true);
ObjectPaintInvalidator(*GetLayoutObjectByElementId("container"))
auto* container = GetLayoutObjectByElementId("container");
auto* normal_child = GetLayoutObjectByElementId("normal-child");
auto* stacked_child = GetLayoutObjectByElementId("stacked-child");
auto* composited_stacking_context =
GetLayoutObjectByElementId("composited-stacking-context");
auto* normal_child_of_composited_stacking_context =
GetLayoutObjectByElementId("normal-child-of-composited-stacking-context");
auto* stacked_child_of_composited_stacking_context =
GetLayoutObjectByElementId(
"stacked-child-of-composited-stacking-context");
auto* composited_non_stacking_context =
GetLayoutObjectByElementId("composited-non-stacking-context");
auto* normal_child_of_composited_non_stacking_context =
GetLayoutObjectByElementId(
"normal-child-of-composited-non-stacking-context");
auto* stacked_child_of_composited_non_stacking_context =
GetLayoutObjectByElementId(
"stacked-child-of-composited-non-stacking-context");
auto* non_stacked_layered_child_of_composited_non_stacking_context =
GetLayoutObjectByElementId(
"non-stacked-layered-child-of-composited-non-stacking-context");
ValidateDisplayItemClient(container);
ValidateDisplayItemClient(normal_child);
ValidateDisplayItemClient(stacked_child);
ValidateDisplayItemClient(composited_stacking_context);
ValidateDisplayItemClient(normal_child_of_composited_stacking_context);
ValidateDisplayItemClient(stacked_child_of_composited_stacking_context);
ValidateDisplayItemClient(composited_non_stacking_context);
ValidateDisplayItemClient(normal_child_of_composited_non_stacking_context);
ValidateDisplayItemClient(stacked_child_of_composited_non_stacking_context);
ValidateDisplayItemClient(
non_stacked_layered_child_of_composited_non_stacking_context);
ObjectPaintInvalidator(*container)
.InvalidateDisplayItemClientsIncludingNonCompositingDescendants(
PaintInvalidationReason::kSubtree);
EXPECT_THAT(*GetDocument().View()->TrackedObjectPaintInvalidations(),
ElementsAre(
PaintInvalidation{
GetLayoutObjectByElementId("container")->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{
GetLayoutObjectByElementId("normal-child")->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{
GetLayoutObjectByElementId("stacked-child")->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{
GetLayoutObjectByElementId(
"stacked-child-of-composited-non-stacking-context")
->DebugName(),
PaintInvalidationReason::kSubtree}));
GetDocument().View()->SetTracksPaintInvalidations(false);
EXPECT_FALSE(IsValidDisplayItemClient(container));
EXPECT_FALSE(IsValidDisplayItemClient(normal_child));
EXPECT_FALSE(IsValidDisplayItemClient(stacked_child));
EXPECT_TRUE(IsValidDisplayItemClient(composited_stacking_context));
EXPECT_TRUE(
IsValidDisplayItemClient(normal_child_of_composited_stacking_context));
EXPECT_TRUE(
IsValidDisplayItemClient(stacked_child_of_composited_stacking_context));
EXPECT_TRUE(IsValidDisplayItemClient(composited_non_stacking_context));
EXPECT_TRUE(IsValidDisplayItemClient(
normal_child_of_composited_non_stacking_context));
EXPECT_FALSE(IsValidDisplayItemClient(
stacked_child_of_composited_non_stacking_context));
EXPECT_TRUE(IsValidDisplayItemClient(
non_stacked_layered_child_of_composited_non_stacking_context));
}
TEST_F(ObjectPaintInvalidatorTest, TraverseFloatUnderCompositedInline) {
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
// TODO(crbug.com/922645): This test fails with LayoutNG.
if (RuntimeEnabledFeatures::LayoutNGEnabled())
return;
SetBodyInnerHTML(R"HTML(
<style>* { background: blue; }</style>
<div id='compositedContainer' style='position: relative;
will-change: transform'>
<div id='containingBlock' style='position: relative'>
<span id='span' style='position: relative; will-change: transform'>
<div id='target' style='float: right'></div>
TEXT
<div id='target' style='float: right'>FLOAT</div>
</span>
</div>
</div>
......@@ -106,13 +143,29 @@ TEST_F(ObjectPaintInvalidatorTest, TraverseFloatUnderCompositedInline) {
ToLayoutBoxModelObject(composited_container)->Layer();
auto* span = GetLayoutObjectByElementId("span");
auto* span_layer = ToLayoutBoxModelObject(span)->Layer();
auto* text = span->SlowFirstChild();
auto fragments = NGPaintFragment::InlineFragmentsFor(span);
// Thought |target| is under |span| which is a composited stacking context,
// |span| is not the paint invalidation container of |target|.
EXPECT_TRUE(span->IsPaintInvalidationContainer());
EXPECT_TRUE(span->StyleRef().IsStackingContext());
EXPECT_EQ(composited_container, &target->ContainerForPaintInvalidation());
EXPECT_EQ(containing_block_layer, target->PaintingLayer());
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
EXPECT_EQ(span, &target->ContainerForPaintInvalidation());
EXPECT_EQ(span_layer, target->PaintingLayer());
} else {
EXPECT_EQ(composited_container, &target->ContainerForPaintInvalidation());
EXPECT_EQ(containing_block_layer, target->PaintingLayer());
}
ValidateDisplayItemClient(target);
ValidateDisplayItemClient(containing_block);
ValidateDisplayItemClient(composited_container);
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
for (auto* fragment : fragments)
ValidateDisplayItemClient(fragment);
} else {
ValidateDisplayItemClient(span);
ValidateDisplayItemClient(text);
}
// Traversing from target should mark needsRepaint on correct layers.
EXPECT_FALSE(containing_block_layer->SelfNeedsRepaint());
......@@ -120,28 +173,72 @@ TEST_F(ObjectPaintInvalidatorTest, TraverseFloatUnderCompositedInline) {
ObjectPaintInvalidator(*target)
.InvalidateDisplayItemClientsIncludingNonCompositingDescendants(
PaintInvalidationReason::kSubtree);
EXPECT_TRUE(containing_block_layer->SelfNeedsRepaint());
EXPECT_TRUE(composited_container_layer->DescendantNeedsRepaint());
EXPECT_FALSE(span_layer->SelfNeedsRepaint());
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
EXPECT_FALSE(containing_block_layer->SelfOrDescendantNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfOrDescendantNeedsRepaint());
EXPECT_TRUE(span_layer->SelfNeedsRepaint());
} else {
EXPECT_TRUE(containing_block_layer->SelfNeedsRepaint());
EXPECT_FALSE(containing_block_layer->DescendantNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfNeedsRepaint());
EXPECT_TRUE(composited_container_layer->DescendantNeedsRepaint());
EXPECT_FALSE(span_layer->SelfNeedsRepaint());
}
EXPECT_FALSE(IsValidDisplayItemClient(target));
ValidateDisplayItemClient(target);
EXPECT_TRUE(IsValidDisplayItemClient(containing_block));
EXPECT_TRUE(IsValidDisplayItemClient(composited_container));
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
for (auto* fragment : fragments)
EXPECT_TRUE(IsValidDisplayItemClient(fragment));
} else {
EXPECT_TRUE(IsValidDisplayItemClient(span));
EXPECT_TRUE(IsValidDisplayItemClient(text));
}
UpdateAllLifecyclePhasesForTest();
composited_container_layer->ClearNeedsRepaintRecursively();
// Traversing from span should mark needsRepaint on correct layers for target.
EXPECT_FALSE(containing_block_layer->SelfNeedsRepaint());
EXPECT_FALSE(composited_container_layer->DescendantNeedsRepaint());
ValidateDisplayItemClient(target);
EXPECT_FALSE(containing_block_layer->SelfOrDescendantNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfOrDescendantNeedsRepaint());
EXPECT_FALSE(span_layer->SelfOrDescendantNeedsRepaint());
ObjectPaintInvalidator(*span)
.InvalidateDisplayItemClientsIncludingNonCompositingDescendants(
PaintInvalidationReason::kSubtree);
EXPECT_TRUE(containing_block_layer->SelfNeedsRepaint());
EXPECT_TRUE(composited_container_layer->DescendantNeedsRepaint());
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
EXPECT_FALSE(containing_block_layer->SelfOrDescendantNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfOrDescendantNeedsRepaint());
} else {
EXPECT_TRUE(containing_block_layer->SelfNeedsRepaint());
EXPECT_FALSE(containing_block_layer->DescendantNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfNeedsRepaint());
EXPECT_TRUE(composited_container_layer->DescendantNeedsRepaint());
}
EXPECT_TRUE(span_layer->SelfNeedsRepaint());
UpdateAllLifecyclePhasesForTest();
EXPECT_FALSE(IsValidDisplayItemClient(target));
ValidateDisplayItemClient(target);
EXPECT_TRUE(IsValidDisplayItemClient(containing_block));
EXPECT_TRUE(IsValidDisplayItemClient(composited_container));
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
for (auto* fragment : fragments) {
EXPECT_FALSE(IsValidDisplayItemClient(fragment));
ValidateDisplayItemClient(fragment);
}
} else {
EXPECT_FALSE(IsValidDisplayItemClient(span));
ValidateDisplayItemClient(span);
EXPECT_FALSE(IsValidDisplayItemClient(text));
ValidateDisplayItemClient(text);
}
// Traversing from compositedContainer should reach target.
GetDocument().View()->SetTracksPaintInvalidations(true);
EXPECT_FALSE(containing_block_layer->SelfNeedsRepaint());
EXPECT_FALSE(composited_container_layer->DescendantNeedsRepaint());
composited_container_layer->ClearNeedsRepaintRecursively();
// Traversing from compositedContainer should not reach target.
EXPECT_FALSE(containing_block_layer->SelfOrDescendantNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfOrDescendantNeedsRepaint());
EXPECT_FALSE(span_layer->SelfOrDescendantNeedsRepaint());
ObjectPaintInvalidator(*composited_container)
.InvalidateDisplayItemClientsIncludingNonCompositingDescendants(
PaintInvalidationReason::kSubtree);
......@@ -149,95 +246,25 @@ TEST_F(ObjectPaintInvalidatorTest, TraverseFloatUnderCompositedInline) {
EXPECT_TRUE(composited_container_layer->DescendantNeedsRepaint());
EXPECT_FALSE(span_layer->SelfNeedsRepaint());
EXPECT_THAT(
*GetDocument().View()->TrackedObjectPaintInvalidations(),
ElementsAre(PaintInvalidation{composited_container->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{containing_block->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{target->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{"LayoutText #text",
PaintInvalidationReason::kSubtree}));
GetDocument().View()->SetTracksPaintInvalidations(false);
}
TEST_F(ObjectPaintInvalidatorTest,
TraverseFloatUnderMultiLevelCompositedInlines) {
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
// TODO(crbug.com/922645): This test fails with LayoutNG.
if (RuntimeEnabledFeatures::LayoutNGEnabled())
return;
SetBodyInnerHTML(R"HTML(
<div id='compositedContainer' style='position: relative;
will-change: transform'>
<div id='containingBlock' style='position: relative; z-index: 0'>
<span id='span' style='position: relative; will-change: transform'>
<span id='innerSpan'
style='position: relative; will-change: transform'>
<div id='target' style='float: right'></div>
</span>
</span>
</div>
</div>
)HTML");
auto* target = GetLayoutObjectByElementId("target");
auto* containing_block = GetLayoutObjectByElementId("containingBlock");
auto* containing_block_layer =
ToLayoutBoxModelObject(containing_block)->Layer();
auto* composited_container =
GetLayoutObjectByElementId("compositedContainer");
auto* composited_container_layer =
ToLayoutBoxModelObject(composited_container)->Layer();
auto* span = GetLayoutObjectByElementId("span");
auto* span_layer = ToLayoutBoxModelObject(span)->Layer();
auto* inner_span = GetLayoutObjectByElementId("innerSpan");
auto* inner_span_layer = ToLayoutBoxModelObject(inner_span)->Layer();
EXPECT_TRUE(span->IsPaintInvalidationContainer());
EXPECT_TRUE(span->StyleRef().IsStackingContext());
EXPECT_TRUE(inner_span->IsPaintInvalidationContainer());
EXPECT_TRUE(inner_span->StyleRef().IsStackingContext());
EXPECT_EQ(composited_container, &target->ContainerForPaintInvalidation());
EXPECT_EQ(containing_block_layer, target->PaintingLayer());
// Traversing from compositedContainer should reach target.
GetDocument().View()->SetTracksPaintInvalidations(true);
EXPECT_FALSE(containing_block_layer->SelfNeedsRepaint());
EXPECT_FALSE(composited_container_layer->SelfNeedsRepaint());
ObjectPaintInvalidator(*composited_container)
.InvalidateDisplayItemClientsIncludingNonCompositingDescendants(
PaintInvalidationReason::kSubtree);
EXPECT_TRUE(containing_block_layer->SelfNeedsRepaint());
EXPECT_TRUE(composited_container_layer->SelfNeedsRepaint());
EXPECT_FALSE(span_layer->SelfNeedsRepaint());
EXPECT_FALSE(inner_span_layer->SelfNeedsRepaint());
EXPECT_THAT(
*GetDocument().View()->TrackedObjectPaintInvalidations(),
ElementsAre(PaintInvalidation{composited_container->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{containing_block->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{target->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{"LayoutText #text",
PaintInvalidationReason::kSubtree}));
GetDocument().View()->SetTracksPaintInvalidations(false);
EXPECT_TRUE(IsValidDisplayItemClient(target));
else
EXPECT_FALSE(IsValidDisplayItemClient(target));
EXPECT_FALSE(IsValidDisplayItemClient(containing_block));
EXPECT_FALSE(IsValidDisplayItemClient(composited_container));
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
for (auto* fragment : fragments)
EXPECT_TRUE(IsValidDisplayItemClient(fragment));
} else {
EXPECT_TRUE(IsValidDisplayItemClient(span));
EXPECT_TRUE(IsValidDisplayItemClient(text));
}
}
TEST_F(ObjectPaintInvalidatorTest, TraverseStackedFloatUnderCompositedInline) {
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
// TODO(crbug.com/922645): This test fails with LayoutNG.
if (RuntimeEnabledFeatures::LayoutNGEnabled())
return;
SetBodyInnerHTML(R"HTML(
<span id='span' style='position: relative; will-change: transform'>
<div id='target' style='position: relative; float: right'></div>
......@@ -248,29 +275,38 @@ TEST_F(ObjectPaintInvalidatorTest, TraverseStackedFloatUnderCompositedInline) {
auto* target_layer = ToLayoutBoxModelObject(target)->Layer();
auto* span = GetLayoutObjectByElementId("span");
auto* span_layer = ToLayoutBoxModelObject(span)->Layer();
auto* text = span->SlowFirstChild();
auto fragments = NGPaintFragment::InlineFragmentsFor(span);
EXPECT_TRUE(span->IsPaintInvalidationContainer());
EXPECT_TRUE(span->StyleRef().IsStackingContext());
EXPECT_EQ(span, &target->ContainerForPaintInvalidation());
EXPECT_EQ(target_layer, target->PaintingLayer());
ValidateDisplayItemClient(target);
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
for (auto* fragment : fragments)
ValidateDisplayItemClient(fragment);
} else {
ValidateDisplayItemClient(span);
ValidateDisplayItemClient(text);
}
// Traversing from span should reach target.
GetDocument().View()->SetTracksPaintInvalidations(true);
EXPECT_FALSE(span_layer->SelfNeedsRepaint());
ObjectPaintInvalidator(*span)
.InvalidateDisplayItemClientsIncludingNonCompositingDescendants(
PaintInvalidationReason::kSubtree);
EXPECT_TRUE(span_layer->SelfNeedsRepaint());
EXPECT_THAT(
*GetDocument().View()->TrackedObjectPaintInvalidations(),
ElementsAre(PaintInvalidation{span->DebugName(),
PaintInvalidationReason::kSubtree},
PaintInvalidation{"LayoutText #text",
PaintInvalidationReason::kSubtree},
PaintInvalidation{target->DebugName(),
PaintInvalidationReason::kSubtree}));
GetDocument().View()->SetTracksPaintInvalidations(false);
EXPECT_FALSE(IsValidDisplayItemClient(target));
if (RuntimeEnabledFeatures::LayoutNGEnabled()) {
for (auto* fragment : fragments)
EXPECT_FALSE(IsValidDisplayItemClient(fragment));
} else {
EXPECT_FALSE(IsValidDisplayItemClient(span));
EXPECT_FALSE(IsValidDisplayItemClient(text));
}
}
TEST_F(ObjectPaintInvalidatorTest, InvalidatePaintRectangle) {
......@@ -289,9 +325,11 @@ TEST_F(ObjectPaintInvalidatorTest, InvalidatePaintRectangle) {
target->PartialInvalidationLocalRect());
EXPECT_TRUE(target->ShouldCheckForPaintInvalidation());
EXPECT_TRUE(IsValidDisplayItemClient(target));
GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint();
EXPECT_EQ(PhysicalRect(), target->PartialInvalidationLocalRect());
EXPECT_EQ(IntRect(18, 18, 80, 80), target->PartialInvalidationVisualRect());
EXPECT_FALSE(IsValidDisplayItemClient(target));
target->InvalidatePaintRectangle(PhysicalRect(30, 30, 50, 80));
EXPECT_EQ(PhysicalRect(30, 30, 50, 80),
......@@ -301,16 +339,6 @@ TEST_F(ObjectPaintInvalidatorTest, InvalidatePaintRectangle) {
EXPECT_EQ(IntRect(18, 18, 80, 100), target->PartialInvalidationVisualRect());
UpdateAllLifecyclePhasesForTest();
EXPECT_EQ(PhysicalRect(), target->PartialInvalidationLocalRect());
EXPECT_EQ(IntRect(), target->PartialInvalidationVisualRect());
EXPECT_THAT(
*GetDocument().View()->TrackedObjectPaintInvalidations(),
ElementsAre(PaintInvalidation{target->DebugName(),
PaintInvalidationReason::kRectangle},
PaintInvalidation{target->DebugName(),
PaintInvalidationReason::kRectangle}));
const auto& raster_invalidations = GetLayoutView()
.Layer()
->GraphicsLayerBacking()
......@@ -321,7 +349,7 @@ TEST_F(ObjectPaintInvalidatorTest, InvalidatePaintRectangle) {
EXPECT_EQ(PaintInvalidationReason::kRectangle,
raster_invalidations[0].reason);
GetDocument().View()->SetTracksPaintInvalidations(false);
EXPECT_TRUE(IsValidDisplayItemClient(target));
}
TEST_F(ObjectPaintInvalidatorTest, Selection) {
......
......@@ -123,6 +123,7 @@ class PLATFORM_EXPORT DisplayItemClient {
private:
friend class FakeDisplayItemClient;
friend class ObjectPaintInvalidatorTest;
friend class PaintController;
void Validate() const {
......
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