| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintPropertyTreeBuilderTest.h" | 5 #include "core/paint/PaintPropertyTreeBuilderTest.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
| 8 #include "core/layout/LayoutTreeAsText.h" | 8 #include "core/layout/LayoutTreeAsText.h" |
| 9 #include "core/paint/ObjectPaintProperties.h" | 9 #include "core/paint/ObjectPaintProperties.h" |
| 10 #include "core/paint/PaintPropertyTreePrinter.h" | 10 #include "core/paint/PaintPropertyTreePrinter.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 target1->layoutObject()->paintProperties(); | 136 target1->layoutObject()->paintProperties(); |
| 137 EXPECT_EQ(FloatRoundedRect(200, 150, 100, 100), | 137 EXPECT_EQ(FloatRoundedRect(200, 150, 100, 100), |
| 138 target1Properties->overflowClip()->clipRect()); | 138 target1Properties->overflowClip()->clipRect()); |
| 139 // Likewise, it inherits clip from the viewport, skipping overflow clip of the | 139 // Likewise, it inherits clip from the viewport, skipping overflow clip of the |
| 140 // scroller. | 140 // scroller. |
| 141 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); | 141 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); |
| 142 // target1 should not have its own scroll node and instead should inherit | 142 // target1 should not have its own scroll node and instead should inherit |
| 143 // positionedScroll's. | 143 // positionedScroll's. |
| 144 const ObjectPaintProperties* positionedScrollProperties = | 144 const ObjectPaintProperties* positionedScrollProperties = |
| 145 positionedScroll->layoutObject()->paintProperties(); | 145 positionedScroll->layoutObject()->paintProperties(); |
| 146 EXPECT_TRUE(positionedScrollProperties->scroll()->parent()->isRoot()); | 146 auto* positionedScrollTranslation = |
| 147 positionedScrollProperties->scrollTranslation(); |
| 148 auto* positionedScrollNode = positionedScrollTranslation->scrollNode(); |
| 149 EXPECT_TRUE(positionedScrollNode->parent()->isRoot()); |
| 147 EXPECT_EQ(TransformationMatrix().translate(0, -3), | 150 EXPECT_EQ(TransformationMatrix().translate(0, -3), |
| 148 positionedScrollProperties->scroll() | 151 positionedScrollTranslation->matrix()); |
| 149 ->scrollOffsetTranslation() | |
| 150 ->matrix()); | |
| 151 EXPECT_EQ(nullptr, target1Properties->scroll()); | 152 EXPECT_EQ(nullptr, target1Properties->scroll()); |
| 152 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), | 153 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), |
| 153 target1->layoutObject(), frameView->layoutView()); | 154 target1->layoutObject(), frameView->layoutView()); |
| 154 | 155 |
| 155 // target2 is a fixed-position element inside a transformed scrolling element. | 156 // target2 is a fixed-position element inside a transformed scrolling element. |
| 156 // It should be attached under the scrolled box of the transformed element. | 157 // It should be attached under the scrolled box of the transformed element. |
| 157 Element* target2 = document().getElementById("target2"); | 158 Element* target2 = document().getElementById("target2"); |
| 158 const ObjectPaintProperties* target2Properties = | 159 const ObjectPaintProperties* target2Properties = |
| 159 target2->layoutObject()->paintProperties(); | 160 target2->layoutObject()->paintProperties(); |
| 160 Element* scroller = document().getElementById("transformedScroll"); | 161 Element* scroller = document().getElementById("transformedScroll"); |
| 161 const ObjectPaintProperties* scrollerProperties = | 162 const ObjectPaintProperties* scrollerProperties = |
| 162 scroller->layoutObject()->paintProperties(); | 163 scroller->layoutObject()->paintProperties(); |
| 163 EXPECT_EQ(FloatRoundedRect(200, 150, 100, 100), | 164 EXPECT_EQ(FloatRoundedRect(200, 150, 100, 100), |
| 164 target2Properties->overflowClip()->clipRect()); | 165 target2Properties->overflowClip()->clipRect()); |
| 165 EXPECT_EQ(scrollerProperties->overflowClip(), | 166 EXPECT_EQ(scrollerProperties->overflowClip(), |
| 166 target2Properties->overflowClip()->parent()); | 167 target2Properties->overflowClip()->parent()); |
| 167 // target2 should not have it's own scroll node and instead should inherit | 168 // target2 should not have it's own scroll node and instead should inherit |
| 168 // transformedScroll's. | 169 // transformedScroll's. |
| 169 const ObjectPaintProperties* transformedScrollProperties = | 170 const ObjectPaintProperties* transformedScrollProperties = |
| 170 transformedScroll->layoutObject()->paintProperties(); | 171 transformedScroll->layoutObject()->paintProperties(); |
| 171 EXPECT_TRUE(transformedScrollProperties->scroll()->parent()->isRoot()); | 172 auto* transformedScrollTranslation = |
| 173 transformedScrollProperties->scrollTranslation(); |
| 174 auto* transformedScrollNode = transformedScrollTranslation->scrollNode(); |
| 175 EXPECT_TRUE(transformedScrollNode->parent()->isRoot()); |
| 172 EXPECT_EQ(TransformationMatrix().translate(0, -5), | 176 EXPECT_EQ(TransformationMatrix().translate(0, -5), |
| 173 transformedScrollProperties->scroll() | 177 transformedScrollTranslation->matrix()); |
| 174 ->scrollOffsetTranslation() | |
| 175 ->matrix()); | |
| 176 EXPECT_EQ(nullptr, target2Properties->scroll()); | 178 EXPECT_EQ(nullptr, target2Properties->scroll()); |
| 177 | 179 |
| 178 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), | 180 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), |
| 179 target2->layoutObject(), frameView->layoutView()); | 181 target2->layoutObject(), frameView->layoutView()); |
| 180 } | 182 } |
| 181 | 183 |
| 182 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) { | 184 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) { |
| 183 loadTestData("position-and-scroll.html"); | 185 loadTestData("position-and-scroll.html"); |
| 184 | 186 |
| 185 Element* scroller = document().getElementById("scroller"); | 187 Element* scroller = document().getElementById("scroller"); |
| (...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 | 2575 |
| 2574 Element* overflowHidden = document().getElementById("overflowHidden"); | 2576 Element* overflowHidden = document().getElementById("overflowHidden"); |
| 2575 overflowHidden->setScrollTop(37); | 2577 overflowHidden->setScrollTop(37); |
| 2576 | 2578 |
| 2577 document().view()->updateAllLifecyclePhases(); | 2579 document().view()->updateAllLifecyclePhases(); |
| 2578 | 2580 |
| 2579 const ObjectPaintProperties* overflowHiddenScrollProperties = | 2581 const ObjectPaintProperties* overflowHiddenScrollProperties = |
| 2580 overflowHidden->layoutObject()->paintProperties(); | 2582 overflowHidden->layoutObject()->paintProperties(); |
| 2581 // Because the frameView is does not scroll, overflowHidden's scroll should be | 2583 // Because the frameView is does not scroll, overflowHidden's scroll should be |
| 2582 // under the root. | 2584 // under the root. |
| 2583 EXPECT_TRUE(overflowHiddenScrollProperties->scroll()->parent()->isRoot()); | 2585 auto* scrollTranslation = overflowHiddenScrollProperties->scrollTranslation(); |
| 2586 auto* overflowHiddenScrollNode = scrollTranslation->scrollNode(); |
| 2587 EXPECT_TRUE(overflowHiddenScrollNode->parent()->isRoot()); |
| 2584 EXPECT_EQ(TransformationMatrix().translate(0, -37), | 2588 EXPECT_EQ(TransformationMatrix().translate(0, -37), |
| 2585 overflowHiddenScrollProperties->scroll() | 2589 scrollTranslation->matrix()); |
| 2586 ->scrollOffsetTranslation() | |
| 2587 ->matrix()); | |
| 2588 // This should match the overflow's dimensions. | 2590 // This should match the overflow's dimensions. |
| 2589 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollProperties->scroll()->clip()); | 2591 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollNode->clip()); |
| 2590 // The scrolling content's bounds should include both the overflow's | 2592 // The scrolling content's bounds should include both the overflow's |
| 2591 // dimensions (5x3) and the 0x79 "forceScroll" object. | 2593 // dimensions (5x3) and the 0x79 "forceScroll" object. |
| 2592 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollProperties->scroll()->bounds()); | 2594 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollNode->bounds()); |
| 2593 // Although overflow: hidden is programmatically scrollable, it is not user | 2595 // Although overflow: hidden is programmatically scrollable, it is not user |
| 2594 // scrollable. | 2596 // scrollable. |
| 2595 EXPECT_FALSE( | 2597 EXPECT_FALSE(overflowHiddenScrollNode->userScrollableHorizontal()); |
| 2596 overflowHiddenScrollProperties->scroll()->userScrollableHorizontal()); | 2598 EXPECT_FALSE(overflowHiddenScrollNode->userScrollableVertical()); |
| 2597 EXPECT_FALSE( | |
| 2598 overflowHiddenScrollProperties->scroll()->userScrollableVertical()); | |
| 2599 } | 2599 } |
| 2600 | 2600 |
| 2601 TEST_P(PaintPropertyTreeBuilderTest, NestedScrollProperties) { | 2601 TEST_P(PaintPropertyTreeBuilderTest, NestedScrollProperties) { |
| 2602 setBodyInnerHTML( | 2602 setBodyInnerHTML( |
| 2603 "<style>" | 2603 "<style>" |
| 2604 " * {" | 2604 " * {" |
| 2605 " margin: 0px;" | 2605 " margin: 0px;" |
| 2606 " }" | 2606 " }" |
| 2607 " #overflowA {" | 2607 " #overflowA {" |
| 2608 " overflow: scroll;" | 2608 " overflow: scroll;" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2629 overflowA->setScrollTop(37); | 2629 overflowA->setScrollTop(37); |
| 2630 Element* overflowB = document().getElementById("overflowB"); | 2630 Element* overflowB = document().getElementById("overflowB"); |
| 2631 overflowB->setScrollTop(41); | 2631 overflowB->setScrollTop(41); |
| 2632 | 2632 |
| 2633 document().view()->updateAllLifecyclePhases(); | 2633 document().view()->updateAllLifecyclePhases(); |
| 2634 | 2634 |
| 2635 const ObjectPaintProperties* overflowAScrollProperties = | 2635 const ObjectPaintProperties* overflowAScrollProperties = |
| 2636 overflowA->layoutObject()->paintProperties(); | 2636 overflowA->layoutObject()->paintProperties(); |
| 2637 // Because the frameView is does not scroll, overflowA's scroll should be | 2637 // Because the frameView is does not scroll, overflowA's scroll should be |
| 2638 // under the root. | 2638 // under the root. |
| 2639 EXPECT_TRUE(overflowAScrollProperties->scroll()->parent()->isRoot()); | 2639 auto* scrollATranslation = overflowAScrollProperties->scrollTranslation(); |
| 2640 EXPECT_EQ( | 2640 auto* overflowAScrollNode = scrollATranslation->scrollNode(); |
| 2641 TransformationMatrix().translate(0, -37), | 2641 EXPECT_TRUE(overflowAScrollNode->parent()->isRoot()); |
| 2642 overflowAScrollProperties->scroll()->scrollOffsetTranslation()->matrix()); | 2642 EXPECT_EQ(TransformationMatrix().translate(0, -37), |
| 2643 EXPECT_EQ(IntSize(5, 3), overflowAScrollProperties->scroll()->clip()); | 2643 scrollATranslation->matrix()); |
| 2644 EXPECT_EQ(IntSize(5, 3), overflowAScrollNode->clip()); |
| 2644 // 107 is the forceScroll element plus the height of the overflow scroll child | 2645 // 107 is the forceScroll element plus the height of the overflow scroll child |
| 2645 // (overflowB). | 2646 // (overflowB). |
| 2646 EXPECT_EQ(IntSize(9, 107), overflowAScrollProperties->scroll()->bounds()); | 2647 EXPECT_EQ(IntSize(9, 107), overflowAScrollNode->bounds()); |
| 2647 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal()); | 2648 EXPECT_TRUE(overflowAScrollNode->userScrollableHorizontal()); |
| 2648 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | 2649 EXPECT_TRUE(overflowAScrollNode->userScrollableVertical()); |
| 2649 | 2650 |
| 2650 const ObjectPaintProperties* overflowBScrollProperties = | 2651 const ObjectPaintProperties* overflowBScrollProperties = |
| 2651 overflowB->layoutObject()->paintProperties(); | 2652 overflowB->layoutObject()->paintProperties(); |
| 2652 // The overflow child's scroll node should be a child of the parent's | 2653 // The overflow child's scroll node should be a child of the parent's |
| 2653 // (overflowA) scroll node. | 2654 // (overflowA) scroll node. |
| 2654 EXPECT_EQ(overflowAScrollProperties->scroll(), | 2655 auto* scrollBTranslation = overflowBScrollProperties->scrollTranslation(); |
| 2655 overflowBScrollProperties->scroll()->parent()); | 2656 auto* overflowBScrollNode = scrollBTranslation->scrollNode(); |
| 2656 EXPECT_EQ( | 2657 EXPECT_EQ(overflowAScrollNode, overflowBScrollNode->parent()); |
| 2657 TransformationMatrix().translate(0, -41), | 2658 EXPECT_EQ(TransformationMatrix().translate(0, -41), |
| 2658 overflowBScrollProperties->scroll()->scrollOffsetTranslation()->matrix()); | 2659 scrollBTranslation->matrix()); |
| 2659 EXPECT_EQ(IntSize(9, 7), overflowBScrollProperties->scroll()->clip()); | 2660 EXPECT_EQ(IntSize(9, 7), overflowBScrollNode->clip()); |
| 2660 EXPECT_EQ(IntSize(9, 100), overflowBScrollProperties->scroll()->bounds()); | 2661 EXPECT_EQ(IntSize(9, 100), overflowBScrollNode->bounds()); |
| 2661 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableHorizontal()); | 2662 EXPECT_TRUE(overflowBScrollNode->userScrollableHorizontal()); |
| 2662 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableVertical()); | 2663 EXPECT_TRUE(overflowBScrollNode->userScrollableVertical()); |
| 2663 } | 2664 } |
| 2664 | 2665 |
| 2665 TEST_P(PaintPropertyTreeBuilderTest, PositionedScrollerIsNotNested) { | 2666 TEST_P(PaintPropertyTreeBuilderTest, PositionedScrollerIsNotNested) { |
| 2666 setBodyInnerHTML( | 2667 setBodyInnerHTML( |
| 2667 "<style>" | 2668 "<style>" |
| 2668 " * {" | 2669 " * {" |
| 2669 " margin: 0px;" | 2670 " margin: 0px;" |
| 2670 " }" | 2671 " }" |
| 2671 " #overflow {" | 2672 " #overflow {" |
| 2672 " overflow: scroll;" | 2673 " overflow: scroll;" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 Element* fixedOverflow = document().getElementById("fixedOverflow"); | 2712 Element* fixedOverflow = document().getElementById("fixedOverflow"); |
| 2712 fixedOverflow->setScrollTop(43); | 2713 fixedOverflow->setScrollTop(43); |
| 2713 | 2714 |
| 2714 document().view()->updateAllLifecyclePhases(); | 2715 document().view()->updateAllLifecyclePhases(); |
| 2715 | 2716 |
| 2716 // The frame should scroll due to the "forceScroll" element. | 2717 // The frame should scroll due to the "forceScroll" element. |
| 2717 EXPECT_NE(nullptr, frameScroll()); | 2718 EXPECT_NE(nullptr, frameScroll()); |
| 2718 | 2719 |
| 2719 const ObjectPaintProperties* overflowScrollProperties = | 2720 const ObjectPaintProperties* overflowScrollProperties = |
| 2720 overflow->layoutObject()->paintProperties(); | 2721 overflow->layoutObject()->paintProperties(); |
| 2722 auto* scrollTranslation = overflowScrollProperties->scrollTranslation(); |
| 2723 auto* overflowScrollNode = scrollTranslation->scrollNode(); |
| 2721 EXPECT_EQ(frameScroll(), overflowScrollProperties->scroll()->parent()); | 2724 EXPECT_EQ(frameScroll(), overflowScrollProperties->scroll()->parent()); |
| 2722 EXPECT_EQ( | 2725 EXPECT_EQ(TransformationMatrix().translate(0, -37), |
| 2723 TransformationMatrix().translate(0, -37), | 2726 scrollTranslation->matrix()); |
| 2724 overflowScrollProperties->scroll()->scrollOffsetTranslation()->matrix()); | 2727 EXPECT_EQ(IntSize(5, 3), overflowScrollNode->clip()); |
| 2725 EXPECT_EQ(IntSize(5, 3), overflowScrollProperties->scroll()->clip()); | |
| 2726 // The height should be 4000px because the (dom-order) overflow children are | 2728 // The height should be 4000px because the (dom-order) overflow children are |
| 2727 // positioned and do not contribute to the height. Only the 4000px | 2729 // positioned and do not contribute to the height. Only the 4000px |
| 2728 // "forceScroll" height is present. | 2730 // "forceScroll" height is present. |
| 2729 EXPECT_EQ(IntSize(5, 4000), overflowScrollProperties->scroll()->bounds()); | 2731 EXPECT_EQ(IntSize(5, 4000), overflowScrollNode->bounds()); |
| 2730 | 2732 |
| 2731 const ObjectPaintProperties* absposOverflowScrollProperties = | 2733 const ObjectPaintProperties* absposOverflowScrollProperties = |
| 2732 absposOverflow->layoutObject()->paintProperties(); | 2734 absposOverflow->layoutObject()->paintProperties(); |
| 2735 auto* absposScrollTranslation = |
| 2736 absposOverflowScrollProperties->scrollTranslation(); |
| 2737 auto* absposOverflowScrollNode = absposScrollTranslation->scrollNode(); |
| 2733 // The absolute position overflow scroll node is parented under the frame, not | 2738 // The absolute position overflow scroll node is parented under the frame, not |
| 2734 // the dom-order parent. | 2739 // the dom-order parent. |
| 2735 EXPECT_EQ(frameScroll(), absposOverflowScrollProperties->scroll()->parent()); | 2740 EXPECT_EQ(frameScroll(), absposOverflowScrollNode->parent()); |
| 2736 EXPECT_EQ(TransformationMatrix().translate(0, -41), | 2741 EXPECT_EQ(TransformationMatrix().translate(0, -41), |
| 2737 absposOverflowScrollProperties->scroll() | 2742 absposScrollTranslation->matrix()); |
| 2738 ->scrollOffsetTranslation() | 2743 EXPECT_EQ(IntSize(9, 7), absposOverflowScrollNode->clip()); |
| 2739 ->matrix()); | 2744 EXPECT_EQ(IntSize(9, 4000), absposOverflowScrollNode->bounds()); |
| 2740 EXPECT_EQ(IntSize(9, 7), absposOverflowScrollProperties->scroll()->clip()); | |
| 2741 EXPECT_EQ(IntSize(9, 4000), | |
| 2742 absposOverflowScrollProperties->scroll()->bounds()); | |
| 2743 | 2745 |
| 2744 const ObjectPaintProperties* fixedOverflowScrollProperties = | 2746 const ObjectPaintProperties* fixedOverflowScrollProperties = |
| 2745 fixedOverflow->layoutObject()->paintProperties(); | 2747 fixedOverflow->layoutObject()->paintProperties(); |
| 2748 auto* fixedScrollTranslation = |
| 2749 fixedOverflowScrollProperties->scrollTranslation(); |
| 2750 auto* fixedOverflowScrollNode = fixedScrollTranslation->scrollNode(); |
| 2746 // The fixed position overflow scroll node is parented under the root, not the | 2751 // The fixed position overflow scroll node is parented under the root, not the |
| 2747 // dom-order parent or frame's scroll. | 2752 // dom-order parent or frame's scroll. |
| 2748 EXPECT_TRUE(fixedOverflowScrollProperties->scroll()->parent()->isRoot()); | 2753 EXPECT_TRUE(fixedOverflowScrollNode->parent()->isRoot()); |
| 2749 EXPECT_EQ(TransformationMatrix().translate(0, -43), | 2754 EXPECT_EQ(TransformationMatrix().translate(0, -43), |
| 2750 fixedOverflowScrollProperties->scroll() | 2755 fixedScrollTranslation->matrix()); |
| 2751 ->scrollOffsetTranslation() | 2756 EXPECT_EQ(IntSize(13, 11), fixedOverflowScrollNode->clip()); |
| 2752 ->matrix()); | 2757 EXPECT_EQ(IntSize(13, 4000), fixedOverflowScrollNode->bounds()); |
| 2753 EXPECT_EQ(IntSize(13, 11), fixedOverflowScrollProperties->scroll()->clip()); | |
| 2754 EXPECT_EQ(IntSize(13, 4000), | |
| 2755 fixedOverflowScrollProperties->scroll()->bounds()); | |
| 2756 } | 2758 } |
| 2757 | 2759 |
| 2758 TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) { | 2760 TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) { |
| 2759 setBodyInnerHTML( | 2761 setBodyInnerHTML( |
| 2760 "<style>" | 2762 "<style>" |
| 2761 " * {" | 2763 " * {" |
| 2762 " margin: 0px;" | 2764 " margin: 0px;" |
| 2763 " }" | 2765 " }" |
| 2764 " #overflowA {" | 2766 " #overflowA {" |
| 2765 " position: absolute;" | 2767 " position: absolute;" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2792 overflowA->setScrollTop(37); | 2794 overflowA->setScrollTop(37); |
| 2793 Element* overflowB = document().getElementById("overflowB"); | 2795 Element* overflowB = document().getElementById("overflowB"); |
| 2794 overflowB->setScrollTop(41); | 2796 overflowB->setScrollTop(41); |
| 2795 | 2797 |
| 2796 document().view()->updateAllLifecyclePhases(); | 2798 document().view()->updateAllLifecyclePhases(); |
| 2797 | 2799 |
| 2798 const ObjectPaintProperties* overflowAScrollProperties = | 2800 const ObjectPaintProperties* overflowAScrollProperties = |
| 2799 overflowA->layoutObject()->paintProperties(); | 2801 overflowA->layoutObject()->paintProperties(); |
| 2800 // Because the frameView is does not scroll, overflowA's scroll should be | 2802 // Because the frameView is does not scroll, overflowA's scroll should be |
| 2801 // under the root. | 2803 // under the root. |
| 2802 EXPECT_TRUE(overflowAScrollProperties->scroll()->parent()->isRoot()); | 2804 auto* scrollATranslation = overflowAScrollProperties->scrollTranslation(); |
| 2803 EXPECT_EQ( | 2805 auto* overflowAScrollNode = scrollATranslation->scrollNode(); |
| 2804 TransformationMatrix().translate(0, -37), | 2806 EXPECT_TRUE(overflowAScrollNode->parent()->isRoot()); |
| 2805 overflowAScrollProperties->scroll()->scrollOffsetTranslation()->matrix()); | 2807 EXPECT_EQ(TransformationMatrix().translate(0, -37), |
| 2806 EXPECT_EQ(IntSize(20, 20), overflowAScrollProperties->scroll()->clip()); | 2808 scrollATranslation->matrix()); |
| 2809 EXPECT_EQ(IntSize(20, 20), overflowAScrollNode->clip()); |
| 2807 // 100 is the forceScroll element's height because the overflow child does not | 2810 // 100 is the forceScroll element's height because the overflow child does not |
| 2808 // contribute to the height. | 2811 // contribute to the height. |
| 2809 EXPECT_EQ(IntSize(20, 100), overflowAScrollProperties->scroll()->bounds()); | 2812 EXPECT_EQ(IntSize(20, 100), overflowAScrollNode->bounds()); |
| 2810 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal()); | 2813 EXPECT_TRUE(overflowAScrollNode->userScrollableHorizontal()); |
| 2811 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | 2814 EXPECT_TRUE(overflowAScrollNode->userScrollableVertical()); |
| 2812 | 2815 |
| 2813 const ObjectPaintProperties* overflowBScrollProperties = | 2816 const ObjectPaintProperties* overflowBScrollProperties = |
| 2814 overflowB->layoutObject()->paintProperties(); | 2817 overflowB->layoutObject()->paintProperties(); |
| 2815 // The overflow child's scroll node should be a child of the parent's | 2818 // The overflow child's scroll node should be a child of the parent's |
| 2816 // (overflowA) scroll node. | 2819 // (overflowA) scroll node. |
| 2817 EXPECT_EQ(overflowAScrollProperties->scroll(), | 2820 auto* scrollBTranslation = overflowBScrollProperties->scrollTranslation(); |
| 2818 overflowBScrollProperties->scroll()->parent()); | 2821 auto* overflowBScrollNode = scrollBTranslation->scrollNode(); |
| 2819 EXPECT_EQ( | 2822 EXPECT_EQ(overflowAScrollNode, overflowBScrollNode->parent()); |
| 2820 TransformationMatrix().translate(0, -41), | 2823 EXPECT_EQ(TransformationMatrix().translate(0, -41), |
| 2821 overflowBScrollProperties->scroll()->scrollOffsetTranslation()->matrix()); | 2824 scrollBTranslation->matrix()); |
| 2822 EXPECT_EQ(IntSize(5, 3), overflowBScrollProperties->scroll()->clip()); | 2825 EXPECT_EQ(IntSize(5, 3), overflowBScrollNode->clip()); |
| 2823 EXPECT_EQ(IntSize(5, 100), overflowBScrollProperties->scroll()->bounds()); | 2826 EXPECT_EQ(IntSize(5, 100), overflowBScrollNode->bounds()); |
| 2824 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableHorizontal()); | 2827 EXPECT_TRUE(overflowBScrollNode->userScrollableHorizontal()); |
| 2825 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableVertical()); | 2828 EXPECT_TRUE(overflowBScrollNode->userScrollableVertical()); |
| 2826 } | 2829 } |
| 2827 | 2830 |
| 2828 TEST_P(PaintPropertyTreeBuilderTest, SVGRootClip) { | 2831 TEST_P(PaintPropertyTreeBuilderTest, SVGRootClip) { |
| 2829 setBodyInnerHTML( | 2832 setBodyInnerHTML( |
| 2830 "<svg id='svg' width='100px' height='100px'>" | 2833 "<svg id='svg' width='100px' height='100px'>" |
| 2831 " <rect width='200' height='200' fill='red' />" | 2834 " <rect width='200' height='200' fill='red' />" |
| 2832 "</svg>"); | 2835 "</svg>"); |
| 2833 | 2836 |
| 2834 const ClipPaintPropertyNode* clip = | 2837 const ClipPaintPropertyNode* clip = |
| 2835 getLayoutObjectByElementId("svg")->paintProperties()->overflowClip(); | 2838 getLayoutObjectByElementId("svg")->paintProperties()->overflowClip(); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 EXPECT_EQ(0.5f, effect->opacity()); | 3143 EXPECT_EQ(0.5f, effect->opacity()); |
| 3141 | 3144 |
| 3142 LayoutObject* target = getLayoutObjectByElementId("target"); | 3145 LayoutObject* target = getLayoutObjectByElementId("target"); |
| 3143 const auto* localBorderBoxProperties = | 3146 const auto* localBorderBoxProperties = |
| 3144 target->paintProperties()->localBorderBoxProperties(); | 3147 target->paintProperties()->localBorderBoxProperties(); |
| 3145 ASSERT_TRUE(localBorderBoxProperties); | 3148 ASSERT_TRUE(localBorderBoxProperties); |
| 3146 EXPECT_EQ(LayoutPoint(66, 55), target->paintOffset()); | 3149 EXPECT_EQ(LayoutPoint(66, 55), target->paintOffset()); |
| 3147 EXPECT_EQ(effect, localBorderBoxProperties->effect()); | 3150 EXPECT_EQ(effect, localBorderBoxProperties->effect()); |
| 3148 } | 3151 } |
| 3149 | 3152 |
| 3150 TEST_P(PaintPropertyTreeBuilderTest, ScrollNodeHasCompositorElementId) { | 3153 TEST_P(PaintPropertyTreeBuilderTest, ScrollTranslationHasCompositorElementId) { |
| 3151 setBodyInnerHTML( | 3154 setBodyInnerHTML( |
| 3152 "<div id='target' style='overflow: auto; width: 100px; height: 100px'>" | 3155 "<div id='target' style='overflow: auto; width: 100px; height: 100px'>" |
| 3153 " <div style='width: 200px; height: 200px'></div>" | 3156 " <div style='width: 200px; height: 200px'></div>" |
| 3154 "</div>"); | 3157 "</div>"); |
| 3155 | 3158 |
| 3156 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3159 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3157 EXPECT_TRUE(properties->scroll()); | 3160 EXPECT_NE(CompositorElementId(), |
| 3158 EXPECT_NE(CompositorElementId(), properties->scroll()->compositorElementId()); | 3161 properties->scrollTranslation()->compositorElementId()); |
| 3159 } | 3162 } |
| 3160 | 3163 |
| 3161 } // namespace blink | 3164 } // namespace blink |
| OLD | NEW |