| Index: third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
|
| index 60e58d7a6f792814e153818b217b46b0f6abb112..9586d14c85969996b3e39b97a83f433529731ea8 100644
|
| --- a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
|
| @@ -8,6 +8,7 @@
|
| #include "core/frame/VisualViewport.h"
|
| #include "core/layout/LayoutBox.h"
|
| #include "core/layout/LayoutTestHelper.h"
|
| +#include "core/page/PrintContext.h"
|
| #include "core/paint/PaintLayerScrollableArea.h"
|
| #include "platform/testing/HistogramTester.h"
|
|
|
| @@ -841,6 +842,24 @@ TEST_F(ScrollAnchorTest, NonDefaultRootScroller) {
|
| EXPECT_EQ(nullptr, scrollAnchor(layoutViewport()).anchorObject());
|
| }
|
|
|
| +// This test verifies that scroll anchoring is disabled when the document is in
|
| +// printing mode.
|
| +TEST_F(ScrollAnchorTest, AnchoringDisabledForPrinting) {
|
| + setBodyInnerHTML(
|
| + "<style> body { height: 1000px } div { height: 100px } </style>"
|
| + "<div id='block1'>abc</div>"
|
| + "<div id='block2'>def</div>");
|
| +
|
| + ScrollableArea* viewport = layoutViewport();
|
| + scrollLayoutViewport(ScrollOffset(0, 150));
|
| +
|
| + // This will trigger printing and layout.
|
| + PrintContext::numberOfPages(document().frame(), FloatSize(500, 500));
|
| +
|
| + EXPECT_EQ(150, viewport->scrollOffsetInt().height());
|
| + EXPECT_EQ(nullptr, scrollAnchor(viewport).anchorObject());
|
| +}
|
| +
|
| class ScrollAnchorCornerTest : public ScrollAnchorTest {
|
| protected:
|
| void checkCorner(Corner corner,
|
|
|