Commit bfce8511 authored by sahel's avatar sahel Committed by Commit bot

Non-composited scrollbars don't fade out when mouse is over.

BUG=669668
TEST=WebFrameTest.TestNonCompositedOverlayScrollbarsFade

Review-Url: https://codereview.chromium.org/2569053002
Cr-Commit-Position: refs/heads/master@{#438178}
parent afc6f8a4
......@@ -67,7 +67,8 @@ ScrollableArea::ScrollableArea()
m_verticalScrollbarNeedsPaintInvalidation(false),
m_scrollCornerNeedsPaintInvalidation(false),
m_scrollbarsHidden(false),
m_scrollbarCaptured(false) {}
m_scrollbarCaptured(false),
m_mouseOverScrollbar(false) {}
ScrollableArea::~ScrollableArea() {}
......@@ -323,13 +324,20 @@ void ScrollableArea::mouseMovedInContentArea() const {
}
void ScrollableArea::mouseEnteredScrollbar(Scrollbar& scrollbar) {
m_mouseOverScrollbar = true;
scrollAnimator().mouseEnteredScrollbar(scrollbar);
// Restart the fade out timer.
showOverlayScrollbars();
if (m_fadeOverlayScrollbarsTimer)
m_fadeOverlayScrollbarsTimer->stop();
}
void ScrollableArea::mouseExitedScrollbar(Scrollbar& scrollbar) {
m_mouseOverScrollbar = false;
scrollAnimator().mouseExitedScrollbar(scrollbar);
if (!m_scrollbarsHidden) {
// This will kick off the fade out timer.
showOverlayScrollbars();
}
}
void ScrollableArea::mouseCapturedScrollbar() {
......@@ -574,7 +582,7 @@ void ScrollableArea::showOverlayScrollbars() {
this, &ScrollableArea::fadeOverlayScrollbarsTimerFired));
}
if (!m_scrollbarCaptured) {
if (!m_scrollbarCaptured && !m_mouseOverScrollbar) {
m_fadeOverlayScrollbarsTimer->startOneShot(timeUntilDisable,
BLINK_FROM_HERE);
}
......
......@@ -430,6 +430,7 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
unsigned m_scrollCornerNeedsPaintInvalidation : 1;
unsigned m_scrollbarsHidden : 1;
unsigned m_scrollbarCaptured : 1;
unsigned m_mouseOverScrollbar : 1;
// There are 6 possible combinations of writing mode and direction. Scroll
// origin will be non-zero in the x or y axis if there is any reversed
......
......@@ -10982,6 +10982,18 @@ TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) {
testing::runDelayedTasks(kMockOverlayFadeOutDelayMs);
EXPECT_TRUE(scrollableArea->scrollbarsHidden());
// Non-composited scrollbars don't fade out while mouse is over.
EXPECT_TRUE(scrollableArea->verticalScrollbar());
scrollableArea->setScrollOffset(ScrollOffset(20, 20), ProgrammaticScroll,
ScrollBehaviorInstant);
EXPECT_FALSE(scrollableArea->scrollbarsHidden());
scrollableArea->mouseEnteredScrollbar(*scrollableArea->verticalScrollbar());
testing::runDelayedTasks(kMockOverlayFadeOutDelayMs);
EXPECT_FALSE(scrollableArea->scrollbarsHidden());
scrollableArea->mouseExitedScrollbar(*scrollableArea->verticalScrollbar());
testing::runDelayedTasks(kMockOverlayFadeOutDelayMs);
EXPECT_TRUE(scrollableArea->scrollbarsHidden());
mockOverlayTheme.setOverlayScrollbarFadeOutDelay(0.0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment