chromium/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc

// Copyright 2016 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/core/svg/graphics/svg_image.h"

#include <memory>

#include "base/memory/ptr_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_op.h"
#include "cc/paint/paint_op_buffer_iterator.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/scheme_registry.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/layout/layout_shift_tracker.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/svg/animation/smil_time_container.h"
#include "third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h"
#include "third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h"
#include "third_party/blink/renderer/core/svg/svg_svg_element.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/utils/SkNullCanvas.h"
#include "ui/gfx/geometry/rect_f.h"

namespace blink {

class SVGImageTest : public testing::Test, private ScopedMockOverlayScrollbars {};

const char kAnimatedDocument[] =;

TEST_F(SVGImageTest, TimelineSuspendAndResume) {}

TEST_F(SVGImageTest, ResetAnimation) {}

TEST_F(SVGImageTest, SupportsSubsequenceCaching) {}

TEST_F(SVGImageTest, LayoutShiftTrackerDisabled) {}

TEST_F(SVGImageTest, SetSizeOnVisualViewport) {}

TEST_F(SVGImageTest, IsSizeAvailable) {}

TEST_F(SVGImageTest, DisablesSMILEvents) {}

TEST_F(SVGImageTest, PaintFrameForCurrentFrameWithMQAndZoom) {}

TEST_F(SVGImageTest, SVGWithSmilAnimationIsAnimated) {}

TEST_F(SVGImageTest, NestedSVGWithSmilAnimationIsAnimated) {}

class SVGImageSimTest : public SimTest, private ScopedMockOverlayScrollbars {};

TEST_F(SVGImageSimTest, PageVisibilityHiddenToVisible) {}

const char kSmilAnimatedDocument[] =;

TEST_F(SVGImageSimTest, AnimationsPausedWhenImageScrolledOutOfView) {}

TEST_F(SVGImageSimTest, AnimationsResumedWhenImageScrolledIntoView) {}

TEST_F(SVGImageSimTest, TwoImagesSameSVGImageDifferentSize) {}

TEST_F(SVGImageSimTest, SVGWithXSLT) {}

namespace {

size_t CountPaintOpType(const cc::PaintRecord& record, cc::PaintOpType type) {}

}  // namespace

// Tests the culling of invisible sprites from a larger sprite sheet.
TEST_F(SVGImageSimTest, SpriteSheetCulling) {}

// Tests the culling of invisible sprites from a larger sprite sheet where the
// element also has a border-radius. This is intended to cover the
// Image::ApplyShader() fast-path in GraphicsContext::DrawImageRRect().
TEST_F(SVGImageSimTest, SpriteSheetCullingBorderRadius) {}

// Similar to `SpriteSheetCulling` but using a full-sized sprite sheet <img>
// element with absolute positioning under overflow: hidden. This pattern is
// used by Google Docs.
TEST_F(SVGImageSimTest, ClippedAbsoluteImageSpriteSheetCulling) {}

// Similar to `SpriteSheetCulling` but using a full-sized sprite sheet <img>
// element under overflow: hidden. This differs from
// `ClippedAbsoluteImageSpriteSheetCulling` because static positioning and
// margin are used to position the image, rather than absolute positioning.
TEST_F(SVGImageSimTest, ClippedStaticImageSpriteSheetCulling) {}

// Similar to `SpriteSheetCulling` but using a regular scrolling interest rect
// that isn't clipping to a specific sprite within the image. To avoid
// regressing non-sprite-sheet paint performance with additional invalidatoins,
// we want to avoid special culling in these cases.
TEST_F(SVGImageSimTest, InterestRectDoesNotCullImageSpriteSheet) {}

// Tests the culling of non-drawing items from a larger sprite sheet.
TEST_F(SVGImageSimTest, SpriteSheetNonDrawingCulling) {}

}  // namespace blink