#include "base/test/scoped_feature_list.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/keyframe_effect.h"
#include "cc/base/features.h"
#include "cc/input/main_thread_scrolling_reason.h"
#include "cc/layers/scrollbar_layer_base.h"
#include "cc/trees/compositor_commit_data.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/property_tree.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/sticky_position_constraint.h"
#include "content/test/test_blink_web_unit_test_support.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_cache.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/public/web/web_view_client.h"
#include "third_party/blink/renderer/core/css/css_style_sheet.h"
#include "third_party/blink/renderer/core/css/style_sheet_list.h"
#include "third_party/blink/renderer/core/dom/events/add_event_listener_options_resolved.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.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/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/html/html_iframe_element.h"
#include "third_party/blink/renderer/core/html/html_object_element.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.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/animation/compositor_animation.h"
#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"
#include "third_party/blink/renderer/platform/graphics/test/fake_gles2_interface.h"
#include "third_party/blink/renderer/platform/graphics/test/fake_web_graphics_context_3d_provider.h"
#include "third_party/blink/renderer/platform/graphics/touch_action.h"
#include "third_party/blink/renderer/platform/region_capture_crop_id.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/find_cc_layer.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.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/testing/url_loader_mock_factory.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
namespace blink {
namespace {
constexpr char kHttpBaseUrl[] = …;
constexpr char kHttpsBaseUrl[] = …;
cc::Region RegionFromRects(std::initializer_list<gfx::Rect> rects) { … }
}
class ScrollingTest : public testing::Test, public PaintTestConfigurations { … };
INSTANTIATE_PAINT_TEST_SUITE_P(…);
#define ASSERT_COMPOSITED(scroll_node) …
#define ASSERT_NOT_COMPOSITED(scroll_node, \
expected_main_thread_scrolling_reasons) …
TEST_P(ScrollingTest, fastScrollingByDefault) { … }
TEST_P(ScrollingTest, fastFractionalScrollingDiv) { … }
TEST_P(ScrollingTest, fastScrollingForFixedPosition) { … }
static cc::StickyPositionConstraint GetStickyConstraint(Element* element) { … }
TEST_P(ScrollingTest, fastScrollingForStickyPosition) { … }
TEST_P(ScrollingTest, elementPointerEventHandler) { … }
TEST_P(ScrollingTest, touchEventHandler) { … }
TEST_P(ScrollingTest, elementBlockingTouchEventHandler) { … }
TEST_P(ScrollingTest, touchEventHandlerPassive) { … }
TEST_P(ScrollingTest, elementTouchEventHandlerPassive) { … }
TEST_P(ScrollingTest, TouchActionRectsOnImage) { … }
TEST_P(ScrollingTest, touchEventHandlerBoth) { … }
TEST_P(ScrollingTest, wheelEventHandler) { … }
TEST_P(ScrollingTest, wheelEventHandlerPassive) { … }
TEST_P(ScrollingTest, wheelEventHandlerBoth) { … }
TEST_P(ScrollingTest, scrollEventHandler) { … }
TEST_P(ScrollingTest, updateEventHandlersDuringTeardown) { … }
TEST_P(ScrollingTest, clippedBodyTest) { … }
TEST_P(ScrollingTest, touchAction) { … }
TEST_P(ScrollingTest, touchActionRegions) { … }
TEST_P(ScrollingTest, touchActionNesting) { … }
TEST_P(ScrollingTest, nestedTouchActionInvalidation) { … }
TEST_P(ScrollingTest, nestedTouchActionChangesUnion) { … }
TEST_P(ScrollingTest, touchActionEditableElement) { … }
TEST_P(ScrollingTest, touchActionExcludesBoxShadow) { … }
TEST_P(ScrollingTest, touchActionOnInline) { … }
TEST_P(ScrollingTest, touchActionOnText) { … }
TEST_P(ScrollingTest, touchActionWithVerticalRLWritingMode) { … }
TEST_P(ScrollingTest, touchActionBlockingHandler) { … }
TEST_P(ScrollingTest, touchActionOnScrollingElement) { … }
TEST_P(ScrollingTest, IframeWindowTouchHandler) { … }
TEST_P(ScrollingTest, WindowTouchEventHandler) { … }
namespace {
class ScrollingTestMockEventListener final : public NativeEventListener { … };
}
TEST_P(ScrollingTest, WindowTouchEventHandlerInvalidation) { … }
TEST_P(ScrollingTest, TouchActionChangeWithoutContent) { … }
TEST_P(ScrollingTest, WheelEventRegion) { … }
TEST_P(ScrollingTest, WheelEventHandlerInvalidation) { … }
TEST_P(ScrollingTest, WheelEventRegions) { … }
TEST_P(ScrollingTest, WheelEventRegionOnScrollWithoutDrawableContents) { … }
TEST_P(ScrollingTest, WheelEventRegionOnScrollWithDrawableContents) { … }
TEST_P(ScrollingTest, TouchActionRegionOnScrollWithoutDrawableContents) { … }
TEST_P(ScrollingTest, TouchActionRegionOnScrollWithDrawableContents) { … }
TEST_P(ScrollingTest, NonCompositedMainThreadRepaintWithCaptureRegion) { … }
TEST_P(ScrollingTest, NonCompositedMainThreadRepaintWithLayerSelection) { … }
TEST_P(ScrollingTest, WheelEventRegionExcludesBoxShadow) { … }
TEST_P(ScrollingTest, IframeWindowWheelEventHandler) { … }
TEST_P(ScrollingTest, WindowWheelEventHandler) { … }
TEST_P(ScrollingTest, WindowWheelEventHandlerInvalidation) { … }
TEST_P(ScrollingTest, WheelEventHandlerChangeWithoutContent) { … }
TEST_P(ScrollingTest, PluginBecomesLayoutInline) { … }
TEST_P(ScrollingTest, WheelEventRegionsForPlugins) { … }
TEST_P(ScrollingTest, MainThreadScrollHitTestRegionWithBorder) { … }
TEST_P(ScrollingTest, NonFastScrollableRegionWithBorderAndBorderRadius) { … }
TEST_P(ScrollingTest, FastNonCompositedScrollHitTest) { … }
TEST_P(ScrollingTest, ElementRegionCaptureData) { … }
TEST_P(ScrollingTest, overflowScrolling) { … }
TEST_P(ScrollingTest, overflowHidden) { … }
TEST_P(ScrollingTest, iframeScrolling) { … }
TEST_P(ScrollingTest, rtlIframe) { … }
TEST_P(ScrollingTest, setupScrollbarLayerShouldNotCrash) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID)
TEST_P(ScrollingTest, DISABLED_setupScrollbarLayerShouldSetScrollLayerOpaque)
#else
TEST_P(ScrollingTest, setupScrollbarLayerShouldSetScrollLayerOpaque)
#endif
{ … }
TEST_P(ScrollingTest, NestedIFramesMainThreadScrollingRegion) { … }
TEST_P(ScrollingTest, NestedFixedIFramesMainThreadScrollingRegion) { … }
TEST_P(ScrollingTest, IframeCompositedScrolling) { … }
TEST_P(ScrollingTest, IframeNonCompositedScrollingHideAndShow) { … }
TEST_P(ScrollingTest, IframeNonCompositedScrollingHideAndShowVisibility) { … }
TEST_P(ScrollingTest, IframeNonCompositedScrollingHideAndShowScrollable) { … }
TEST_P(ScrollingTest, IframeNonCompositedScrollingNested) { … }
TEST_P(ScrollingTest, IframeNonCompositedScrollingTransformed) { … }
TEST_P(ScrollingTest, IframeNonCompositedScrollingPageScaled) { … }
TEST_P(ScrollingTest, NonCompositedScrollTransformChange) { … }
TEST_P(ScrollingTest, ScrollOffsetClobberedBeforeCompositingUpdate) { … }
TEST_P(ScrollingTest, UpdateVisualViewportScrollLayer) { … }
TEST_P(ScrollingTest, NonCompositedMainThreadScrollHitTestRegion) { … }
TEST_P(ScrollingTest, NonCompositedResizerMainThreadScrollHitTestRegion) { … }
TEST_P(ScrollingTest, CompositedResizerMainThreadScrollHitTestRegion) { … }
TEST_P(ScrollingTest, TouchActionUpdatesOutsideInterestRect) { … }
TEST_P(ScrollingTest, MainThreadScrollAndDeltaFromImplSide) { … }
TEST_P(ScrollingTest, ThumbInvalidatesLayer) { … }
class UnifiedScrollingSimTest : public SimTest, public PaintTestConfigurations { … };
INSTANTIATE_PAINT_TEST_SUITE_P(…);
TEST_P(UnifiedScrollingSimTest, ScrollNodeForNonCompositedScroller) { … }
TEST_P(UnifiedScrollingSimTest,
ScrollNodeForCompositedToNonCompositedScroller) { … }
TEST_P(UnifiedScrollingSimTest, ScrollNodeForEmbeddedScrollers) { … }
TEST_P(UnifiedScrollingSimTest, ScrollNodeForNestedEmbeddedScrollers) { … }
TEST_P(UnifiedScrollingSimTest, ScrollNodeForInvisibleNonCompositedScroller) { … }
TEST_P(UnifiedScrollingSimTest, ScrollNodeForInputBox) { … }
class ScrollingSimTest : public SimTest { … };
TEST_F(ScrollingSimTest, BasicScroll) { … }
TEST_F(ScrollingSimTest, ImmediateCompositedScroll) { … }
TEST_F(ScrollingSimTest, CompositedScrollDeferredWithLinkedAnimation) { … }
TEST_F(ScrollingSimTest, CompositedStickyTracksMainRepaintScroll) { … }
TEST_F(ScrollingSimTest, ScrollTimelineActiveAtBoundary) { … }
TEST_F(ScrollingSimTest, ScrollLayoutTriggers) { … }
TEST_F(ScrollingSimTest, CompositedScrollbarScrollDoesNotBubble) { … }
class ScrollingTestWithAcceleratedContext : public ScrollingTest { … };
INSTANTIATE_PAINT_TEST_SUITE_P(…);
TEST_P(ScrollingTestWithAcceleratedContext, CanvasTouchActionRects) { … }
}