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

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

Issue 2759213002: Add auto scrollbars if content would be visible without them. (Closed)
Patch Set: test Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698