| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/dom/ClientRect.h" | 5 #include "core/dom/ClientRect.h" |
| 6 #include "core/frame/BrowserControls.h" | 6 #include "core/frame/BrowserControls.h" |
| 7 #include "core/frame/FrameHost.h" | 7 #include "core/frame/FrameHost.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/RootFrameViewport.h" | 9 #include "core/frame/RootFrameViewport.h" |
| 10 #include "core/frame/VisualViewport.h" | 10 #include "core/frame/VisualViewport.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 Element* container = iframe->contentDocument()->getElementById("container"); | 517 Element* container = iframe->contentDocument()->getElementById("container"); |
| 518 | 518 |
| 519 const TopDocumentRootScrollerController& mainController = | 519 const TopDocumentRootScrollerController& mainController = |
| 520 mainFrame()->document()->frameHost()->globalRootScrollerController(); | 520 mainFrame()->document()->frameHost()->globalRootScrollerController(); |
| 521 | 521 |
| 522 NonThrowableExceptionState nonThrow; | 522 NonThrowableExceptionState nonThrow; |
| 523 | 523 |
| 524 // No root scroller set, the documentElement should be the effective root | 524 // No root scroller set, the documentElement should be the effective root |
| 525 // and the main FrameView's scroll layer should be the layer to use. | 525 // and the main FrameView's scroll layer should be the layer to use. |
| 526 { | 526 { |
| 527 EXPECT_EQ(mainController.rootScrollerLayer(), | 527 EXPECT_EQ( |
| 528 mainFrameView()->layerForScrolling()); | 528 mainController.rootScrollerLayer(), |
| 529 mainFrameView()->layoutViewportScrollableArea()->layerForScrolling()); |
| 529 EXPECT_TRUE(mainController.isViewportScrollCallback( | 530 EXPECT_TRUE(mainController.isViewportScrollCallback( |
| 530 mainFrame()->document()->documentElement()->getApplyScroll())); | 531 mainFrame()->document()->documentElement()->getApplyScroll())); |
| 531 } | 532 } |
| 532 | 533 |
| 533 // Set a root scroller in the iframe. Since the main document didn't set a | 534 // Set a root scroller in the iframe. Since the main document didn't set a |
| 534 // root scroller, the global root scroller shouldn't change. | 535 // root scroller, the global root scroller shouldn't change. |
| 535 { | 536 { |
| 536 iframe->contentDocument()->setRootScroller(container, nonThrow); | 537 iframe->contentDocument()->setRootScroller(container, nonThrow); |
| 537 mainFrameView()->updateAllLifecyclePhases(); | 538 mainFrameView()->updateAllLifecyclePhases(); |
| 538 | 539 |
| 539 EXPECT_EQ(mainController.rootScrollerLayer(), | 540 EXPECT_EQ( |
| 540 mainFrameView()->layerForScrolling()); | 541 mainController.rootScrollerLayer(), |
| 542 mainFrameView()->layoutViewportScrollableArea()->layerForScrolling()); |
| 541 EXPECT_TRUE(mainController.isViewportScrollCallback( | 543 EXPECT_TRUE(mainController.isViewportScrollCallback( |
| 542 mainFrame()->document()->documentElement()->getApplyScroll())); | 544 mainFrame()->document()->documentElement()->getApplyScroll())); |
| 543 } | 545 } |
| 544 | 546 |
| 545 // Setting the iframe as the root scroller in the main frame should now | 547 // Setting the iframe as the root scroller in the main frame should now |
| 546 // link the root scrollers so the container should now be the global root | 548 // link the root scrollers so the container should now be the global root |
| 547 // scroller. | 549 // scroller. |
| 548 { | 550 { |
| 549 mainFrame()->document()->setRootScroller(iframe, nonThrow); | 551 mainFrame()->document()->setRootScroller(iframe, nonThrow); |
| 550 mainFrameView()->updateAllLifecyclePhases(); | 552 mainFrameView()->updateAllLifecyclePhases(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 561 mainController.isViewportScrollCallback(container->getApplyScroll())); | 563 mainController.isViewportScrollCallback(container->getApplyScroll())); |
| 562 } | 564 } |
| 563 | 565 |
| 564 // Unsetting the root scroller in the iframe should reset its effective | 566 // Unsetting the root scroller in the iframe should reset its effective |
| 565 // root scroller to the iframe's documentElement and thus the iframe's | 567 // root scroller to the iframe's documentElement and thus the iframe's |
| 566 // documentElement becomes the global root scroller. | 568 // documentElement becomes the global root scroller. |
| 567 { | 569 { |
| 568 iframe->contentDocument()->setRootScroller(nullptr, nonThrow); | 570 iframe->contentDocument()->setRootScroller(nullptr, nonThrow); |
| 569 mainFrameView()->updateAllLifecyclePhases(); | 571 mainFrameView()->updateAllLifecyclePhases(); |
| 570 EXPECT_EQ(mainController.rootScrollerLayer(), | 572 EXPECT_EQ(mainController.rootScrollerLayer(), |
| 571 iframe->contentDocument()->view()->layerForScrolling()); | 573 iframe->contentDocument() |
| 574 ->view() |
| 575 ->layoutViewportScrollableArea() |
| 576 ->layerForScrolling()); |
| 572 EXPECT_FALSE( | 577 EXPECT_FALSE( |
| 573 mainController.isViewportScrollCallback(container->getApplyScroll())); | 578 mainController.isViewportScrollCallback(container->getApplyScroll())); |
| 574 EXPECT_FALSE(mainController.isViewportScrollCallback( | 579 EXPECT_FALSE(mainController.isViewportScrollCallback( |
| 575 mainFrame()->document()->documentElement()->getApplyScroll())); | 580 mainFrame()->document()->documentElement()->getApplyScroll())); |
| 576 EXPECT_TRUE(mainController.isViewportScrollCallback( | 581 EXPECT_TRUE(mainController.isViewportScrollCallback( |
| 577 iframe->contentDocument()->documentElement()->getApplyScroll())); | 582 iframe->contentDocument()->documentElement()->getApplyScroll())); |
| 578 } | 583 } |
| 579 | 584 |
| 580 // Finally, unsetting the main frame's root scroller should reset it to the | 585 // Finally, unsetting the main frame's root scroller should reset it to the |
| 581 // documentElement and corresponding layer. | 586 // documentElement and corresponding layer. |
| 582 { | 587 { |
| 583 mainFrame()->document()->setRootScroller(nullptr, nonThrow); | 588 mainFrame()->document()->setRootScroller(nullptr, nonThrow); |
| 584 mainFrameView()->updateAllLifecyclePhases(); | 589 mainFrameView()->updateAllLifecyclePhases(); |
| 585 EXPECT_EQ(mainController.rootScrollerLayer(), | 590 EXPECT_EQ( |
| 586 mainFrameView()->layerForScrolling()); | 591 mainController.rootScrollerLayer(), |
| 592 mainFrameView()->layoutViewportScrollableArea()->layerForScrolling()); |
| 587 EXPECT_TRUE(mainController.isViewportScrollCallback( | 593 EXPECT_TRUE(mainController.isViewportScrollCallback( |
| 588 mainFrame()->document()->documentElement()->getApplyScroll())); | 594 mainFrame()->document()->documentElement()->getApplyScroll())); |
| 589 EXPECT_FALSE( | 595 EXPECT_FALSE( |
| 590 mainController.isViewportScrollCallback(container->getApplyScroll())); | 596 mainController.isViewportScrollCallback(container->getApplyScroll())); |
| 591 EXPECT_FALSE(mainController.isViewportScrollCallback( | 597 EXPECT_FALSE(mainController.isViewportScrollCallback( |
| 592 iframe->contentDocument()->documentElement()->getApplyScroll())); | 598 iframe->contentDocument()->documentElement()->getApplyScroll())); |
| 593 } | 599 } |
| 594 } | 600 } |
| 595 | 601 |
| 596 TEST_F(RootScrollerTest, TestSetRootScrollerCausesViewportLayerChange) { | 602 TEST_F(RootScrollerTest, TestSetRootScrollerCausesViewportLayerChange) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 // ViewportScrollCallback removed. Keep the scrolls to guard crashes | 728 // ViewportScrollCallback removed. Keep the scrolls to guard crashes |
| 723 // but the expectations on when a ViewportScrollCallback have changed | 729 // but the expectations on when a ViewportScrollCallback have changed |
| 724 // and should be updated. | 730 // and should be updated. |
| 725 // EXPECT_EQ(200, container->scrollTop()); | 731 // EXPECT_EQ(200, container->scrollTop()); |
| 726 } | 732 } |
| 727 | 733 |
| 728 // Reset explicitly to prevent lifetime issues with the RemoteFrameClient. | 734 // Reset explicitly to prevent lifetime issues with the RemoteFrameClient. |
| 729 m_helper.reset(); | 735 m_helper.reset(); |
| 730 } | 736 } |
| 731 | 737 |
| 738 GraphicsLayer* scrollingLayer(LayoutView& layoutView) { |
| 739 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 740 return layoutView.layer()->compositedLayerMapping()->scrollingLayer(); |
| 741 return layoutView.compositor()->rootContentLayer(); |
| 742 } |
| 743 |
| 732 // Tests that clipping layers belonging to any compositors in the ancestor chain | 744 // Tests that clipping layers belonging to any compositors in the ancestor chain |
| 733 // of the global root scroller have their masking bit removed. | 745 // of the global root scroller have their masking bit removed. |
| 734 TEST_F(RootScrollerTest, RemoveClippingOnCompositorLayers) { | 746 TEST_F(RootScrollerTest, RemoveClippingOnCompositorLayers) { |
| 735 initialize("root-scroller-iframe.html"); | 747 initialize("root-scroller-iframe.html"); |
| 736 | 748 |
| 737 HTMLFrameOwnerElement* iframe = toHTMLFrameOwnerElement( | 749 HTMLFrameOwnerElement* iframe = toHTMLFrameOwnerElement( |
| 738 mainFrame()->document()->getElementById("iframe")); | 750 mainFrame()->document()->getElementById("iframe")); |
| 739 Element* container = iframe->contentDocument()->getElementById("container"); | 751 Element* container = iframe->contentDocument()->getElementById("container"); |
| 740 | 752 |
| 741 RootScrollerController& mainController = | 753 RootScrollerController& mainController = |
| 742 mainFrame()->document()->rootScrollerController(); | 754 mainFrame()->document()->rootScrollerController(); |
| 743 RootScrollerController& childController = | 755 RootScrollerController& childController = |
| 744 iframe->contentDocument()->rootScrollerController(); | 756 iframe->contentDocument()->rootScrollerController(); |
| 745 TopDocumentRootScrollerController& globalController = | 757 TopDocumentRootScrollerController& globalController = |
| 746 frameHost().globalRootScrollerController(); | 758 frameHost().globalRootScrollerController(); |
| 747 | 759 |
| 748 PaintLayerCompositor* mainCompositor = | 760 LayoutView* mainLayoutView = mainFrameView()->layoutView(); |
| 749 mainFrameView()->layoutViewItem().compositor(); | 761 LayoutView* childLayoutView = iframe->contentDocument()->layoutView(); |
| 750 PaintLayerCompositor* childCompositor = | 762 PaintLayerCompositor* mainCompositor = mainLayoutView->compositor(); |
| 751 iframe->contentDocument()->view()->layoutViewItem().compositor(); | 763 PaintLayerCompositor* childCompositor = childLayoutView->compositor(); |
| 752 | 764 |
| 753 NonThrowableExceptionState nonThrow; | 765 NonThrowableExceptionState nonThrow; |
| 754 | 766 |
| 755 // No root scroller set, on the main frame the root content layer should | 767 // No root scroller set, on the main frame the root content layer should |
| 756 // clip. Additionally, on the child frame, the overflow controls host and | 768 // clip. Additionally, on the child frame, the overflow controls host and |
| 757 // container layers should also clip. | 769 // container layers should also clip. |
| 758 { | 770 { |
| 759 EXPECT_TRUE( | 771 EXPECT_TRUE( |
| 760 mainCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 772 scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
| 761 EXPECT_FALSE( | 773 EXPECT_FALSE( |
| 762 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 774 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 763 EXPECT_FALSE( | 775 EXPECT_FALSE( |
| 764 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); | 776 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 765 | 777 |
| 766 EXPECT_TRUE( | 778 EXPECT_TRUE( |
| 767 childCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 779 scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
| 768 EXPECT_TRUE( | 780 EXPECT_TRUE( |
| 769 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 781 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 770 EXPECT_TRUE( | 782 EXPECT_TRUE( |
| 771 childCompositor->containerLayer()->platformLayer()->masksToBounds()); | 783 childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 772 } | 784 } |
| 773 | 785 |
| 774 // Now set the root scrollers such that the container in the iframe is the | 786 // Now set the root scrollers such that the container in the iframe is the |
| 775 // global root scroller. All the previously clipping layers in both paint | 787 // global root scroller. All the previously clipping layers in both paint |
| 776 // layer compositors should no longer clip. | 788 // layer compositors should no longer clip. |
| 777 { | 789 { |
| 778 iframe->contentDocument()->setRootScroller(container, nonThrow); | 790 iframe->contentDocument()->setRootScroller(container, nonThrow); |
| 779 mainFrame()->document()->setRootScroller(iframe, nonThrow); | 791 mainFrame()->document()->setRootScroller(iframe, nonThrow); |
| 780 mainFrameView()->updateAllLifecyclePhases(); | 792 mainFrameView()->updateAllLifecyclePhases(); |
| 781 | 793 |
| 782 ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); | 794 ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); |
| 783 ASSERT_EQ(container, &childController.effectiveRootScroller()); | 795 ASSERT_EQ(container, &childController.effectiveRootScroller()); |
| 784 | 796 |
| 785 EXPECT_FALSE( | 797 EXPECT_FALSE( |
| 786 mainCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 798 scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
| 787 EXPECT_FALSE( | 799 EXPECT_FALSE( |
| 788 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 800 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 789 EXPECT_FALSE( | 801 EXPECT_FALSE( |
| 790 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); | 802 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 791 | 803 |
| 792 EXPECT_FALSE( | 804 EXPECT_FALSE( |
| 793 childCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 805 scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
| 794 EXPECT_FALSE( | 806 EXPECT_FALSE( |
| 795 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 807 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 796 EXPECT_FALSE( | 808 EXPECT_FALSE( |
| 797 childCompositor->containerLayer()->platformLayer()->masksToBounds()); | 809 childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 798 } | 810 } |
| 799 | 811 |
| 800 // Now reset the iframe's root scroller. Since the iframe itself is now the | 812 // Now reset the iframe's root scroller. Since the iframe itself is now the |
| 801 // global root scroller we want it to behave as if it were the main frame, | 813 // global root scroller we want it to behave as if it were the main frame, |
| 802 // which means it should clip only on its root content layer. | 814 // which means it should clip only on its root content layer. |
| 803 { | 815 { |
| 804 iframe->contentDocument()->setRootScroller(nullptr, nonThrow); | 816 iframe->contentDocument()->setRootScroller(nullptr, nonThrow); |
| 805 mainFrameView()->updateAllLifecyclePhases(); | 817 mainFrameView()->updateAllLifecyclePhases(); |
| 806 | 818 |
| 807 ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); | 819 ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); |
| 808 ASSERT_EQ(iframe->contentDocument(), | 820 ASSERT_EQ(iframe->contentDocument(), |
| 809 &childController.effectiveRootScroller()); | 821 &childController.effectiveRootScroller()); |
| 810 ASSERT_EQ(iframe->contentDocument()->documentElement(), | 822 ASSERT_EQ(iframe->contentDocument()->documentElement(), |
| 811 globalController.globalRootScroller()); | 823 globalController.globalRootScroller()); |
| 812 | 824 |
| 813 EXPECT_FALSE( | 825 EXPECT_FALSE( |
| 814 mainCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 826 scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
| 815 EXPECT_FALSE( | 827 EXPECT_FALSE( |
| 816 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 828 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 817 EXPECT_FALSE( | 829 EXPECT_FALSE( |
| 818 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); | 830 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 819 | 831 |
| 820 EXPECT_TRUE( | 832 EXPECT_TRUE( |
| 821 childCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 833 scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
| 822 EXPECT_FALSE( | 834 EXPECT_FALSE( |
| 823 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 835 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 824 EXPECT_FALSE( | 836 EXPECT_FALSE( |
| 825 childCompositor->containerLayer()->platformLayer()->masksToBounds()); | 837 childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 826 } | 838 } |
| 827 | 839 |
| 828 // Now reset the main frame's root scroller. Its compositor should go back | 840 // Now reset the main frame's root scroller. Its compositor should go back |
| 829 // to clipping as well. Because the iframe is now no longer the global root | 841 // to clipping as well. Because the iframe is now no longer the global root |
| 830 // scroller, it should go back to clipping its overflow host and container | 842 // scroller, it should go back to clipping its overflow host and container |
| 831 // layers. This checks that we invalidate the compositing state even though | 843 // layers. This checks that we invalidate the compositing state even though |
| 832 // the iframe's effective root scroller hasn't changed. | 844 // the iframe's effective root scroller hasn't changed. |
| 833 | 845 |
| 834 { | 846 { |
| 835 mainFrame()->document()->setRootScroller(nullptr, nonThrow); | 847 mainFrame()->document()->setRootScroller(nullptr, nonThrow); |
| 836 mainFrameView()->updateAllLifecyclePhases(); | 848 mainFrameView()->updateAllLifecyclePhases(); |
| 837 | 849 |
| 838 ASSERT_EQ(mainFrame()->document(), &mainController.effectiveRootScroller()); | 850 ASSERT_EQ(mainFrame()->document(), &mainController.effectiveRootScroller()); |
| 839 ASSERT_EQ(iframe->contentDocument(), | 851 ASSERT_EQ(iframe->contentDocument(), |
| 840 &childController.effectiveRootScroller()); | 852 &childController.effectiveRootScroller()); |
| 841 ASSERT_EQ(mainFrame()->document()->documentElement(), | 853 ASSERT_EQ(mainFrame()->document()->documentElement(), |
| 842 globalController.globalRootScroller()); | 854 globalController.globalRootScroller()); |
| 843 | 855 |
| 844 EXPECT_TRUE( | 856 EXPECT_TRUE( |
| 845 mainCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 857 scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
| 846 EXPECT_FALSE( | 858 EXPECT_FALSE( |
| 847 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 859 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 848 EXPECT_FALSE( | 860 EXPECT_FALSE( |
| 849 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); | 861 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 850 | 862 |
| 851 EXPECT_TRUE( | 863 EXPECT_TRUE( |
| 852 childCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 864 scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
| 853 EXPECT_TRUE( | 865 EXPECT_TRUE( |
| 854 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 866 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 855 EXPECT_TRUE( | 867 EXPECT_TRUE( |
| 856 childCompositor->containerLayer()->platformLayer()->masksToBounds()); | 868 childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 857 } | 869 } |
| 858 | 870 |
| 859 // Set the iframe back as the main frame's root scroller. Since its the | 871 // Set the iframe back as the main frame's root scroller. Since its the |
| 860 // global root scroller again, it should clip like the root frame. This | 872 // global root scroller again, it should clip like the root frame. This |
| 861 // checks that we invalidate the compositing state even though the iframe's | 873 // checks that we invalidate the compositing state even though the iframe's |
| 862 // effective root scroller hasn't changed. | 874 // effective root scroller hasn't changed. |
| 863 { | 875 { |
| 864 mainFrame()->document()->setRootScroller(iframe, nonThrow); | 876 mainFrame()->document()->setRootScroller(iframe, nonThrow); |
| 865 mainFrameView()->updateAllLifecyclePhases(); | 877 mainFrameView()->updateAllLifecyclePhases(); |
| 866 | 878 |
| 867 ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); | 879 ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); |
| 868 ASSERT_EQ(iframe->contentDocument(), | 880 ASSERT_EQ(iframe->contentDocument(), |
| 869 &childController.effectiveRootScroller()); | 881 &childController.effectiveRootScroller()); |
| 870 ASSERT_EQ(iframe->contentDocument()->documentElement(), | 882 ASSERT_EQ(iframe->contentDocument()->documentElement(), |
| 871 globalController.globalRootScroller()); | 883 globalController.globalRootScroller()); |
| 872 | 884 |
| 873 EXPECT_FALSE( | 885 EXPECT_FALSE( |
| 874 mainCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 886 scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
| 875 EXPECT_FALSE( | 887 EXPECT_FALSE( |
| 876 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 888 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 877 EXPECT_FALSE( | 889 EXPECT_FALSE( |
| 878 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); | 890 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 879 | 891 |
| 880 EXPECT_TRUE( | 892 EXPECT_TRUE( |
| 881 childCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 893 scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
| 882 EXPECT_FALSE( | 894 EXPECT_FALSE( |
| 883 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 895 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 884 EXPECT_FALSE( | 896 EXPECT_FALSE( |
| 885 childCompositor->containerLayer()->platformLayer()->masksToBounds()); | 897 childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 886 } | 898 } |
| 887 | 899 |
| 888 // Set just the iframe's root scroller. We should stop clipping the | 900 // Set just the iframe's root scroller. We should stop clipping the |
| 889 // iframe's compositor's layers but not the main frame's. | 901 // iframe's compositor's layers but not the main frame's. |
| 890 { | 902 { |
| 891 mainFrame()->document()->setRootScroller(nullptr, nonThrow); | 903 mainFrame()->document()->setRootScroller(nullptr, nonThrow); |
| 892 iframe->contentDocument()->setRootScroller(container, nonThrow); | 904 iframe->contentDocument()->setRootScroller(container, nonThrow); |
| 893 mainFrameView()->updateAllLifecyclePhases(); | 905 mainFrameView()->updateAllLifecyclePhases(); |
| 894 | 906 |
| 895 ASSERT_EQ(mainFrame()->document(), &mainController.effectiveRootScroller()); | 907 ASSERT_EQ(mainFrame()->document(), &mainController.effectiveRootScroller()); |
| 896 ASSERT_EQ(container, &childController.effectiveRootScroller()); | 908 ASSERT_EQ(container, &childController.effectiveRootScroller()); |
| 897 | 909 |
| 898 EXPECT_TRUE( | 910 EXPECT_TRUE( |
| 899 mainCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 911 scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
| 900 EXPECT_FALSE( | 912 EXPECT_FALSE( |
| 901 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 913 mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 902 EXPECT_FALSE( | 914 EXPECT_FALSE( |
| 903 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); | 915 mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 904 | 916 |
| 905 EXPECT_FALSE( | 917 EXPECT_FALSE( |
| 906 childCompositor->rootContentLayer()->platformLayer()->masksToBounds()); | 918 scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
| 907 EXPECT_FALSE( | 919 EXPECT_FALSE( |
| 908 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); | 920 childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
| 909 EXPECT_FALSE( | 921 EXPECT_FALSE( |
| 910 childCompositor->containerLayer()->platformLayer()->masksToBounds()); | 922 childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
| 911 } | 923 } |
| 912 } | 924 } |
| 913 | 925 |
| 914 // Tests that the clipping layer is resized on the root scroller element even | 926 // Tests that the clipping layer is resized on the root scroller element even |
| 915 // if the layout height doesn't change. | 927 // if the layout height doesn't change. |
| 916 TEST_F(RootScrollerTest, BrowserControlsResizeClippingLayer) { | 928 TEST_F(RootScrollerTest, BrowserControlsResizeClippingLayer) { |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 // FrameView without a layout. | 1245 // FrameView without a layout. |
| 1234 iframe->remove(); | 1246 iframe->remove(); |
| 1235 | 1247 |
| 1236 EXPECT_EQ(mainFrameView()->layoutViewportScrollableArea(), | 1248 EXPECT_EQ(mainFrameView()->layoutViewportScrollableArea(), |
| 1237 &mainFrameView()->getRootFrameViewport()->layoutViewport()); | 1249 &mainFrameView()->getRootFrameViewport()->layoutViewport()); |
| 1238 } | 1250 } |
| 1239 | 1251 |
| 1240 } // namespace | 1252 } // namespace |
| 1241 | 1253 |
| 1242 } // namespace blink | 1254 } // namespace blink |
| OLD | NEW |