chromium/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_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/compositing/paint_chunks_to_cc_layer.h"

#include <initializer_list>

#include "cc/layers/layer.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/paint_filter.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_op_buffer_iterator.h"
#include "cc/paint/render_surface_filters.h"
#include "cc/test/paint_op_matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h"
#include "third_party/blink/renderer/platform/graphics/paint/display_item_list.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h"
#include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_chunk.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h"
#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/testing/fake_display_item_client.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 "ui/gfx/geometry/skia_conversions.h"

namespace blink {
namespace {

PaintOpEq;
PaintOpIs;
ElementsAre;

RegionCaptureData* MakeRegionCaptureData(
    std::initializer_list<std::pair<RegionCaptureCropId, gfx::Rect>>
        map_values) {}

class PaintChunksToCcLayerTest : public testing::Test,
                                 public PaintTestConfigurations {};

INSTANTIATE_PAINT_TEST_SUITE_P();

const DisplayItemClient& DefaultClient() {}

PaintChunk::Id DefaultId() {}

void UpdateLayerProperties(cc::Layer& layer,
                           const PropertyTreeState& layer_state,
                           const PaintChunkSubset& chunks) {}

class TestChunks {};

TEST_P(PaintChunksToCcLayerTest, EffectGroupingSimple) {}

TEST_P(PaintChunksToCcLayerTest, EffectGroupingNested) {}

TEST_P(PaintChunksToCcLayerTest, EffectFilterGroupingNestedWithTransforms) {}

TEST_P(PaintChunksToCcLayerTest, InterleavedClipEffect) {}

TEST_P(PaintChunksToCcLayerTest, ClipSpaceInversion) {}

TEST_P(PaintChunksToCcLayerTest, OpacityEffectSpaceInversion) {}

TEST_P(PaintChunksToCcLayerTest, FilterEffectSpaceInversion) {}

TEST_P(PaintChunksToCcLayerTest, NonRootLayerSimple) {}

TEST_P(PaintChunksToCcLayerTest, NonRootLayerTransformEscape) {}

TEST_P(PaintChunksToCcLayerTest, EffectWithNoOutputClip) {}

TEST_P(PaintChunksToCcLayerTest,
       EffectWithNoOutputClipNestedInDecompositedEffect) {}

TEST_P(PaintChunksToCcLayerTest,
       EffectWithNoOutputClipNestedInCompositedEffect) {}

TEST_P(PaintChunksToCcLayerTest,
       EffectWithNoOutputClipNestedInCompositedEffectAndClip) {}

TEST_P(PaintChunksToCcLayerTest, VisualRect) {}

TEST_P(PaintChunksToCcLayerTest, NoncompositedClipPath) {}

TEST_P(PaintChunksToCcLayerTest, EmptyClipsAreElided) {}

TEST_P(PaintChunksToCcLayerTest, NonEmptyClipsAreStored) {}

TEST_P(PaintChunksToCcLayerTest, EmptyEffectsAreStored) {}

TEST_P(PaintChunksToCcLayerTest, CombineClips) {}

TEST_P(PaintChunksToCcLayerTest, CombineClipsAcrossTransform) {}

TEST_P(PaintChunksToCcLayerTest, CombineClipsWithRoundedRects) {}

TEST_P(PaintChunksToCcLayerTest, ChunksSamePropertyTreeState) {}

TEST_P(PaintChunksToCcLayerTest, NoOpForIdentityTransforms) {}

TEST_P(PaintChunksToCcLayerTest, EffectsWithSameTransform) {}

TEST_P(PaintChunksToCcLayerTest, NestedEffectsWithSameTransform) {}

TEST_P(PaintChunksToCcLayerTest, NoopTransformIsNotEmitted) {}

TEST_P(PaintChunksToCcLayerTest, OnlyNoopTransformIsNotEmitted) {}

TEST_P(PaintChunksToCcLayerTest, NoopTransformFirstThenBackToParent) {}

TEST_P(PaintChunksToCcLayerTest, ClipUndoesNoopTransform) {}

TEST_P(PaintChunksToCcLayerTest, EffectUndoesNoopTransform) {}

TEST_P(PaintChunksToCcLayerTest, NoopClipDoesNotEmitItems) {}

TEST_P(PaintChunksToCcLayerTest, EffectUndoesNoopClip) {}

TEST_P(PaintChunksToCcLayerTest, NoopEffectDoesNotEmitItems) {}

TEST_P(PaintChunksToCcLayerTest, EmptyChunkRect) {}

static sk_sp<cc::PaintFilter> MakeFilter(gfx::RectF bounds) {}

TEST_P(PaintChunksToCcLayerTest, ReferenceFilterOnEmptyChunk) {}

TEST_P(PaintChunksToCcLayerTest, ReferenceFilterOnChunkWithDrawingDisplayItem) {}

TEST_P(PaintChunksToCcLayerTest, FilterClipExpanderUnderClip) {}

TEST_P(PaintChunksToCcLayerTest, ScrollingContentsToPaintRecord) {}

TEST_P(PaintChunksToCcLayerTest, ScrollingContentsIntoDisplayItemList) {}

TEST_P(PaintChunksToCcLayerTest,
       ScrollingContentsIntoDisplayItemListStartingFromNestedState) {}

// This tests the following situation:
// <div id="scroller" style="width: 100px; height: 400px; overflow: scroll">
//   <div style="transform_under_scroll clip_under_scroll">
//     <div id="opacity" style="opacity: 0.5; height: 1000px">
//       Contained by scroller.
//       <div style="position: absolute">
//         Not contained by scroller.
//       </div>
//       Contained by scroller.
//     </div>
//   </div>
// </div>
TEST_P(PaintChunksToCcLayerTest,
       ScrollingContentsInterlacingNonScrollingIntoDisplayItemList) {}

TEST_P(PaintChunksToCcLayerTest, NestedScrollingContentsIntoDisplayItemList) {}

TEST_P(PaintChunksToCcLayerTest,
       NestedScrollingContentsIntoDisplayItemListStartingFromNestedState) {}

// This tests the following situation with prefer-compositing-to-lcd-text
// enabled:
// <iframe style="width: 300px; height: 300px" srcdoc='
//   <style>body { overflow: hidden }</style>
//   ...
//   <div id="bg" style="width: 50px; height: 500px; background-image: ...;
//                       background-attachment: fixed"></div>
//   </div>
//   ...
//   <script>window.scrollTo(0, 10);</script>
// '></iframe>
// The painter creates a kFixedAttachmentBackground display item whose clip
// state is the background clip which is in the scrolling contents space and
// transform is in the border box space of the frame. The fixed-attachment
// background is not composited because the scroll is not composited.
TEST_P(PaintChunksToCcLayerTest, NonCompositedFixedAttachmentBackground) {}

TEST_P(PaintChunksToCcLayerTest,
       UpdateLayerPropertiesRegionCaptureDataSetOnLayer) {}

TEST_P(PaintChunksToCcLayerTest,
       UpdateLayerPropertiesRegionCaptureDataUsesLayerOffset) {}

TEST_P(PaintChunksToCcLayerTest, UpdateLayerPropertiesRegionCaptureDataEmpty) {}

TEST_P(PaintChunksToCcLayerTest,
       UpdateLayerPropertiesRegionCaptureDataEmptyBounds) {}

TEST_P(PaintChunksToCcLayerTest,
       UpdateLayerPropertiesRegionCaptureDataMultipleChunks) {}

TEST_P(PaintChunksToCcLayerTest, NonCompositedBackdropFilter) {}

}  // namespace
}  // namespace blink