| Index: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
|
| diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
|
| index f2071b4c20f820a770b309b88c196575c088ba4e..48942f4e4305682e757159c6d0d40677c4fdd819 100644
|
| --- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
|
| +++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
|
| @@ -181,11 +181,11 @@ void Scrollbar::autoscrollTimerFired(Timer<Scrollbar>*)
|
| autoscrollPressedPart(theme().autoscrollTimerDelay());
|
| }
|
|
|
| -static bool thumbUnderMouse(Scrollbar& scrollbar)
|
| +bool Scrollbar::thumbWillBeUnderMouse() const
|
| {
|
| - int thumbPos = scrollbar.theme().trackPosition(scrollbar) + scrollbar.theme().thumbPosition(scrollbar);
|
| - int thumbLength = scrollbar.theme().thumbLength(scrollbar);
|
| - return scrollbar.pressedPos() >= thumbPos && scrollbar.pressedPos() < thumbPos + thumbLength;
|
| + int thumbPos = theme().trackPosition(*this) + theme().thumbPosition(*this, scrollableAreaTargetPos());
|
| + int thumbLength = theme().thumbLength(*this);
|
| + return pressedPos() >= thumbPos && pressedPos() < thumbPos + thumbLength;
|
| }
|
|
|
| void Scrollbar::autoscrollPressedPart(double delay)
|
| @@ -195,7 +195,7 @@ void Scrollbar::autoscrollPressedPart(double delay)
|
| return;
|
|
|
| // Handle the track.
|
| - if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(*this)) {
|
| + if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbWillBeUnderMouse()) {
|
| setHoveredPart(ThumbPart);
|
| return;
|
| }
|
| @@ -213,7 +213,7 @@ void Scrollbar::startTimerIfNeeded(double delay)
|
|
|
| // Handle the track. We halt track scrolling once the thumb is level
|
| // with us.
|
| - if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(*this)) {
|
| + if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbWillBeUnderMouse()) {
|
| setHoveredPart(ThumbPart);
|
| return;
|
| }
|
| @@ -562,6 +562,17 @@ float Scrollbar::scrollableAreaCurrentPos() const
|
| return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScrollPosition().y();
|
| }
|
|
|
| +float Scrollbar::scrollableAreaTargetPos() const
|
| +{
|
| + if (!m_scrollableArea)
|
| + return 0;
|
| +
|
| + if (m_orientation == HorizontalScrollbar)
|
| + return m_scrollableArea->scrollAnimator().desiredTargetPosition().x() - m_scrollableArea->minimumScrollPosition().x();
|
| +
|
| + return m_scrollableArea->scrollAnimator().desiredTargetPosition().y() - m_scrollableArea->minimumScrollPosition().y();
|
| +}
|
| +
|
| void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts)
|
| {
|
| if (m_theme.shouldRepaintAllPartsOnInvalidation())
|
|
|