#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include <memory>
#include <string>
#include "cc/layers/picture_layer.h"
#include "cc/layers/scrollbar_layer_base.h"
#include "cc/trees/property_tree.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/transform_node.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/context_menu_data/context_menu_data.h"
#include "third_party/blink/public/common/input/web_coalesced_input_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/widget/device_emulation_params.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/web/web_ax_context.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_local_frame_client.h"
#include "third_party/blink/public/web/web_script_source.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/dom/document.h"
#include "third_party/blink/renderer/core/frame/browser_controls.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.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/web_frame_widget_impl.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/html/html_html_element.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/scroll/scroll_into_view_util.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.h"
#include "third_party/blink/renderer/core/scroll/smooth_scroll_sequencer.h"
#include "third_party/blink/renderer/core/testing/color_scheme_helper.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/compositing/paint_artifact_compositor.h"
#include "third_party/blink/renderer/platform/graphics/compositor_element_id.h"
#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h"
#include "third_party/blink/renderer/platform/testing/find_cc_layer.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/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/accessibility/ax_mode.h"
#include "ui/gfx/geometry/test/geometry_util.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
_;
PrintToString;
Mock;
UnorderedElementsAre;
ToKURL;
namespace blink {
::std::ostream& operator<<(::std::ostream& os, const ContextMenuData& data) { … }
namespace {
const cc::EffectNode* GetEffectNode(const cc::Layer* layer) { … }
class VisualViewportTest : public testing::Test,
public PaintTestConfigurations { … };
INSTANTIATE_PAINT_TEST_SUITE_P(…);
TEST_P(VisualViewportTest, TestResize) { … }
TEST_P(VisualViewportTest, TestVisibleContentRect) { … }
TEST_P(VisualViewportTest, TestResizeAtFullyScrolledPreservesViewportLocation) { … }
TEST_P(VisualViewportTest, TestResizeAfterVerticalScroll) { … }
TEST_P(VisualViewportTest, TestResizeAfterHorizontalScroll) { … }
TEST_P(VisualViewportTest, TestVisibleRect) { … }
TEST_P(VisualViewportTest, TestFractionalScrollOffsetIsNotOverwritten) { … }
TEST_P(VisualViewportTest, TestOffsetClamping) { … }
TEST_P(VisualViewportTest, TestOffsetClampingWithResize) { … }
TEST_P(VisualViewportTest, TestOffsetClampingWithResizeAndScale) { … }
TEST_P(VisualViewportTest, TestFrameViewSizedToContent) { … }
TEST_P(VisualViewportTest, TestFrameViewSizedToMinimumScale) { … }
TEST_P(VisualViewportTest, TestAttachingNewFrameSetsInnerScrollLayerSize) { … }
TEST_P(VisualViewportTest, TestFrameViewSizedToViewportMetaMinimumScale) { … }
TEST_P(VisualViewportTest, TestVisualViewportGetsSizeInAutoSizeMode) { … }
TEST_P(VisualViewportTest, TestTextSelectionHandles) { … }
TEST_P(VisualViewportTest, TestSavedToHistoryItem) { … }
TEST_P(VisualViewportTest, TestRestoredFromHistoryItem) { … }
TEST_P(VisualViewportTest, TestRestoredFromLegacyHistoryItem) { … }
TEST_P(VisualViewportTest,
TestNavigateToSmallerFrameViewHistoryItemClobberBug) { … }
TEST_P(VisualViewportTest,
DISABLED_TestWebFrameRangeAccountsForVisualViewportScroll) { … }
TEST_P(VisualViewportTest, TestWebViewResizeCausesViewportConstrainedLayout) { … }
class VisualViewportMockWebFrameClient
: public frame_test_helpers::TestWebFrameClient { … };
MATCHER_P2(ContextMenuAtLocation,
x,
y,
std::string(negation ? "is" : "isn't") + " at expected location [" +
PrintToString(x) + ", " + PrintToString(y) + "]") { … }
TEST_P(VisualViewportTest, TestContextMenuShownInCorrectLocation) { … }
TEST_P(VisualViewportTest, TestClientNotifiedOfScrollEvents) { … }
TEST_P(VisualViewportTest, ScrollIntoViewFractionalOffset) { … }
static ScrollOffset expectedMaxLayoutViewportScrollOffset(
VisualViewport& visual_viewport,
LocalFrameView& frame_view) { … }
TEST_P(VisualViewportTest, TestBrowserControlsAdjustment) { … }
TEST_P(VisualViewportTest, TestBrowserControlsAdjustmentWithScale) { … }
TEST_P(VisualViewportTest, TestBrowserControlsAdjustmentAndResize) { … }
TEST_P(VisualViewportTest, TestBrowserControlsShrinkAdjustmentAndResize) { … }
TEST_P(VisualViewportTest, TestTopControlHidingResizeDoesntClampMainFrame) { … }
static void ConfigureHiddenScrollbarsSettings(WebSettings* settings) { … }
TEST_P(VisualViewportTest,
TestScrollbarsNotAttachedWhenHideScrollbarsSettingIsTrue) { … }
TEST_P(VisualViewportTest,
TestScrollbarsAttachedWhenHideScrollbarsSettingIsFalse) { … }
TEST_P(VisualViewportTest, TestChangingContentSizeAffectsScrollBounds) { … }
TEST_P(VisualViewportTest, ResizeVisualViewportStaysWithinOuterViewport) { … }
TEST_P(VisualViewportTest, ElementBoundsInWidgetSpaceAccountsForViewport) { … }
TEST_P(VisualViewportTest, visualViewportIsInert) { … }
TEST_P(VisualViewportTest, TestMainFrameInitializationSizing) { … }
TEST_P(VisualViewportTest, FractionalMaxScrollOffset) { … }
TEST_P(VisualViewportTest, MaxScrollOffsetAtScale) { … }
TEST_P(VisualViewportTest, AccessibilityHitTestWhileZoomedIn) { … }
TEST_P(VisualViewportTest, TestCoordinateTransforms) { … }
TEST_P(VisualViewportTest, WindowDimensionsOnLoad) { … }
TEST_P(VisualViewportTest, WindowDimensionsOnLoadWideContent) { … }
TEST_P(VisualViewportTest, ResizeWithScrollAnchoring) { … }
TEST_P(VisualViewportTest, ResizeCompositedAndFixedBackground) { … }
static void ConfigureViewportNonCompositing(WebSettings* settings) { … }
TEST_P(VisualViewportTest, ResizeNonCompositedAndFixedBackground) { … }
TEST_P(VisualViewportTest, ResizeNonFixedBackgroundNoLayoutOrInvalidation) { … }
TEST_P(VisualViewportTest, InvalidateLayoutViewWhenDocumentSmallerThanView) { … }
TEST_P(VisualViewportTest, EnsureOverscrollElasticityTransformNode) { … }
TEST_P(VisualViewportTest, EnsureEffectNodeForScrollbars) { … }
TEST_P(VisualViewportTest, AutoResizeNoHeightUsesMinimumHeight) { … }
TEST_P(VisualViewportTest, SwapMainFrame) { … }
TEST_P(VisualViewportTest, SwapMainFrameLoadZoomedOut) { … }
class VisualViewportSimTest : public SimTest { … };
TEST_F(VisualViewportSimTest, ScrollingContentsSmallerThanContainer) { … }
class VisualViewportScrollIntoViewTest
: public VisualViewportSimTest,
public ::testing::WithParamInterface<
std::vector<base::test::FeatureRef>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(VisualViewportScrollIntoViewTest, ScrollingToFixed) { … }
TEST_P(VisualViewportScrollIntoViewTest, ScrollingToFixedFromJavascript) { … }
TEST_P(VisualViewportTest, DeviceEmulation) { … }
TEST_P(VisualViewportTest, PaintScrollbar) { … }
TEST_P(VisualViewportTest, DirectPinchZoomPropertyUpdate) { … }
TEST_P(VisualViewportTest, InSubtreeOfPageScale) { … }
TEST_F(VisualViewportSimTest, UsedColorSchemeFromRootElement) { … }
TEST_F(VisualViewportSimTest, ScrollbarThumbColorFromRootElement) { … }
TEST_P(VisualViewportTest, SetLocationBeforePrePaint) { … }
TEST_P(VisualViewportTest, ScrollbarGeometryOnSizeChange) { … }
TEST_F(VisualViewportSimTest, PreferredOverlayScrollbarColorTheme) { … }
}
}