| 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/layout/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
| 7 #include "core/layout/api/LayoutViewItem.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
| 9 #include "core/paint/PaintPropertyTreePrinter.h" | 9 #include "core/paint/PaintPropertyTreePrinter.h" |
| 10 #include "platform/graphics/paint/GeometryMapper.h" | 10 #include "platform/graphics/paint/GeometryMapper.h" |
| (...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2603 " }" | 2603 " }" |
| 2604 " .forceScroll {" | 2604 " .forceScroll {" |
| 2605 " height: 4000px;" | 2605 " height: 4000px;" |
| 2606 " }" | 2606 " }" |
| 2607 "</style>" | 2607 "</style>" |
| 2608 "<div id='overflowA'>" | 2608 "<div id='overflowA'>" |
| 2609 " <div class='forceScroll'></div>" | 2609 " <div class='forceScroll'></div>" |
| 2610 "</div>" | 2610 "</div>" |
| 2611 "<div class='forceScroll'></div>"); | 2611 "<div class='forceScroll'></div>"); |
| 2612 Element* overflowA = document().getElementById("overflowA"); | 2612 Element* overflowA = document().getElementById("overflowA"); |
| 2613 EXPECT_FALSE(frameScroll()->hasMainThreadScrollingReasons( | 2613 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled()); |
| 2614 MainThreadScrollingReason::kThreadedScrollingDisabled)); | |
| 2615 EXPECT_FALSE(overflowA->layoutObject() | 2614 EXPECT_FALSE(overflowA->layoutObject() |
| 2616 ->paintProperties() | 2615 ->paintProperties() |
| 2617 ->scroll() | 2616 ->scroll() |
| 2618 ->hasMainThreadScrollingReasons( | 2617 ->threadedScrollingDisabled()); |
| 2619 MainThreadScrollingReason::kThreadedScrollingDisabled)); | |
| 2620 | 2618 |
| 2621 document().settings()->setThreadedScrollingEnabled(false); | 2619 document().settings()->setThreadedScrollingEnabled(false); |
| 2620 // TODO(pdr): The main thread scrolling setting should invalidate properties. |
| 2621 document().view()->setNeedsPaintPropertyUpdate(); |
| 2622 overflowA->layoutObject()->setNeedsPaintPropertyUpdate(); |
| 2622 document().view()->updateAllLifecyclePhases(); | 2623 document().view()->updateAllLifecyclePhases(); |
| 2623 | 2624 |
| 2624 EXPECT_TRUE(frameScroll()->hasMainThreadScrollingReasons( | 2625 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled()); |
| 2625 MainThreadScrollingReason::kThreadedScrollingDisabled)); | |
| 2626 EXPECT_TRUE(overflowA->layoutObject() | 2626 EXPECT_TRUE(overflowA->layoutObject() |
| 2627 ->paintProperties() | 2627 ->paintProperties() |
| 2628 ->scroll() | 2628 ->scroll() |
| 2629 ->hasMainThreadScrollingReasons( | 2629 ->threadedScrollingDisabled()); |
| 2630 MainThreadScrollingReason::kThreadedScrollingDisabled)); | |
| 2631 } | 2630 } |
| 2632 | 2631 |
| 2633 // Disabled due to missing main thread scrolling property invalidation support. | 2632 TEST_P(PaintPropertyTreeBuilderTest, |
| 2634 // See: https://crbug.com/664672 | 2633 BackgroundAttachmentFixedMainThreadScrollReasonsWithNestedScrollers) { |
| 2635 TEST_P( | |
| 2636 PaintPropertyTreeBuilderTest, | |
| 2637 DISABLED_BackgroundAttachmentFixedMainThreadScrollReasonsWithNestedScrollers
) { | |
| 2638 setBodyInnerHTML( | 2634 setBodyInnerHTML( |
| 2639 "<style>" | 2635 "<style>" |
| 2640 " #overflowA {" | 2636 " #overflowA {" |
| 2641 " position: absolute;" | 2637 " position: absolute;" |
| 2642 " overflow: scroll;" | 2638 " overflow: scroll;" |
| 2643 " width: 20px;" | 2639 " width: 20px;" |
| 2644 " height: 20px;" | 2640 " height: 20px;" |
| 2645 " }" | 2641 " }" |
| 2646 " #overflowB {" | 2642 " #overflowB {" |
| 2647 " position: absolute;" | 2643 " position: absolute;" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2660 "<div id='overflowA'>" | 2656 "<div id='overflowA'>" |
| 2661 " <div id='overflowB' class='backgroundAttachmentFixed'>" | 2657 " <div id='overflowB' class='backgroundAttachmentFixed'>" |
| 2662 " <div class='forceScroll'></div>" | 2658 " <div class='forceScroll'></div>" |
| 2663 " </div>" | 2659 " </div>" |
| 2664 " <div class='forceScroll'></div>" | 2660 " <div class='forceScroll'></div>" |
| 2665 "</div>" | 2661 "</div>" |
| 2666 "<div class='forceScroll'></div>"); | 2662 "<div class='forceScroll'></div>"); |
| 2667 Element* overflowA = document().getElementById("overflowA"); | 2663 Element* overflowA = document().getElementById("overflowA"); |
| 2668 Element* overflowB = document().getElementById("overflowB"); | 2664 Element* overflowB = document().getElementById("overflowB"); |
| 2669 | 2665 |
| 2670 EXPECT_TRUE(frameScroll()->hasMainThreadScrollingReasons( | 2666 EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedDescendants()); |
| 2671 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2667 EXPECT_TRUE(overflowA->layoutObject() |
| 2672 EXPECT_TRUE( | 2668 ->paintProperties() |
| 2673 overflowA->layoutObject() | 2669 ->scroll() |
| 2674 ->paintProperties() | 2670 ->hasBackgroundAttachmentFixedDescendants()); |
| 2675 ->scroll() | 2671 EXPECT_FALSE(overflowB->layoutObject() |
| 2676 ->hasMainThreadScrollingReasons( | 2672 ->paintProperties() |
| 2677 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2673 ->scroll() |
| 2678 EXPECT_FALSE( | 2674 ->hasBackgroundAttachmentFixedDescendants()); |
| 2679 overflowB->layoutObject() | |
| 2680 ->paintProperties() | |
| 2681 ->scroll() | |
| 2682 ->hasMainThreadScrollingReasons( | |
| 2683 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | |
| 2684 | 2675 |
| 2685 // Removing a main thread scrolling reason should update the entire tree. | 2676 // Removing a main thread scrolling reason should update the entire tree. |
| 2686 overflowB->removeAttribute("class"); | 2677 overflowB->removeAttribute("class"); |
| 2687 document().view()->updateAllLifecyclePhases(); | 2678 document().view()->updateAllLifecyclePhases(); |
| 2688 EXPECT_FALSE(frameScroll()->hasMainThreadScrollingReasons( | 2679 EXPECT_FALSE(frameScroll()->hasBackgroundAttachmentFixedDescendants()); |
| 2689 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2680 EXPECT_FALSE(overflowA->layoutObject() |
| 2690 EXPECT_FALSE( | 2681 ->paintProperties() |
| 2691 overflowA->layoutObject() | 2682 ->scroll() |
| 2692 ->paintProperties() | 2683 ->hasBackgroundAttachmentFixedDescendants()); |
| 2693 ->scroll() | 2684 EXPECT_FALSE(overflowB->layoutObject() |
| 2694 ->hasMainThreadScrollingReasons( | 2685 ->paintProperties() |
| 2695 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2686 ->scroll() |
| 2696 EXPECT_FALSE( | 2687 ->hasBackgroundAttachmentFixedDescendants()); |
| 2697 overflowB->layoutObject() | |
| 2698 ->paintProperties() | |
| 2699 ->scroll() | |
| 2700 ->hasMainThreadScrollingReasons( | |
| 2701 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | |
| 2702 | 2688 |
| 2703 // Adding a main thread scrolling reason should update the entire tree. | 2689 // Adding a main thread scrolling reason should update the entire tree. |
| 2704 overflowB->setAttribute(HTMLNames::classAttr, "backgroundAttachmentFixed"); | 2690 overflowB->setAttribute(HTMLNames::classAttr, "backgroundAttachmentFixed"); |
| 2705 document().view()->updateAllLifecyclePhases(); | 2691 document().view()->updateAllLifecyclePhases(); |
| 2706 EXPECT_TRUE(frameScroll()->hasMainThreadScrollingReasons( | 2692 EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedDescendants()); |
| 2707 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2693 EXPECT_TRUE(overflowA->layoutObject() |
| 2708 EXPECT_TRUE( | 2694 ->paintProperties() |
| 2709 overflowA->layoutObject() | 2695 ->scroll() |
| 2710 ->paintProperties() | 2696 ->hasBackgroundAttachmentFixedDescendants()); |
| 2711 ->scroll() | 2697 EXPECT_FALSE(overflowB->layoutObject() |
| 2712 ->hasMainThreadScrollingReasons( | 2698 ->paintProperties() |
| 2713 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2699 ->scroll() |
| 2714 EXPECT_FALSE( | 2700 ->hasBackgroundAttachmentFixedDescendants()); |
| 2715 overflowB->layoutObject() | |
| 2716 ->paintProperties() | |
| 2717 ->scroll() | |
| 2718 ->hasMainThreadScrollingReasons( | |
| 2719 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | |
| 2720 } | 2701 } |
| 2721 | 2702 |
| 2722 // Disabled due to missing main thread scrolling property invalidation support. | 2703 TEST_P(PaintPropertyTreeBuilderTest, |
| 2723 // See: https://crbug.com/664672 | 2704 BackgroundAttachmentFixedMainThreadScrollReasonsWithFixedScroller) { |
| 2724 TEST_P( | |
| 2725 PaintPropertyTreeBuilderTest, | |
| 2726 DISABLED_BackgroundAttachmentFixedMainThreadScrollReasonsWithFixedScroller)
{ | |
| 2727 setBodyInnerHTML( | 2705 setBodyInnerHTML( |
| 2728 "<style>" | 2706 "<style>" |
| 2729 " #overflowA {" | 2707 " #overflowA {" |
| 2730 " position: absolute;" | 2708 " position: absolute;" |
| 2731 " overflow: scroll;" | 2709 " overflow: scroll;" |
| 2732 " width: 20px;" | 2710 " width: 20px;" |
| 2733 " height: 20px;" | 2711 " height: 20px;" |
| 2734 " }" | 2712 " }" |
| 2735 " #overflowB {" | 2713 " #overflowB {" |
| 2736 " position: fixed;" | 2714 " position: fixed;" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2749 "<div id='overflowA'>" | 2727 "<div id='overflowA'>" |
| 2750 " <div id='overflowB' class='backgroundAttachmentFixed'>" | 2728 " <div id='overflowB' class='backgroundAttachmentFixed'>" |
| 2751 " <div class='forceScroll'></div>" | 2729 " <div class='forceScroll'></div>" |
| 2752 " </div>" | 2730 " </div>" |
| 2753 " <div class='forceScroll'></div>" | 2731 " <div class='forceScroll'></div>" |
| 2754 "</div>" | 2732 "</div>" |
| 2755 "<div class='forceScroll'></div>"); | 2733 "<div class='forceScroll'></div>"); |
| 2756 Element* overflowA = document().getElementById("overflowA"); | 2734 Element* overflowA = document().getElementById("overflowA"); |
| 2757 Element* overflowB = document().getElementById("overflowB"); | 2735 Element* overflowB = document().getElementById("overflowB"); |
| 2758 | 2736 |
| 2759 EXPECT_FALSE( | 2737 // This should be false. We are not as strict about main thread scrolling |
| 2760 overflowA->layoutObject() | 2738 // reasons as we could be. |
| 2761 ->paintProperties() | 2739 EXPECT_TRUE(overflowA->layoutObject() |
| 2762 ->scroll() | 2740 ->paintProperties() |
| 2763 ->hasMainThreadScrollingReasons( | 2741 ->scroll() |
| 2764 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2742 ->hasBackgroundAttachmentFixedDescendants()); |
| 2765 EXPECT_FALSE( | 2743 EXPECT_FALSE(overflowB->layoutObject() |
| 2766 overflowB->layoutObject() | 2744 ->paintProperties() |
| 2767 ->paintProperties() | 2745 ->scroll() |
| 2768 ->scroll() | 2746 ->hasBackgroundAttachmentFixedDescendants()); |
| 2769 ->hasMainThreadScrollingReasons( | 2747 EXPECT_TRUE(overflowB->layoutObject() |
| 2770 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2748 ->paintProperties() |
| 2771 EXPECT_TRUE( | 2749 ->scroll() |
| 2772 overflowB->layoutObject() | 2750 ->parent() |
| 2773 ->paintProperties() | 2751 ->isRoot()); |
| 2774 ->scroll() | |
| 2775 ->parent() | |
| 2776 ->hasMainThreadScrollingReasons( | |
| 2777 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | |
| 2778 | 2752 |
| 2779 // Removing a main thread scrolling reason should update the entire tree. | 2753 // Removing a main thread scrolling reason should update the entire tree. |
| 2780 overflowB->removeAttribute("class"); | 2754 overflowB->removeAttribute("class"); |
| 2781 document().view()->updateAllLifecyclePhases(); | 2755 document().view()->updateAllLifecyclePhases(); |
| 2782 EXPECT_FALSE( | 2756 EXPECT_FALSE(overflowA->layoutObject() |
| 2783 overflowA->layoutObject() | 2757 ->paintProperties() |
| 2784 ->paintProperties() | 2758 ->scroll() |
| 2785 ->scroll() | 2759 ->hasBackgroundAttachmentFixedDescendants()); |
| 2786 ->hasMainThreadScrollingReasons( | 2760 EXPECT_FALSE(overflowB->layoutObject() |
| 2787 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2761 ->paintProperties() |
| 2788 EXPECT_FALSE( | 2762 ->scroll() |
| 2789 overflowB->layoutObject() | 2763 ->hasBackgroundAttachmentFixedDescendants()); |
| 2790 ->paintProperties() | 2764 EXPECT_FALSE(overflowB->layoutObject() |
| 2791 ->scroll() | 2765 ->paintProperties() |
| 2792 ->hasMainThreadScrollingReasons( | 2766 ->scroll() |
| 2793 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | 2767 ->parent() |
| 2794 EXPECT_FALSE( | 2768 ->hasBackgroundAttachmentFixedDescendants()); |
| 2795 overflowB->layoutObject() | |
| 2796 ->paintProperties() | |
| 2797 ->scroll() | |
| 2798 ->parent() | |
| 2799 ->hasMainThreadScrollingReasons( | |
| 2800 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); | |
| 2801 } | 2769 } |
| 2802 | 2770 |
| 2803 TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetsUnderMultiColumn) { | 2771 TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetsUnderMultiColumn) { |
| 2804 setBodyInnerHTML( | 2772 setBodyInnerHTML( |
| 2805 "<style>" | 2773 "<style>" |
| 2806 " body { margin: 0; }" | 2774 " body { margin: 0; }" |
| 2807 " .space { height: 30px; }" | 2775 " .space { height: 30px; }" |
| 2808 " .abs { position: absolute; width: 20px; height: 20px; }" | 2776 " .abs { position: absolute; width: 20px; height: 20px; }" |
| 2809 "</style>" | 2777 "</style>" |
| 2810 "<div style='columns:2; width: 200px; column-gap: 0'>" | 2778 "<div style='columns:2; width: 200px; column-gap: 0'>" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2920 EXPECT_EQ(framePreTranslation(), | 2888 EXPECT_EQ(framePreTranslation(), |
| 2921 childProperties->paintOffsetTranslation()->parent()); | 2889 childProperties->paintOffsetTranslation()->parent()); |
| 2922 EXPECT_EQ(childProperties->paintOffsetTranslation(), | 2890 EXPECT_EQ(childProperties->paintOffsetTranslation(), |
| 2923 childPaintState.transform()); | 2891 childPaintState.transform()); |
| 2924 // This will change once we added clip expansion node. | 2892 // This will change once we added clip expansion node. |
| 2925 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); | 2893 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); |
| 2926 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); | 2894 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); |
| 2927 } | 2895 } |
| 2928 | 2896 |
| 2929 } // namespace blink | 2897 } // namespace blink |
| OLD | NEW |