#include "third_party/blink/renderer/core/intersection_observer/intersection_observer.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_init.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_document_element.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_double_doublesequence.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/exported/web_view_impl.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/intersection_observer/element_intersection_observer_data.h"
#include "third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.h"
#include "third_party/blink/renderer/core/intersection_observer/intersection_observer_delegate.h"
#include "third_party/blink/renderer/core/intersection_observer/intersection_observer_entry.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/intersection_observer_test_helper.h"
#include "third_party/blink/renderer/core/testing/sim/sim_compositor.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/heap/thread_state.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "ui/gfx/geometry/test/geometry_util.h"
namespace blink {
class IntersectionObserverTest : public SimTest,
public testing::WithParamInterface<bool>,
private ScopedIntersectionOptimizationForTest { … };
class IntersectionObserverV2Test : public IntersectionObserverTest { … };
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(IntersectionObserverTest, ObserveSchedulesFrame) { … }
TEST_P(IntersectionObserverTest, NotificationSentWhenRootRemoved) { … }
TEST_P(IntersectionObserverTest, DocumentRootClips) { … }
TEST_P(IntersectionObserverTest, ReportsFractionOfTargetOrRoot) { … }
TEST_P(IntersectionObserverTest, TargetRectIsEmptyAfterMapping) { … }
TEST_P(IntersectionObserverTest, DirectlyUpdateTransform) { … }
TEST_P(IntersectionObserverTest, VisibilityHiddenChangeSize) { … }
TEST_P(IntersectionObserverTest, ResumePostsTask) { … }
TEST_P(IntersectionObserverTest, HitTestAfterMutation) { … }
TEST_P(IntersectionObserverTest, DisconnectClearsNotifications) { … }
TEST_P(IntersectionObserverTest, RootIntersectionWithForceZeroLayoutHeight) { … }
TEST_P(IntersectionObserverTest, TrackedTargetBookkeeping) { … }
TEST_P(IntersectionObserverTest, TrackedRootBookkeeping) { … }
TEST_P(IntersectionObserverTest, InaccessibleTarget) { … }
TEST_P(IntersectionObserverTest, InaccessibleTargetBeforeDelivery) { … }
TEST_P(IntersectionObserverTest, RootMarginDevicePixelRatio) { … }
TEST_P(IntersectionObserverTest, CachedRectsWithScrollers) { … }
TEST_P(IntersectionObserverTest, CachedRectsWithOverflowHidden) { … }
TEST_P(IntersectionObserverTest, CachedRectsWithoutIntermediateScrollable) { … }
TEST_P(IntersectionObserverTest, CachedRectsWithPaintPropertyChange) { … }
TEST_P(IntersectionObserverTest, CachedRectsDisplayNone) { … }
TEST_P(IntersectionObserverTest, CachedRectsWithFixedPosition) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateNotScrollable) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateNotScrollableToScrollable) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateInlineLayout) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateThresholdZero) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateWithPageZoom) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateImplicitRoot) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateThresholdZeroIntermediateClip) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateThresholdZeroIntermediateClipPath) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateThresholdZeroClipPathOnTarget) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateMinimumThreshold) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateThreshold0_5) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateThresholdOne) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateThresholdOneOfRoot) { … }
TEST_P(IntersectionObserverTest, MinScrollDeltaToUpdateThresholdFilterOnRoot) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateThresholdFilterOnTarget) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateThresholdFilterOnIntermediateContainer) { … }
TEST_P(IntersectionObserverTest,
MinScrollDeltaToUpdateThresholdFilterOnIntermediateNonContainer) { … }
TEST_P(IntersectionObserverV2Test, TrackVisibilityInit) { … }
TEST_P(IntersectionObserverV2Test, BasicOcclusion) { … }
TEST_P(IntersectionObserverV2Test, BasicOpacity) { … }
TEST_P(IntersectionObserverV2Test, BasicTransform) { … }
TEST_P(IntersectionObserverTest, ApplyMarginToTarget) { … }
TEST_P(IntersectionObserverTest, TargetMarginPercentResolvesAgainstRoot) { … }
TEST_P(IntersectionObserverTest, ScrollMarginIntersecting) { … }
TEST_P(IntersectionObserverTest, ScrollMarginNotIntersecting) { … }
TEST_P(IntersectionObserverTest, NoScrollMargin) { … }
TEST_P(IntersectionObserverTest, ScrollMarginNestedIntersecting) { … }
TEST_P(IntersectionObserverTest, ScrollMarginNestedNotIntersecting) { … }
TEST_P(IntersectionObserverTest, NoScrollMarginNested) { … }
TEST_P(IntersectionObserverTest, ScrollMarginIntersectingNonScrollingRoot) { … }
TEST_P(IntersectionObserverTest, InlineRoot) { … }
TEST_P(IntersectionObserverTest, ParseMarginExtraText) { … }
TEST_P(IntersectionObserverTest, ParseMarginUnsupportedUnitType) { … }
TEST_P(IntersectionObserverTest, ParseMarginUnsupportedUnit) { … }
TEST_P(IntersectionObserverTest, RootMarginString) { … }
TEST_P(IntersectionObserverTest, RootMarginPercentString) { … }
TEST_P(IntersectionObserverTest, ScrollMarginEmptyString) { … }
}