| 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 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2612 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled()); | 2612 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled()); |
| 2613 EXPECT_FALSE(overflowA->layoutObject() | 2613 EXPECT_FALSE(overflowA->layoutObject() |
| 2614 ->paintProperties() | 2614 ->paintProperties() |
| 2615 ->scroll() | 2615 ->scroll() |
| 2616 ->threadedScrollingDisabled()); | 2616 ->threadedScrollingDisabled()); |
| 2617 | 2617 |
| 2618 document().settings()->setThreadedScrollingEnabled(false); | 2618 document().settings()->setThreadedScrollingEnabled(false); |
| 2619 // TODO(pdr): The main thread scrolling setting should invalidate properties. | 2619 // TODO(pdr): The main thread scrolling setting should invalidate properties. |
| 2620 document().view()->setNeedsPaintPropertyUpdate(); | 2620 document().view()->setNeedsPaintPropertyUpdate(); |
| 2621 overflowA->layoutObject()->setNeedsPaintPropertyUpdate(); | 2621 overflowA->layoutObject()->setNeedsPaintPropertyUpdate(); |
| 2622 overflowA->layoutObject()->setAllAncestorsNeedPaintPropertyUpdate(); |
| 2622 document().view()->updateAllLifecyclePhases(); | 2623 document().view()->updateAllLifecyclePhases(); |
| 2623 | 2624 |
| 2624 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled()); | 2625 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled()); |
| 2625 EXPECT_TRUE(overflowA->layoutObject() | 2626 EXPECT_TRUE(overflowA->layoutObject() |
| 2626 ->paintProperties() | 2627 ->paintProperties() |
| 2627 ->scroll() | 2628 ->scroll() |
| 2628 ->threadedScrollingDisabled()); | 2629 ->threadedScrollingDisabled()); |
| 2629 } | 2630 } |
| 2630 | 2631 |
| 2631 TEST_P(PaintPropertyTreeBuilderTest, | 2632 TEST_P(PaintPropertyTreeBuilderTest, |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 childProperties->localBorderBoxProperties()->propertyTreeState; | 2887 childProperties->localBorderBoxProperties()->propertyTreeState; |
| 2887 EXPECT_EQ(framePreTranslation(), | 2888 EXPECT_EQ(framePreTranslation(), |
| 2888 childProperties->paintOffsetTranslation()->parent()); | 2889 childProperties->paintOffsetTranslation()->parent()); |
| 2889 EXPECT_EQ(childProperties->paintOffsetTranslation(), | 2890 EXPECT_EQ(childProperties->paintOffsetTranslation(), |
| 2890 childPaintState.transform()); | 2891 childPaintState.transform()); |
| 2891 // This will change once we added clip expansion node. | 2892 // This will change once we added clip expansion node. |
| 2892 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); | 2893 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); |
| 2893 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); | 2894 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); |
| 2894 } | 2895 } |
| 2895 | 2896 |
| 2897 TEST_P(PaintPropertyTreeBuilderTest, DescendantNeedsUpdateAcrossFrames) { |
| 2898 setBodyInnerHTML( |
| 2899 "<style>body { margin: 0; }</style>" |
| 2900 "<div id='divWithTransform' style='transform: translate3d(1px,2px,3px);'>" |
| 2901 " <iframe style='border: 7px solid black'></iframe>" |
| 2902 "</div>"); |
| 2903 setChildFrameHTML( |
| 2904 "<style>body { margin: 0; }</style><div id='transform' style='transform: " |
| 2905 "translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>"); |
| 2906 |
| 2907 FrameView* frameView = document().view(); |
| 2908 frameView->updateAllLifecyclePhases(); |
| 2909 |
| 2910 LayoutObject* divWithTransform = |
| 2911 document().getElementById("divWithTransform")->layoutObject(); |
| 2912 LayoutObject* childLayoutView = childDocument().layoutView(); |
| 2913 LayoutObject* innerDivWithTransform = |
| 2914 childDocument().getElementById("transform")->layoutObject(); |
| 2915 |
| 2916 // Initially, no objects should need a descendant update. |
| 2917 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate()); |
| 2918 EXPECT_FALSE(divWithTransform->descendantNeedsPaintPropertyUpdate()); |
| 2919 EXPECT_FALSE(childLayoutView->descendantNeedsPaintPropertyUpdate()); |
| 2920 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate()); |
| 2921 |
| 2922 // Marking the child div as needing a paint property update should propagate |
| 2923 // up the tree and across frames. |
| 2924 innerDivWithTransform->setNeedsPaintPropertyUpdate(); |
| 2925 EXPECT_TRUE(document().layoutView()->descendantNeedsPaintPropertyUpdate()); |
| 2926 EXPECT_TRUE(divWithTransform->descendantNeedsPaintPropertyUpdate()); |
| 2927 EXPECT_TRUE(childLayoutView->descendantNeedsPaintPropertyUpdate()); |
| 2928 EXPECT_TRUE(innerDivWithTransform->needsPaintPropertyUpdate()); |
| 2929 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate()); |
| 2930 |
| 2931 // After a lifecycle update, no nodes should need a descendant update. |
| 2932 frameView->updateAllLifecyclePhases(); |
| 2933 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate()); |
| 2934 EXPECT_FALSE(divWithTransform->descendantNeedsPaintPropertyUpdate()); |
| 2935 EXPECT_FALSE(childLayoutView->descendantNeedsPaintPropertyUpdate()); |
| 2936 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate()); |
| 2937 } |
| 2938 |
| 2896 } // namespace blink | 2939 } // namespace blink |
| OLD | NEW |