Commit 0fde9a92 authored by Denis Bessonov's avatar Denis Bessonov Committed by Commit Bot

Revert "Fix 0,0-0x0 turning into PaintOp::kUnsetRect."

This reverts commit 0156c949.

Reason for revert: series of review fixes resulted in a no-op code. The completely different approach should be used to fix the bug correctly.

Original change's description:
> Fix 0,0-0x0 turning into PaintOp::kUnsetRect.
>
> When a paint chunk having 0,0-0x0 rect is processed inside an effect, an early
> return prevents the effect_bounds_stack_.back() update in a
> ConversionContext::UpdateEffectBounds call. This results in keeping default
> PaintOp::kUnsetRect in SaveLayerOp::bounds instead of 0,0-0x0 rect.
>
> This is probably a reason for a related bug 918240 (see bug thread Comment 4 for
> details). Application of this patch fixes the lagging print preview.
>
> R=​fmalita@chromium.org, samans@chromium.org
>
> Bug: 918240
> Change-Id: I022ae01418e83184421cff7e22566228a2f7c6d3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1396958
> Commit-Queue: Denis Bessonov <dbessonov@yandex-team.ru>
> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#714293}

Bug: 918240
Change-Id: I89a55d39a53559b37168b91adf3f331dbbf8b106
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007409
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Auto-Submit: Denis Bessonov <dbessonov@yandex-team.ru>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733491}
parent ae37f0f8
......@@ -91,8 +91,6 @@ class CC_PAINT_EXPORT DisplayItemList
return offset;
}
UsageHint GetUsageHint() const { return usage_hint_; }
// Called by blink::PaintChunksToCcLayer when an effect ends, to update the
// bounds of a SaveLayer[Alpha]Op which was emitted when the effect started.
// This is needed because blink doesn't know the bounds when an effect starts.
......
......@@ -172,8 +172,7 @@ class ConversionContext {
// Ends the effect on the top of the state stack if the stack is not empty,
// and update the bounds of the SaveLayer[Alpha]Op of the effect.
void EndEffect();
void UpdateEffectBounds(const base::Optional<FloatRect>&,
const TransformPaintPropertyNode&);
void UpdateEffectBounds(const FloatRect&, const TransformPaintPropertyNode&);
// Starts a clip state by adjusting the transform state, applying
// |combined_clip_rect| which is combined from one or more consecutive clips,
......@@ -244,7 +243,7 @@ class ConversionContext {
// Records the bounds of the effect which initiated the entry. Note that
// the effect is not |this->effect| (which is the previous effect), but the
// |current_effect_| when this entry is the top of the stack.
base::Optional<FloatRect> bounds;
FloatRect bounds;
};
Vector<EffectBoundsInfo> effect_bounds_stack_;
......@@ -589,25 +588,22 @@ void ConversionContext::StartEffect(const EffectPaintPropertyNode& effect) {
const ClipPaintPropertyNode* input_clip = current_clip_;
PushState(StateEntry::kEffect, saved_count);
effect_bounds_stack_.emplace_back(
EffectBoundsInfo{save_layer_id, current_transform_, base::nullopt});
EffectBoundsInfo{save_layer_id, current_transform_});
current_clip_ = input_clip;
current_effect_ = &effect;
}
void ConversionContext::UpdateEffectBounds(
const base::Optional<FloatRect>& bounds,
const FloatRect& bounds,
const TransformPaintPropertyNode& transform) {
if (effect_bounds_stack_.IsEmpty() || !bounds)
if (effect_bounds_stack_.IsEmpty() || bounds.IsEmpty())
return;
auto& effect_bounds_info = effect_bounds_stack_.back();
FloatRect mapped_bounds = *bounds;
FloatRect mapped_bounds = bounds;
GeometryMapper::SourceToDestinationRect(
transform, *effect_bounds_info.transform, mapped_bounds);
if (effect_bounds_info.bounds)
effect_bounds_info.bounds->Unite(mapped_bounds);
else
effect_bounds_info.bounds = mapped_bounds;
effect_bounds_info.bounds.Unite(mapped_bounds);
}
void ConversionContext::EndEffect() {
......@@ -621,20 +617,20 @@ void ConversionContext::EndEffect() {
DCHECK(effect_bounds_stack_.size());
const auto& bounds_info = effect_bounds_stack_.back();
base::Optional<FloatRect> bounds = bounds_info.bounds;
if (bounds) {
FloatRect bounds = bounds_info.bounds;
if (!bounds.IsEmpty()) {
if (current_effect_->Filter().IsEmpty()) {
cc_list_.UpdateSaveLayerBounds(bounds_info.save_layer_id, *bounds);
cc_list_.UpdateSaveLayerBounds(bounds_info.save_layer_id, bounds);
} else {
// The bounds for the SaveLayer[Alpha]Op should be the source bounds
// before the filter is applied, in the space of the TranslateOp which was
// emitted before the SaveLayer[Alpha]Op.
auto save_layer_bounds = *bounds;
auto save_layer_bounds = bounds;
save_layer_bounds.MoveBy(-current_effect_->FiltersOrigin());
cc_list_.UpdateSaveLayerBounds(bounds_info.save_layer_id,
save_layer_bounds);
// We need to propagate the filtered bounds to the parent.
bounds = current_effect_->MapRect(*bounds);
bounds = current_effect_->MapRect(bounds);
}
}
......@@ -753,17 +749,7 @@ void ConversionContext::Convert(const PaintChunkSubset& paint_chunks,
cc_list_.EndPaintOfUnpaired(
chunk_to_layer_mapper_.MapVisualRect(item.VisualRect()));
}
// Chunk bounds are only important when we are actually drawing. There may
// also be cases when we only generate a paint record and do not draw,
// for example, to implement an SVG clip. In such cases, we can safely
// ignore effect bounds.
base::Optional<FloatRect> chunk_bounds;
if (cc_list_.GetUsageHint() ==
cc::DisplayItemList::kTopLevelDisplayItemList) {
chunk_bounds = FloatRect(chunk.bounds);
}
UpdateEffectBounds(chunk_bounds, chunk_state.Transform());
UpdateEffectBounds(FloatRect(chunk.bounds), chunk_state.Transform());
}
}
......
......@@ -101,7 +101,7 @@ class PaintRecordMatcher
Vector<cc::PaintOpType> expected_ops_;
};
#define EXPECT_EFFECT_BOUNDS(rect, op_buffer, index) \
#define EXPECT_EFFECT_BOUNDS(x, y, width, height, op_buffer, index) \
do { \
FloatRect bounds; \
if (const auto* save_layer_alpha = \
......@@ -113,7 +113,7 @@ class PaintRecordMatcher
} else { \
FAIL() << "No SaveLayer[Alpha]Op at " << index; \
} \
EXPECT_EQ(rect, bounds); \
EXPECT_EQ(FloatRect(x, y, width, height), bounds); \
} while (false)
#define EXPECT_TRANSFORM_MATRIX(transform, op_buffer, index) \
......@@ -183,10 +183,6 @@ struct TestChunks {
}
};
const cc::DisplayItemList::UsageHint kUsageHints[] = {
cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer,
cc::DisplayItemList::kTopLevelDisplayItemList};
TEST_P(PaintChunksToCcLayerTest, EffectGroupingSimple) {
// This test verifies effects are applied as a group.
auto e1 = CreateOpacityEffect(e0(), 0.5f);
......@@ -194,14 +190,10 @@ TEST_P(PaintChunksToCcLayerTest, EffectGroupingSimple) {
chunks.AddChunk(t0(), c0(), *e1, IntRect(0, 0, 50, 50));
chunks.AddChunk(t0(), c0(), *e1, IntRect(20, 20, 70, 70));
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 90, 90)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -209,8 +201,7 @@ TEST_P(PaintChunksToCcLayerTest, EffectGroupingSimple) {
cc::PaintOpType::DrawRecord, // <p0/>
cc::PaintOpType::DrawRecord, // <p1/>
cc::PaintOpType::Restore})); // </e1>
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 0);
}
EXPECT_EFFECT_BOUNDS(0, 0, 90, 90, *output, 0);
}
TEST_P(PaintChunksToCcLayerTest, EffectGroupingNested) {
......@@ -222,18 +213,10 @@ TEST_P(PaintChunksToCcLayerTest, EffectGroupingNested) {
chunks.AddChunk(t0(), c0(), *e2);
chunks.AddChunk(t0(), c0(), *e3, IntRect(111, 222, 333, 444));
const FloatRect kExpectedBounds1[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 444, 666)};
const FloatRect kExpectedBounds2[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
const FloatRect kExpectedBounds3[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(111, 222, 333, 444)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -245,10 +228,9 @@ TEST_P(PaintChunksToCcLayerTest, EffectGroupingNested) {
cc::PaintOpType::DrawRecord, // <p1/>
cc::PaintOpType::Restore, // </e3>
cc::PaintOpType::Restore})); // </e1>
EXPECT_EFFECT_BOUNDS(kExpectedBounds1[hint], *output, 0);
EXPECT_EFFECT_BOUNDS(kExpectedBounds2[hint], *output, 1);
EXPECT_EFFECT_BOUNDS(kExpectedBounds3[hint], *output, 4);
}
EXPECT_EFFECT_BOUNDS(0, 0, 444, 666, *output, 0);
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 1);
EXPECT_EFFECT_BOUNDS(111, 222, 333, 444, *output, 4);
}
TEST_P(PaintChunksToCcLayerTest, EffectFilterGroupingNestedWithTransforms) {
......@@ -264,16 +246,10 @@ TEST_P(PaintChunksToCcLayerTest, EffectFilterGroupingNestedWithTransforms) {
chunks.AddChunk(*t2, c0(), *e1, IntRect(0, 0, 50, 50));
chunks.AddChunk(*t1, c0(), *e2, IntRect(20, 20, 70, 70));
const FloatRect kExpectedBounds1[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 155, 155)};
const FloatRect kExpectedBounds2[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(10, 10, 70, 70)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -293,18 +269,17 @@ TEST_P(PaintChunksToCcLayerTest, EffectFilterGroupingNestedWithTransforms) {
cc::PaintOpType::Restore})); // </t1*t2>
EXPECT_TRANSFORM_MATRIX(t1->Matrix() * t2->SlowMatrix(), *output, 1);
// chunk1.bounds + e2(t2^-1(chunk2.bounds))
EXPECT_EFFECT_BOUNDS(kExpectedBounds1[hint], *output, 2);
EXPECT_EFFECT_BOUNDS(0, 0, 155, 155, *output, 2);
// e2_offset
EXPECT_TRANSLATE(60, 60, *output, 5);
// t2^-1(chunk2.bounds) - e2_offset
EXPECT_EFFECT_BOUNDS(kExpectedBounds2[hint], *output, 6);
EXPECT_EFFECT_BOUNDS(10, 10, 70, 70, *output, 6);
// -e2_offset
EXPECT_TRANSLATE(-e2->FiltersOrigin().X(), -e2->FiltersOrigin().Y(),
*output, 7);
EXPECT_TRANSLATE(-e2->FiltersOrigin().X(), -e2->FiltersOrigin().Y(), *output,
7);
// t2^1
EXPECT_TRANSLATE(-t2->Translation2D().Width(),
-t2->Translation2D().Height(), *output, 9);
}
EXPECT_TRANSLATE(-t2->Translation2D().Width(), -t2->Translation2D().Height(),
*output, 9);
}
TEST_P(PaintChunksToCcLayerTest, InterleavedClipEffect) {
......@@ -326,16 +301,10 @@ TEST_P(PaintChunksToCcLayerTest, InterleavedClipEffect) {
chunks.AddChunk(t0(), *c3, *e1, IntRect(20, 20, 70, 70));
chunks.AddChunk(t0(), *c4, e0());
const FloatRect kExpectedBounds1[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 90, 90)};
const FloatRect kExpectedBounds2[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 50, 50)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(*output, PaintRecordMatcher::Make(
{cc::PaintOpType::Save,
......@@ -362,9 +331,8 @@ TEST_P(PaintChunksToCcLayerTest, InterleavedClipEffect) {
cc::PaintOpType::DrawRecord, // <p4/>
cc::PaintOpType::Restore, // </c3+c4>
cc::PaintOpType::Restore})); // </c1+c2>
EXPECT_EFFECT_BOUNDS(kExpectedBounds1[hint], *output, 7);
EXPECT_EFFECT_BOUNDS(kExpectedBounds2[hint], *output, 10);
}
EXPECT_EFFECT_BOUNDS(0, 0, 90, 90, *output, 7);
EXPECT_EFFECT_BOUNDS(0, 0, 50, 50, *output, 10);
}
TEST_P(PaintChunksToCcLayerTest, ClipSpaceInversion) {
......@@ -407,14 +375,10 @@ TEST_P(PaintChunksToCcLayerTest, OpacityEffectSpaceInversion) {
chunks.AddChunk(t0(), c0(), *e1);
chunks.AddChunk(*t1, c0(), *e1);
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(*output,
PaintRecordMatcher::Make(
......@@ -426,10 +390,9 @@ TEST_P(PaintChunksToCcLayerTest, OpacityEffectSpaceInversion) {
cc::PaintOpType::DrawRecord, // <p1/>
cc::PaintOpType::Restore, // </e1>
cc::PaintOpType::Restore})); // </t1>
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 2);
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 2);
EXPECT_TRANSFORM_MATRIX(t1->Matrix(), *output, 1);
EXPECT_TRANSFORM_MATRIX(t1->Matrix().Inverse(), *output, 4);
}
}
TEST_P(PaintChunksToCcLayerTest, FilterEffectSpaceInversion) {
......@@ -447,13 +410,10 @@ TEST_P(PaintChunksToCcLayerTest, FilterEffectSpaceInversion) {
TestChunks chunks;
chunks.AddChunk(t0(), c0(), *e1);
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(-66, -88, 50, 50)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
auto output = PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items, kUsageHints[hint])
auto output =
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -470,10 +430,9 @@ TEST_P(PaintChunksToCcLayerTest, FilterEffectSpaceInversion) {
cc::PaintOpType::Restore})); // </t1>
EXPECT_TRANSFORM_MATRIX(t1->Matrix(), *output, 1);
EXPECT_TRANSLATE(66, 88, *output, 3);
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 4);
EXPECT_EFFECT_BOUNDS(-66, -88, 50, 50, *output, 4);
EXPECT_TRANSLATE(-66, -88, *output, 5);
EXPECT_TRANSFORM_MATRIX(t1->Matrix().Inverse(), *output, 7);
}
}
TEST_P(PaintChunksToCcLayerTest, NonRootLayerSimple) {
......@@ -523,14 +482,10 @@ TEST_P(PaintChunksToCcLayerTest, EffectWithNoOutputClip) {
TestChunks chunks;
chunks.AddChunk(t0(), *c2, *e1);
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState(t0(), *c1, e0()), gfx::Vector2dF(),
chunks.items, kUsageHints[hint])
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -540,8 +495,7 @@ TEST_P(PaintChunksToCcLayerTest, EffectWithNoOutputClip) {
cc::PaintOpType::DrawRecord, // <p0/>
cc::PaintOpType::Restore, // </c2>
cc::PaintOpType::Restore})); // </e1>
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 0);
}
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 0);
}
TEST_P(PaintChunksToCcLayerTest,
......@@ -553,16 +507,10 @@ TEST_P(PaintChunksToCcLayerTest,
TestChunks chunks;
chunks.AddChunk(t0(), *c1, *e2);
const FloatRect kExpectedBounds1[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
const FloatRect kExpectedBounds2[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -574,9 +522,8 @@ TEST_P(PaintChunksToCcLayerTest,
cc::PaintOpType::Restore, // </c1>
cc::PaintOpType::Restore, // </e2>
cc::PaintOpType::Restore})); // </e1>
EXPECT_EFFECT_BOUNDS(kExpectedBounds1[hint], *output, 0);
EXPECT_EFFECT_BOUNDS(kExpectedBounds2[hint], *output, 1);
}
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 0);
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 1);
}
TEST_P(PaintChunksToCcLayerTest,
......@@ -588,14 +535,10 @@ TEST_P(PaintChunksToCcLayerTest,
TestChunks chunks;
chunks.AddChunk(t0(), *c1, *e2);
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState(t0(), c0(), *e1), gfx::Vector2dF(),
chunks.items, kUsageHints[hint])
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
......@@ -605,8 +548,7 @@ TEST_P(PaintChunksToCcLayerTest,
cc::PaintOpType::DrawRecord, // <p0/>
cc::PaintOpType::Restore, // </c1>
cc::PaintOpType::Restore})); // </e2>
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 0);
}
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 0);
}
TEST_P(PaintChunksToCcLayerTest,
......@@ -618,22 +560,17 @@ TEST_P(PaintChunksToCcLayerTest,
TestChunks chunks;
chunks.AddChunk(t0(), *c1, *e2);
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState(t0(), *c1, *e1), gfx::Vector2dF(),
chunks.items, kUsageHints[hint])
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(
*output,
PaintRecordMatcher::Make({cc::PaintOpType::SaveLayerAlpha, // <e2>
cc::PaintOpType::DrawRecord, // <p0/>
cc::PaintOpType::Restore})); // </e2>
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 0);
}
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 0);
}
TEST_P(PaintChunksToCcLayerTest, VisualRect) {
......@@ -751,22 +688,17 @@ TEST_P(PaintChunksToCcLayerTest, EmptyEffectsAreStored) {
chunks.AddChunk(nullptr, t0(), c0(), e0());
chunks.AddChunk(nullptr, t0(), c0(), *e1);
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 100, 100)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
sk_sp<PaintRecord> output =
PaintChunksToCcLayer::Convert(chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items,
kUsageHints[hint])
PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(), gfx::Vector2dF(),
chunks.items, cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord();
EXPECT_THAT(*output, PaintRecordMatcher::Make({
cc::PaintOpType::SaveLayerAlpha, // <e1>
cc::PaintOpType::Restore, // </e1>
}));
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 0);
}
EXPECT_EFFECT_BOUNDS(0, 0, 100, 100, *output, 0);
}
TEST_P(PaintChunksToCcLayerTest, CombineClips) {
......@@ -1381,28 +1313,5 @@ TEST_P(PaintChunksToCcLayerTest, AllowChunkEscapeLayerNoopEffects) {
}));
}
// https://crbug.com/918240
TEST_P(PaintChunksToCcLayerTest, EmptyChunkRectDoesntTurnToUnsetOne) {
CompositorFilterOperations filter;
filter.AppendBlurFilter(5);
auto e1 = CreateFilterEffect(e0(), t0(), &c0(), filter, FloatPoint(0, 0));
TestChunks chunks;
chunks.AddChunk(nullptr, t0(), c0(), *e1, {0, 0, 0, 0});
const FloatRect kExpectedBounds[] = {FloatRect(cc::PaintOp::kUnsetRect),
FloatRect(0, 0, 0, 0)};
for (size_t hint = 0; hint < base::size(kUsageHints); ++hint) {
auto output = PaintChunksToCcLayer::Convert(
chunks.chunks, PropertyTreeState::Root(),
gfx::Vector2dF(), chunks.items, kUsageHints[hint])
->ReleaseAsRecord();
EXPECT_THAT(*output,
PaintRecordMatcher::Make({cc::PaintOpType::SaveLayer, // <e1>
cc::PaintOpType::Restore})); // </e1>
EXPECT_EFFECT_BOUNDS(kExpectedBounds[hint], *output, 0);
}
}
} // namespace
} // 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