#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/display_lock/display_lock_context.h"
#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
#include "base/test/scoped_feature_list.h"
#include "cc/base/features.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_document_state.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h"
#include "third_party/blink/renderer/core/dom/dom_token_list.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/finder/text_finder.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/visible_units.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/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/html/html_plugin_element.h"
#include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
namespace blink {
namespace {
class DisplayLockTestFindInPageClient : public mojom::blink::FindInPageClient { … };
class DisplayLockEmptyEventListener final : public NativeEventListener { … };
}
class DisplayLockContextTest : public testing::Test,
public testing::WithParamInterface<bool>,
private ScopedIntersectionOptimizationForTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(DisplayLockContextTest, LockAfterAppendStyleDirtyBits) { … }
TEST_P(DisplayLockContextTest, LockedElementIsNotSearchableViaFindInPage) { … }
TEST_P(DisplayLockContextTest,
ActivatableLockedElementIsSearchableViaFindInPage) { … }
TEST_P(DisplayLockContextTest, FindInPageContinuesAfterRelock) { … }
TEST_P(DisplayLockContextTest, FindInPageTargetBelowLockedSize) { … }
TEST_P(DisplayLockContextTest,
ActivatableLockedElementTickmarksAreAtLockedRoots) { … }
TEST_P(DisplayLockContextTest,
FindInPageWhileLockedContentChangesDoesNotCrash) { … }
TEST_P(DisplayLockContextTest, FindInPageWithChangedContent) { … }
TEST_P(DisplayLockContextTest, FindInPageWithNoMatchesWontUnlock) { … }
TEST_P(DisplayLockContextTest,
NestedActivatableLockedElementIsSearchableViaFindInPage) { … }
TEST_P(DisplayLockContextTest,
NestedActivatableLockedElementIsNotUnlockedByFindInPage) { … }
TEST_P(DisplayLockContextTest, CallUpdateStyleAndLayoutAfterChange) { … }
TEST_P(DisplayLockContextTest, CallUpdateStyleAndLayoutAfterChangeCSS) { … }
TEST_P(DisplayLockContextTest, LockedElementAndDescendantsAreNotFocusable) { … }
TEST_P(DisplayLockContextTest, DisplayLockPreventsActivation) { … }
TEST_P(DisplayLockContextTest,
LockedElementAndFlatTreeDescendantsAreNotFocusable) { … }
TEST_P(DisplayLockContextTest, LockedCountsWithMultipleLocks) { … }
TEST_P(DisplayLockContextTest, ActivatableNotCountedAsBlocking) { … }
TEST_P(DisplayLockContextTest, ElementInTemplate) { … }
TEST_P(DisplayLockContextTest, AncestorAllowedTouchAction) { … }
TEST_P(DisplayLockContextTest, DescendantAllowedTouchAction) { … }
TEST_P(DisplayLockContextTest, AncestorWheelEventHandler) { … }
TEST_P(DisplayLockContextTest, DescendantWheelEventHandler) { … }
TEST_P(DisplayLockContextTest, DescendantNeedsPaintPropertyUpdateBlocked) { … }
class DisplayLockContextRenderingTest
: public RenderingTest,
public testing::WithParamInterface<bool>,
private ScopedIntersectionOptimizationForTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(DisplayLockContextRenderingTest, FrameDocumentRemovedWhileAcquire) { … }
TEST_P(DisplayLockContextRenderingTest,
VisualOverflowCalculateOnChildPaintLayer) { … }
TEST_P(DisplayLockContextRenderingTest, FloatChildLocked) { … }
TEST_P(DisplayLockContextRenderingTest,
VisualOverflowCalculateOnChildPaintLayerInForcedLock) { … }
TEST_P(DisplayLockContextRenderingTest,
SelectionOnAnonymousColumnSpannerDoesNotCrash) { … }
TEST_P(DisplayLockContextRenderingTest, ObjectsNeedingLayoutConsidersLocks) { … }
TEST_P(DisplayLockContextRenderingTest,
PaintDirtyBitsNotPropagatedAcrossBoundary) { … }
TEST_P(DisplayLockContextRenderingTest,
NestedLockDoesNotInvalidateOnHideOrShow) { … }
TEST_P(DisplayLockContextRenderingTest, NestedLockDoesHideWhenItIsOffscreen) { … }
TEST_P(DisplayLockContextRenderingTest,
LockedCanvasWithFallbackHasFocusableStyle) { … }
TEST_P(DisplayLockContextRenderingTest, ForcedUnlockBookkeeping) { … }
TEST_P(DisplayLockContextRenderingTest, LayoutRootIsSkippedIfLocked) { … }
TEST_P(DisplayLockContextRenderingTest,
LayoutRootIsProcessedIfLockedAndForced) { … }
TEST_P(DisplayLockContextRenderingTest, ContainStrictChild) { … }
TEST_P(DisplayLockContextRenderingTest, UseCounter) { … }
TEST_P(DisplayLockContextRenderingTest,
NeedsLayoutTreeUpdateForNodeRespectsForcedLocks) { … }
TEST_P(DisplayLockContextRenderingTest, InnerScrollerAutoVisibilityMargin) { … }
TEST_P(DisplayLockContextRenderingTest,
AutoReachesStableStateOnContentSmallerThanLockedSize) { … }
TEST_P(DisplayLockContextRenderingTest,
AutoReachesStableStateOnContentSmallerThanLockedSizeInLtr) { … }
TEST_P(DisplayLockContextRenderingTest,
AutoReachesStableStateOnContentSmallerThanLockedSizeInRtl) { … }
TEST_P(DisplayLockContextRenderingTest, FirstAutoFramePaintsInViewport) { … }
TEST_P(DisplayLockContextRenderingTest,
HadIntersectionNotificationsResetsWhenConnected) { … }
TEST_P(DisplayLockContextTest, PrintingUnlocksAutoLocks) { … }
TEST_P(DisplayLockContextTest, CullRectUpdate) { … }
TEST_P(DisplayLockContextTest, DisconnectedElementIsUnlocked) { … }
TEST_P(DisplayLockContextTest, ConnectedElementDefersSubtreeChecks) { … }
TEST_P(DisplayLockContextTest, BlockedReattachOfSlotted) { … }
TEST_P(DisplayLockContextTest, BlockedReattachOfShadowTree) { … }
TEST_P(DisplayLockContextTest, BlockedReattachOfPseudoElements) { … }
TEST_P(DisplayLockContextTest, BlockedReattachWhitespaceSibling) { … }
TEST_P(DisplayLockContextTest, ReattachPropagationBlockedByDisplayLock) { … }
TEST_P(DisplayLockContextTest, NoUpdatesInDisplayNone) { … }
TEST_P(DisplayLockContextTest, ElementActivateDisplayLockIfNeeded) { … }
TEST_P(DisplayLockContextTest, ShouldForceUnlockObjectWithFallbackContent) { … }
}