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/ScrollAnchor.h" | 5 #include "core/layout/ScrollAnchor.h" |
6 | 6 |
7 #include "core/dom/ClientRect.h" | 7 #include "core/dom/ClientRect.h" |
8 #include "core/frame/VisualViewport.h" | 8 #include "core/frame/VisualViewport.h" |
9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
10 #include "core/layout/LayoutTestHelper.h" | 10 #include "core/layout/LayoutTestHelper.h" |
11 #include "core/page/PrintContext.h" | 11 #include "core/page/PrintContext.h" |
12 #include "core/paint/PaintLayerScrollableArea.h" | 12 #include "core/paint/PaintLayerScrollableArea.h" |
13 #include "platform/testing/HistogramTester.h" | 13 #include "platform/testing/HistogramTester.h" |
14 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 14 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 using Corner = ScrollAnchor::Corner; | 18 using Corner = ScrollAnchor::Corner; |
19 | 19 |
20 typedef bool TestParamRootLayerScrolling; | 20 typedef bool TestParamRootLayerScrolling; |
21 class ScrollAnchorTest | 21 class ScrollAnchorTest |
22 : public testing::WithParamInterface<TestParamRootLayerScrolling>, | 22 : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, |
23 private ScopedRootLayerScrollingForTest, | 23 private ScopedRootLayerScrollingForTest, |
24 public RenderingTest { | 24 public RenderingTest { |
25 public: | 25 public: |
26 ScrollAnchorTest() : ScopedRootLayerScrollingForTest(GetParam()) { | 26 ScrollAnchorTest() : ScopedRootLayerScrollingForTest(GetParam()) { |
27 RuntimeEnabledFeatures::SetScrollAnchoringEnabled(true); | 27 RuntimeEnabledFeatures::SetScrollAnchoringEnabled(true); |
28 } | 28 } |
29 ~ScrollAnchorTest() { | 29 ~ScrollAnchorTest() { |
30 RuntimeEnabledFeatures::SetScrollAnchoringEnabled(false); | 30 RuntimeEnabledFeatures::SetScrollAnchoringEnabled(false); |
31 } | 31 } |
32 | 32 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 ScrollLayoutViewport(ScrollOffset(0, 150)); | 446 ScrollLayoutViewport(ScrollOffset(0, 150)); |
447 | 447 |
448 // This will trigger printing and layout. | 448 // This will trigger printing and layout. |
449 PrintContext::NumberOfPages(GetDocument().GetFrame(), FloatSize(500, 500)); | 449 PrintContext::NumberOfPages(GetDocument().GetFrame(), FloatSize(500, 500)); |
450 | 450 |
451 EXPECT_EQ(150, viewport->ScrollOffsetInt().Height()); | 451 EXPECT_EQ(150, viewport->ScrollOffsetInt().Height()); |
452 EXPECT_EQ(nullptr, GetScrollAnchor(viewport).AnchorObject()); | 452 EXPECT_EQ(nullptr, GetScrollAnchor(viewport).AnchorObject()); |
453 } | 453 } |
454 | 454 |
455 } | 455 } |
OLD | NEW |