// Copyright 2016 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/layout_box_model_object.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/core/dom/document_lifecycle.h" #include "third_party/blink/renderer/core/dom/dom_token_list.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/html/html_element.h" #include "third_party/blink/renderer/core/layout/physical_box_fragment.h" #include "third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.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/testing/core_unit_test_helper.h" #include "third_party/blink/renderer/platform/testing/paint_test_configurations.h" namespace blink { class LayoutBoxModelObjectTest : public RenderingTest, public PaintTestConfigurations { … }; INSTANTIATE_PAINT_TEST_SUITE_P(…); // This test doesn't need to be a parameterized test. TEST_P(LayoutBoxModelObjectTest, LocalCaretRectForEmptyElementVertical) { … } // Verifies that the sticky constraints are correctly computed. TEST_P(LayoutBoxModelObjectTest, StickyPositionConstraints) { … } // Verifies that the sticky constraints are correctly computed in right to left. TEST_P(LayoutBoxModelObjectTest, StickyPositionVerticalRLConstraints) { … } // Verifies that the sticky constraints are correctly computed for inline. TEST_P(LayoutBoxModelObjectTest, StickyPositionInlineConstraints) { … } // Verifies that the sticky constraints are correctly computed for sticky with // writing mode. TEST_P(LayoutBoxModelObjectTest, StickyPositionVerticalRLInlineConstraints) { … } // Verifies that the sticky constraints are not affected by transforms TEST_P(LayoutBoxModelObjectTest, StickyPositionTransforms) { … } // Verifies that the sticky constraints are correctly computed. TEST_P(LayoutBoxModelObjectTest, StickyPositionPercentageStyles) { … } // Verifies that the sticky constraints are correct when the sticky position // container is also the ancestor scroller. TEST_P(LayoutBoxModelObjectTest, StickyPositionContainerIsScroller) { … } // Verifies that the sticky constraints are correct when the sticky position // object has an anonymous containing block. TEST_P(LayoutBoxModelObjectTest, StickyPositionAnonymousContainer) { … } TEST_P(LayoutBoxModelObjectTest, StickyPositionTableContainers) { … } // Tests that when a non-layer changes size it invalidates the constraints for // sticky position elements within the same scroller. TEST_P(LayoutBoxModelObjectTest, StickyPositionConstraintInvalidation) { … } TEST_P(LayoutBoxModelObjectTest, StickyPositionStatusChange) { … } // Verifies that the correct sticky-box shifting ancestor is found when // computing the sticky constraints. Any such ancestor is the first sticky // element between you and your containing block (exclusive). // // In most cases, this pointer should be null since your parent is normally your // containing block. However there are cases where this is not true, including // inline blocks and tables. The latter is currently irrelevant since only table // cells can be sticky in CSS2.1, but we can test the former. TEST_P(LayoutBoxModelObjectTest, StickyPositionFindsCorrectStickyBoxShiftingAncestor) { … } // Verifies that the correct containing-block shifting ancestor is found when // computing the sticky constraints. Any such ancestor is the first sticky // element between your containing block (inclusive) and your ancestor overflow // layer (exclusive). TEST_P(LayoutBoxModelObjectTest, StickyPositionFindsCorrectContainingBlockShiftingAncestor) { … } // Verifies that the correct containing-block shifting ancestor is found when // computing the sticky constraints, in the case where the overflow ancestor is // the page itself. This is a special-case version of the test above, as we // often treat the root page as special when it comes to scroll logic. It should // not make a difference for containing-block shifting ancestor calculations. TEST_P(LayoutBoxModelObjectTest, StickyPositionFindsCorrectContainingBlockShiftingAncestorRoot) { … } // Verifies that the correct containing-block shifting ancestor is found when // computing the sticky constraints, in the case of tables. Tables are unusual // because the containing block for all table elements is the <table> itself, so // we have to skip over elements to find the correct ancestor. TEST_P(LayoutBoxModelObjectTest, StickyPositionFindsCorrectContainingBlockShiftingAncestorTable) { … } // Verifies that the calculated position:sticky offsets are correct when we have // a simple case of nested sticky elements. TEST_P(LayoutBoxModelObjectTest, StickyPositionNested) { … } // Verifies that the calculated position:sticky offsets are correct when the // child has a larger edge constraint value than the parent. TEST_P(LayoutBoxModelObjectTest, StickyPositionChildHasLargerTop) { … } // Verifies that the calculated position:sticky offsets are correct when the // child has a smaller edge constraint value than the parent. TEST_P(LayoutBoxModelObjectTest, StickyPositionParentHasLargerTop) { … } // Verifies that the calculated position:sticky offsets are correct when the // child has a large enough edge constraint value to push outside of its parent. TEST_P(LayoutBoxModelObjectTest, StickyPositionChildPushingOutsideParent) { … } // Verifies that the calculated position:sticky offsets are correct in the case // of triple nesting. Triple (or more) nesting must be tested as the grandchild // sticky must correct both its sticky box constraint rect and its containing // block constaint rect. TEST_P(LayoutBoxModelObjectTest, StickyPositionTripleNestedDiv) { … } // Verifies that the calculated position:sticky offsets are correct in the case // of tables. Tables are special as the containing block for table elements is // always the root level <table>. TEST_P(LayoutBoxModelObjectTest, StickyPositionNestedStickyTable) { … } // Verifies that the calculated position:sticky offsets are correct in the case // where a particular position:sticky element is used both as a sticky-box // shifting ancestor as well as a containing-block shifting ancestor. // // This is a rare case that can be replicated by nesting tables so that a sticky // cell contains another table that has sticky elements. See the HTML below. TEST_P(LayoutBoxModelObjectTest, StickyPositionComplexTableNesting) { … } // Verifies that the calculated position:sticky offsets are correct in the case // of nested inline elements. TEST_P(LayoutBoxModelObjectTest, StickyPositionNestedInlineElements) { … } // Verifies that the calculated position:sticky offsets are correct in the case // of an intermediate position:fixed element. TEST_P(LayoutBoxModelObjectTest, StickyPositionNestedFixedPos) { … } TEST_P(LayoutBoxModelObjectTest, InvalidatePaintLayerOnStackedChange) { … } TEST_P(LayoutBoxModelObjectTest, BackfaceVisibilityChange) { … } TEST_P(LayoutBoxModelObjectTest, ChangingFilterWithWillChange) { … } TEST_P(LayoutBoxModelObjectTest, ChangingWillChangeFilter) { … } TEST_P(LayoutBoxModelObjectTest, ChangingBackdropFilterWithWillChange) { … } TEST_P(LayoutBoxModelObjectTest, ChangingWillChangeBackdropFilter) { … } TEST_P(LayoutBoxModelObjectTest, UpdateStackingContextForOption) { … } TEST_P(LayoutBoxModelObjectTest, StickyParentContainStrictChangeOverflowProperty) { … } TEST_P(LayoutBoxModelObjectTest, RemoveStickyUnderContain) { … } TEST_P(LayoutBoxModelObjectTest, ChangeStickyStatusUnderContain) { … } TEST_P(LayoutBoxModelObjectTest, ChangeStickyStatusKeepLayerUnderContain) { … } TEST_P(LayoutBoxModelObjectTest, RemoveStickyStatusInNestedStickyElementsWithContain) { … } } // namespace blink