chromium/third_party/blink/renderer/core/layout/scroll_anchor_test.cc

// Copyright 2015 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/layout/scroll_anchor.h"

#include "build/build_config.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/dom/static_node_list.h"
#include "third_party/blink/renderer/core/editing/finder/text_finder.h"
#include "third_party/blink/renderer/core/frame/find_in_page.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/root_frame_viewport.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/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/page/print_context.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/scoped_mock_overlay_scrollbars.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/bindings/script_forbidden_scope.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"

namespace blink {

Corner;

class ScrollAnchorTest : public SimTest {};

// TODO(skobes): Convert this to web-platform-tests when visual viewport API is
// launched (http://crbug.com/635031).
TEST_F(ScrollAnchorTest, VisualViewportAnchors) {}

// Test that a non-anchoring scroll on scroller clears scroll anchors for all
// parent scrollers.
TEST_F(ScrollAnchorTest, ClearScrollAnchorsOnAncestors) {}

TEST_F(ScrollAnchorTest, AncestorClearingWithSiblingReference) {}

TEST_F(ScrollAnchorTest, FractionalOffsetsAreRoundedBeforeComparing) {}

TEST_F(ScrollAnchorTest, AvoidStickyAnchorWhichMovesWithScroll) {}

TEST_F(ScrollAnchorTest, AnchorWithLayerInScrollingDiv) {}

TEST_F(ScrollAnchorTest, AnchorWhileDraggingScrollbar) {}

// Verify that a nested scroller with a div that has its own PaintLayer can be
// removed without causing a crash. This test passes if it doesn't crash.
TEST_F(ScrollAnchorTest, RemoveScrollerWithLayerInScrollingDiv) {}

TEST_F(ScrollAnchorTest, FlexboxDelayedClampingAlsoDelaysAdjustment) {}

TEST_F(ScrollAnchorTest, FlexboxDelayedAdjustmentRespectsSANACLAP) {}

// This test verifies that scroll anchoring is disabled when the document is in
// printing mode.
TEST_F(ScrollAnchorTest, AnchoringDisabledForPrinting) {}

TEST_F(ScrollAnchorTest, SerializeAnchorSimple) {}

TEST_F(ScrollAnchorTest, SerializeAnchorUsesTagname) {}

TEST_F(ScrollAnchorTest, SerializeAnchorSetsIsAnchorBit) {}

TEST_F(ScrollAnchorTest, SerializeAnchorSetsSavedRelativeOffset) {}

TEST_F(ScrollAnchorTest, SerializeAnchorUsesClassname) {}

TEST_F(ScrollAnchorTest, SerializeAnchorUsesNthChild) {}

TEST_F(ScrollAnchorTest, SerializeAnchorUsesLeastSpecificSelector) {}

TEST_F(ScrollAnchorTest, SerializeAnchorWithNoIdAttribute) {}

TEST_F(ScrollAnchorTest, SerializeAnchorChangesWithScroll) {}

TEST_F(ScrollAnchorTest, SerializeAnchorVerticalWritingMode) {}

TEST_F(ScrollAnchorTest, RestoreAnchorVerticalRlWritingMode) {}

TEST_F(ScrollAnchorTest, SerializeAnchorQualifiedTagName) {}

TEST_F(ScrollAnchorTest, SerializeAnchorLimitsSelectorLength) {}

TEST_F(ScrollAnchorTest, SerializeAnchorIgnoresDuplicatedId) {}

TEST_F(ScrollAnchorTest, SerializeAnchorFailsForPseudoElement) {}

TEST_F(ScrollAnchorTest, SerializeAnchorFailsForShadowDOMElement) {}

TEST_F(ScrollAnchorTest, RestoreAnchorSimple) {}

TEST_F(ScrollAnchorTest, RestoreAnchorNonTrivialSelector) {}

TEST_F(ScrollAnchorTest, RestoreAnchorFailsForInvalidSelectors) {}

// Ensure that when the serialized selector refers to a non-box, non-text
// element(meaning its corresponding LayoutObject can't be the anchor object)
// that restoration will still succeed.
TEST_F(ScrollAnchorTest, RestoreAnchorSucceedsForNonBoxNonTextElement) {}

TEST_F(ScrollAnchorTest, RestoreAnchorSucceedsWhenScriptForbidden) {}

TEST_F(ScrollAnchorTest, RestoreAnchorSucceedsWithExistingAnchorObject) {}

TEST_F(ScrollAnchorTest, DeleteAnonymousBlockCrash) {}

TEST_F(ScrollAnchorTest, ClampAdjustsAnchorAnimation) {}

// crbug.com/1413945
TEST_F(ScrollAnchorTest, DynamicMultiColumnCrash) {}

class ScrollAnchorTestFindInPageClient : public mojom::blink::FindInPageClient {};

class ScrollAnchorFindInPageTest : public testing::Test {};

TEST_F(ScrollAnchorFindInPageTest, FindInPageResultPrioritized) {}

TEST_F(ScrollAnchorFindInPageTest, FocusPrioritizedOverFindInPage) {}

TEST_F(ScrollAnchorFindInPageTest, FocusedUnderStickyIsSkipped) {}

class ScrollAnchorPageTest : public RenderingTest {};

// crbug.com/1443633
TEST_F(ScrollAnchorPageTest, SvgRelativeBoundsCrashAfterClearLayoutResults) {}
}