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

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

Issue 2388723004: [SPInvalidation] Fix PrePaintTreeWalk for multicol spanner (Closed)
Patch Set: fixes 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, PaintOffsetsUnderMultiColumn) {
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'></div>"
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>"
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 (100, 0).
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. TODO(crbug.com/648274): This is incorrect. Should be (0, 80).
2784 EXPECT_EQ(LayoutPoint(0, 60),
2785 paintOffset(getLayoutObjectByElementId("space3")));
2786 // Column 2. TODO(crbug.com/648274): This is incorrect. Should be (100, 80).
2787 EXPECT_EQ(LayoutPoint(0, 90),
mstensho (USE GERRIT) 2016/10/05 18:17:54 Yeah.. looks like you're getting these values in t
Xianzhu 2016/10/05 19:40:54 Yes. We need to fix bug 648274 by mapping the pain
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
2793 // "top-left" should be aligned to the top-left corner of space1.
2794 EXPECT_EQ(LayoutPoint(0, 0),
2795 paintOffset(getLayoutObjectByElementId("top-left")));
2796
2797 // "bottom-right" should be aligned to the bottom-right corner of space4.
2798 // TODO(crbug.com/648274): This is incorrect. Should be (180, 90).
2799 EXPECT_EQ(LayoutPoint(80, 100),
2800 paintOffset(getLayoutObjectByElementId("bottom-right")));
2801 }
2802
2803 // Ensures no crash with multi-column containing relative-position inline with
2804 // spanner with absolute-position children.
2805 TEST_P(PaintPropertyTreeBuilderTest,
2806 MultiColumnInlineRelativeAndSpannerAndAbsPos) {
2807 setBodyInnerHTML(
2808 "<div style='columns:2; width: 200px; column-gap: 0'>"
2809 " <span style='position: relative'>"
2810 " <span id=spanner style='column-span: all'>"
2811 " <div id=absolute style='position: absolute'>absolute</div>"
2812 " </span>"
2813 " </span>"
2814 "</div>");
2815 // The "spanner" isn't a real spanner because it's an inline.
2816 EXPECT_FALSE(getLayoutObjectByElementId("spanner")->isColumnSpanAll());
2817
2818 setBodyInnerHTML(
2819 "<div style='columns:2; width: 200px; column-gap: 0'>"
2820 " <span style='position: relative'>"
2821 " <div id=spanner style='column-span: all'>"
2822 " <div id=absolute style='position: absolute'>absolute</div>"
2823 " </div>"
2824 " </span>"
2825 "</div>");
2826 // There should be anonymous block created containing the inline "relative",
2827 // serving as the container of "absolute".
2828 EXPECT_TRUE(
2829 getLayoutObjectByElementId("absolute")->container()->isLayoutBlock());
2830 }
2742 } // namespace blink 2831 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698