Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2388723004: [SPInvalidation] Fix PrePaintTreeWalk for multicol spanner (Closed)
Patch Set: Positioned descendants of spanner; Unit test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return frameView->contentClip(); 64 return frameView->contentClip();
65 } 65 }
66 66
67 const ScrollPaintPropertyNode* frameScroll() { 67 const ScrollPaintPropertyNode* frameScroll() {
68 FrameView* frameView = document().view(); 68 FrameView* frameView = document().view();
69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
70 return frameView->layoutView()->objectPaintProperties()->scroll(); 70 return frameView->layoutView()->objectPaintProperties()->scroll();
71 return frameView->scroll(); 71 return frameView->scroll();
72 } 72 }
73 73
74 LayoutPoint paintOffset(const LayoutObject* object) {
75 return object->objectPaintProperties()
76 ->localBorderBoxProperties()
77 ->paintOffset;
78 }
79
74 private: 80 private:
75 void SetUp() override { 81 void SetUp() override {
76 Settings::setMockScrollbarsEnabled(true); 82 Settings::setMockScrollbarsEnabled(true);
77 83
78 RenderingTest::SetUp(); 84 RenderingTest::SetUp();
79 enableCompositing(); 85 enableCompositing();
80 } 86 }
81 87
82 void TearDown() override { 88 void TearDown() override {
83 RenderingTest::TearDown(); 89 RenderingTest::TearDown();
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); 2738 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects));
2733 EXPECT_FALSE( 2739 EXPECT_FALSE(
2734 overflowB->layoutObject() 2740 overflowB->layoutObject()
2735 ->objectPaintProperties() 2741 ->objectPaintProperties()
2736 ->scroll() 2742 ->scroll()
2737 ->parent() 2743 ->parent()
2738 ->hasMainThreadScrollingReasons( 2744 ->hasMainThreadScrollingReasons(
2739 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects)); 2745 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects));
2740 } 2746 }
2741 2747
2748 TEST_P(PaintPropertyTreeBuilderTest, PaintOffsetUnderMultiColumn) {
chrishtr 2016/10/05 00:48:17 @mstensho could you please review this test and ve
2749 setBodyInnerHTML(
2750 "<style>"
2751 " body { margin: 0; }"
2752 " .space { height: 30px; }"
2753 " .abs { position: absolute; width: 20px; height: 20px; }"
2754 "</style>"
2755 "<div style='columns:2; width: 200px; column-gap: 0'>"
2756 " <div style='position: relative'>"
2757 " <div id=space1 class=space></div>"
2758 " <div id=space2 class=space></div>"
2759 " <div id=spanner style='column-span: all'>"
2760 " <div id=normal style='height: 50px'>"
mstensho (USE GERRIT) 2016/10/05 08:44:09 Missing </div> ?
Xianzhu 2016/10/05 17:29:40 Done.
2761 " <div id=top-left class=abs style='top: 0; left: 0'></div>"
2762 " <div id=bottom-right class=abs style='bottom: 0; right: 0'></div>"
2763 " </div>"
2764 " <div id=space3 class=space></div>"
mstensho (USE GERRIT) 2016/10/05 08:44:09 I don't think you intended for this to be inside t
Xianzhu 2016/10/05 17:29:40 Right.
2765 " <div id=space4 class=space></div>"
2766 " </div>"
2767 "</div>");
2768
2769 // Above the spanner.
2770 // Column 1.
2771 EXPECT_EQ(LayoutPoint(), paintOffset(getLayoutObjectByElementId("space1")));
2772 // Column 2. TODO(crbug.com/648274): This is incorrect. Should be (50, 0).
mstensho (USE GERRIT) 2016/10/05 08:44:09 What should it be relative to? LayoutPoint(0, 30)
Xianzhu 2016/10/05 17:29:40 Changed the comment to (100, 0). Made the mistake
2773 EXPECT_EQ(LayoutPoint(0, 30),
2774 paintOffset(getLayoutObjectByElementId("space2")));
2775
2776 // The spanner's normal flow.
2777 EXPECT_EQ(LayoutPoint(0, 30),
2778 paintOffset(getLayoutObjectByElementId("spanner")));
2779 EXPECT_EQ(LayoutPoint(0, 30),
2780 paintOffset(getLayoutObjectByElementId("normal")));
2781
2782 // Below the spanner.
2783 // Column 1.
2784 EXPECT_EQ(LayoutPoint(0, 80),
2785 paintOffset(getLayoutObjectByElementId("space3")));
2786 // Column 2. TODO(crbug.com/648274): This is incorrect. Should be (50, 80).
mstensho (USE GERRIT) 2016/10/05 08:44:09 (100, 80), perhaps?
Xianzhu 2016/10/05 17:29:40 Done.
2787 EXPECT_EQ(LayoutPoint(0, 110),
2788 paintOffset(getLayoutObjectByElementId("space4")));
2789
2790 // Out-of-flow positioned descendants of the spanner. They are laid out in
2791 // the relative-position container.
2792 // This should be aligned to the top-left corner of space1.
2793 EXPECT_EQ(LayoutPoint(0, 30),
mstensho (USE GERRIT) 2016/10/05 08:44:09 Shouldn't this be (0,0) then?
2794 paintOffset(getLayoutObjectByElementId("top-left")));
2795
2796 // This should be aligned to the bottom-right corner of space4.
2797 // TODO(crbug.com/648274): This is incorrect. Should be (80, 90).
mstensho (USE GERRIT) 2016/10/05 08:44:09 Probably (180, 90) then.
Xianzhu 2016/10/05 17:29:40 Done.
2798 EXPECT_EQ(LayoutPoint(80, 40),
2799 paintOffset(getLayoutObjectByElementId("bottom-right")));
2800 }
2801
2742 } // namespace blink 2802 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698