| 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" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); | 560 "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); |
| 561 document().view()->updateAllLifecyclePhases(); | 561 document().view()->updateAllLifecyclePhases(); |
| 562 Element* scroller = document().getElementById("scroller"); | 562 Element* scroller = document().getElementById("scroller"); |
| 563 ASSERT_TRUE(scroller); | 563 ASSERT_TRUE(scroller); |
| 564 PaintLayerScrollableArea* scrollableArea = | 564 PaintLayerScrollableArea* scrollableArea = |
| 565 toLayoutBoxModelObject(scroller->layoutObject())->getScrollableArea(); | 565 toLayoutBoxModelObject(scroller->layoutObject())->getScrollableArea(); |
| 566 ASSERT_TRUE(scrollableArea); | 566 ASSERT_TRUE(scrollableArea); |
| 567 scrollableArea->setScrollOffset(ScrollOffset(100, 0), ClampingScroll); | 567 scrollableArea->setScrollOffset(ScrollOffset(100, 0), ClampingScroll); |
| 568 EXPECT_EQ(scrollableArea->getScrollOffset().width(), 0); | 568 EXPECT_EQ(scrollableArea->getScrollOffset().width(), 0); |
| 569 } | 569 } |
| 570 |
| 571 TEST_F(PaintLayerScrollableAreaTest, ShowAutoScrollbarsForVisibleContent) { |
| 572 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); |
| 573 setBodyInnerHTML( |
| 574 "<style>" |
| 575 "#outerDiv {" |
| 576 " width: 15px;" |
| 577 " height: 100px;" |
| 578 " overflow-y: auto;" |
| 579 " overflow-x: hidden;" |
| 580 "}" |
| 581 "#innerDiv {" |
| 582 " height:300px;" |
| 583 " width: 1px;" |
| 584 "}" |
| 585 "</style>" |
| 586 "<div id='outerDiv'>" |
| 587 " <div id='innerDiv'></div>" |
| 588 "</div>"); |
| 589 document().view()->updateAllLifecyclePhases(); |
| 590 Element* outerDiv = document().getElementById("outerDiv"); |
| 591 ASSERT_TRUE(outerDiv); |
| 592 outerDiv->layoutObject()->setNeedsLayout("test"); |
| 593 document().view()->updateAllLifecyclePhases(); |
| 594 PaintLayerScrollableArea* scrollableArea = |
| 595 toLayoutBoxModelObject(outerDiv->layoutObject())->getScrollableArea(); |
| 596 ASSERT_TRUE(scrollableArea); |
| 597 EXPECT_TRUE(scrollableArea->hasVerticalScrollbar()); |
| 570 } | 598 } |
| 599 } |
| OLD | NEW |