Chromium Code Reviews| Index: third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm |
| diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm |
| index 4e24d784b0aec535484986268dcbf54414ba0bb4..2110b5f145d870bc772899fe066d1132c471a2cb 100644 |
| --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm |
| +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm |
| @@ -433,9 +433,11 @@ private: |
| break; |
| case UIStateTransition: |
| [_scrollbarPainter.get() setUiStateTransitionProgress:currentValue]; |
| + _scrollbar->setThumbNeedsRepaint(true); |
| break; |
| case ExpansionTransition: |
| [_scrollbarPainter.get() setExpansionTransitionProgress:currentValue]; |
| + _scrollbar->setThumbNeedsRepaint(true); |
| break; |
| } |
| @@ -460,6 +462,7 @@ private: |
| RetainPtr<WebScrollbarPartAnimation> _trackAlphaAnimation; |
| RetainPtr<WebScrollbarPartAnimation> _uiStateTransitionAnimation; |
| RetainPtr<WebScrollbarPartAnimation> _expansionTransitionAnimation; |
| + BOOL _hasExpandedSinceInvisible; |
| } |
| - (id)initWithScrollbar:(blink::Scrollbar*)scrollbar; |
| - (void)updateVisibilityImmediately:(bool)show; |
| @@ -642,6 +645,20 @@ private: |
| - (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState |
| { |
| + enum { |
| + NSScrollerStateInvisible = 0, |
|
chrishtr
2015/11/24 21:15:12
Forgive my ignorance of Objective C. When is NSScr
ccameron
2015/11/25 00:23:01
That is a value of the newOverlayScrollerState par
|
| + NSScrollerStateKnob = 1, |
| + NSScrollerStateExpanded = 2 |
| + }; |
| + // We do not receive notifications about the thumb un-expanding when the scrollbar fades away. Ensure |
| + // that we re-paint the thumb the next time that we transition away from being invisible, so that |
| + // the thumb doesn't stick in an expanded state. |
| + if (newOverlayScrollerState == NSScrollerStateExpanded) { |
| + _hasExpandedSinceInvisible = YES; |
| + } else if (newOverlayScrollerState != NSScrollerStateInvisible && _hasExpandedSinceInvisible) { |
| + _scrollbar->setThumbNeedsRepaint(true); |
| + _hasExpandedSinceInvisible = NO; |
| + } |
| } |
| - (void)invalidate |
| @@ -799,10 +816,6 @@ void ScrollAnimatorMac::mouseMovedInContentArea() const |
| void ScrollAnimatorMac::mouseEnteredScrollbar(Scrollbar* scrollbar) const |
| { |
| - // At this time, only legacy scrollbars needs to send notifications here. |
| - if (ScrollbarThemeMacCommon::recommendedScrollerStyle() != NSScrollerStyleLegacy) |
|
chrishtr
2015/11/24 21:15:12
What do the changes here and on line 819 do?
ccameron
2015/11/25 00:23:02
I set the wrong upstream branch -- this is part of
|
| - return; |
| - |
| if (!scrollableArea()->scrollbarsCanBeActive()) |
| return; |
| @@ -816,10 +829,6 @@ void ScrollAnimatorMac::mouseEnteredScrollbar(Scrollbar* scrollbar) const |
| void ScrollAnimatorMac::mouseExitedScrollbar(Scrollbar* scrollbar) const |
| { |
| - // At this time, only legacy scrollbars needs to send notifications here. |
| - if (ScrollbarThemeMacCommon::recommendedScrollerStyle() != NSScrollerStyleLegacy) |
| - return; |
| - |
| if (!scrollableArea()->scrollbarsCanBeActive()) |
| return; |
| @@ -1077,6 +1086,8 @@ void ScrollAnimatorMac::updateScrollerStyle() |
| NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle]; |
| if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) { |
| + verticalScrollbar->setTrackBackgroundNeedsRepaint(true); |
| + verticalScrollbar->setThumbNeedsRepaint(true); |
| verticalScrollbar->setNeedsPaintInvalidation(); |
| ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController.get() verticalScrollerImp]; |
| @@ -1095,6 +1106,8 @@ void ScrollAnimatorMac::updateScrollerStyle() |
| } |
| if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar()) { |
| + horizontalScrollbar->setTrackBackgroundNeedsRepaint(true); |
| + horizontalScrollbar->setThumbNeedsRepaint(true); |
| horizontalScrollbar->setNeedsPaintInvalidation(); |
| ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController.get() horizontalScrollerImp]; |