| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/paint/PaintLayerScrollableArea.h" | 5 #include "core/paint/PaintLayerScrollableArea.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
| 11 #include "platform/graphics/GraphicsLayer.h" | 11 #include "platform/graphics/GraphicsLayer.h" |
| 12 #include "platform/scroll/ScrollTypes.h" | 12 #include "platform/scroll/ScrollTypes.h" |
| 13 #include "platform/scroll/ScrollbarTheme.h" | |
| 14 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 16 | 15 |
| 17 using testing::_; | 16 using testing::_; |
| 18 | 17 |
| 19 namespace blink { | 18 namespace blink { |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 class MockChromeClient : public EmptyChromeClient { | 21 class MockChromeClient : public EmptyChromeClient { |
| 23 public: | 22 public: |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 EXPECT_CALL(chromeClient(), mockSetToolTip(document().frame(), String(), _)) | 541 EXPECT_CALL(chromeClient(), mockSetToolTip(document().frame(), String(), _)) |
| 543 .Times(1); | 542 .Times(1); |
| 544 scrollableArea->setScrollOffset(ScrollOffset(1, 1), UserScroll); | 543 scrollableArea->setScrollOffset(ScrollOffset(1, 1), UserScroll); |
| 545 | 544 |
| 546 // Programmatic scrolling should not dismiss the tooltip, so setToolTip | 545 // Programmatic scrolling should not dismiss the tooltip, so setToolTip |
| 547 // should not be called for this invocation. | 546 // should not be called for this invocation. |
| 548 EXPECT_CALL(chromeClient(), mockSetToolTip(document().frame(), String(), _)) | 547 EXPECT_CALL(chromeClient(), mockSetToolTip(document().frame(), String(), _)) |
| 549 .Times(0); | 548 .Times(0); |
| 550 scrollableArea->setScrollOffset(ScrollOffset(2, 2), ProgrammaticScroll); | 549 scrollableArea->setScrollOffset(ScrollOffset(2, 2), ProgrammaticScroll); |
| 551 } | 550 } |
| 552 | |
| 553 TEST_F(PaintLayerScrollableAreaTest, IncludeOverlayScrollbarsInVisibleWidth) { | |
| 554 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); | |
| 555 setBodyInnerHTML( | |
| 556 "<style>" | |
| 557 "#scroller { overflow: overlay; height: 100px; width: 100px; }" | |
| 558 "#scrolled { width: 100px; height: 200px; }" | |
| 559 "</style>" | |
| 560 "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); | |
| 561 document().view()->updateAllLifecyclePhases(); | |
| 562 Element* scroller = document().getElementById("scroller"); | |
| 563 ASSERT_TRUE(scroller); | |
| 564 PaintLayerScrollableArea* scrollableArea = | |
| 565 toLayoutBoxModelObject(scroller->layoutObject())->getScrollableArea(); | |
| 566 ASSERT_TRUE(scrollableArea); | |
| 567 scrollableArea->setScrollOffset(ScrollOffset(100, 0), ClampingScroll); | |
| 568 EXPECT_EQ(scrollableArea->getScrollOffset().width(), 0); | |
| 569 } | 551 } |
| 570 } | |
| OLD | NEW |