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