chromium/third_party/blink/renderer/platform/graphics/paint/raster_invalidator_test.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h"

#include <utility>
#include "base/functional/function_ref.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/test_paint_artifact.h"
#include "ui/gfx/geometry/rect_conversions.h"

ElementsAre;

namespace blink {

static constexpr gfx::Vector2dF kDefaultLayerOffset(-9999, -7777);
static constexpr gfx::Size kDefaultLayerBounds(18888, 16666);

class RasterInvalidatorTest : public testing::Test,
                              public PaintTestConfigurations,
                              public RasterInvalidator::Callback {};

INSTANTIATE_PAINT_TEST_SUITE_P();

MapFunction;
void MapNothing(gfx::Rect&) {}
void PrintTo(MapFunction, std::ostream*) {}

static gfx::Rect ChunkRectToLayer(const gfx::Rect& rect,
                                  const gfx::Vector2dF& layer_offset,
                                  MapFunction mapper = MapNothing) {}

static bool CheckChunkInvalidation(
    const RasterInvalidationInfo& info,
    const PaintChunkSubset& chunks,
    wtf_size_t index,
    PaintInvalidationReason reason,
    const gfx::Vector2dF& layer_offset,
    const std::optional<gfx::Rect>& chunk_rect = std::nullopt,
    MapFunction mapper = MapNothing) {}

MATCHER_P5(ChunkInvalidation, chunks, index, reason, layer_offset, mapper, "") {}

MATCHER_P4(ChunkInvalidation, chunks, index, reason, layer_offset, "") {}

MATCHER_P3(ChunkInvalidation, chunks, index, reason, "") {}

MATCHER_P3(IncrementalInvalidation, chunks, index, chunk_rect, "") {}

TEST_P(RasterInvalidatorTest, ImplicitFullLayerInvalidation) {}

TEST_P(RasterInvalidatorTest, LayerBounds) {}

TEST_P(RasterInvalidatorTest, LayerOffsetChangeWithCachedSubsequence) {}

TEST_P(RasterInvalidatorTest, LayerStateChangeWithCachedSubsequence) {}

TEST_P(RasterInvalidatorTest, ReorderChunks) {}

TEST_P(RasterInvalidatorTest, ReorderChunkSubsequences) {}

TEST_P(RasterInvalidatorTest, ScrollDown) {}

TEST_P(RasterInvalidatorTest, ScrollUp) {}

TEST_P(RasterInvalidatorTest, ChunkAppearAndDisappear) {}

TEST_P(RasterInvalidatorTest, InvalidateDrawableBounds) {}

TEST_P(RasterInvalidatorTest, ChunkAppearAtEnd) {}

TEST_P(RasterInvalidatorTest, UncacheableChunks) {}

// Tests the path based on ClipPaintPropertyNode::Changed().
TEST_P(RasterInvalidatorTest, ClipPropertyChangeRounded) {}

// Tests the path detecting change of PaintChunkInfo::chunk_to_layer_clip.
TEST_P(RasterInvalidatorTest, ClipPropertyChangeSimple) {}

TEST_P(RasterInvalidatorTest, ClipChangeOnCachedSubsequence) {}

// Tests the path detecting change of PaintChunkInfo::chunk_to_layer_clip.
// The chunk bounds is bigger than the clip because of the outset for raster
// effects, so incremental invalidation is not suitable.
TEST_P(RasterInvalidatorTest, ClipPropertyChangeWithOutsetForRasterEffects) {}

TEST_P(RasterInvalidatorTest, ClipLocalTransformSpaceChange) {}

// This is based on ClipLocalTransformSpaceChange, but tests the no-invalidation
// path by letting the clip's LocalTransformSpace be the same as the chunk's
// transform.
TEST_P(RasterInvalidatorTest, ClipLocalTransformSpaceChangeNoInvalidation) {}

TEST_P(RasterInvalidatorTest, TransformPropertyChange) {}

TEST_P(RasterInvalidatorTest, TransformPropertyTinyChange) {}

TEST_P(RasterInvalidatorTest, TransformPropertyTinyChangeScale) {}

TEST_P(RasterInvalidatorTest, EffectLocalTransformSpaceChange) {}

// This is based on EffectLocalTransformSpaceChange, but tests the no-
// invalidation path by letting the effect's LocalTransformSpace be the same as
// the chunk's transform.
TEST_P(RasterInvalidatorTest, EffectLocalTransformSpaceChangeNoInvalidation) {}

TEST_P(RasterInvalidatorTest, AliasEffectParentChanges) {}

TEST_P(RasterInvalidatorTest, NestedAliasEffectParentChanges) {}

TEST_P(RasterInvalidatorTest, EffectWithAliasTransformWhoseParentChanges) {}

TEST_P(RasterInvalidatorTest, EffectChangeSimple) {}

TEST_P(RasterInvalidatorTest, EffectChangeOnCachedSubsequence) {}

}  // namespace blink