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 30ed5ed59630a4863d5f2201f1bfb097c143656d..892dd15283139501cc7c770b4e297263b50b3658 100644 |
| --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm |
| +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm |
| @@ -430,12 +430,16 @@ private: |
| break; |
| case TrackAlpha: |
| [_scrollbarPainter.get() setTrackAlpha:currentValue]; |
| + _scrollbar->setTrackNeedsRepaint(true); |
| break; |
| case UIStateTransition: |
| [_scrollbarPainter.get() setUiStateTransitionProgress:currentValue]; |
| + _scrollbar->setThumbNeedsRepaint(true); |
| + _scrollbar->setTrackNeedsRepaint(true); |
| break; |
| case ExpansionTransition: |
| [_scrollbarPainter.get() setExpansionTransitionProgress:currentValue]; |
| + _scrollbar->setThumbNeedsRepaint(true); |
| break; |
| } |
| @@ -460,6 +464,7 @@ private: |
| RetainPtr<WebScrollbarPartAnimation> _trackAlphaAnimation; |
| RetainPtr<WebScrollbarPartAnimation> _uiStateTransitionAnimation; |
| RetainPtr<WebScrollbarPartAnimation> _expansionTransitionAnimation; |
| + BOOL _hasExpandedSinceInvisible; |
| } |
| - (id)initWithScrollbar:(blink::Scrollbar*)scrollbar; |
| - (void)updateVisibilityImmediately:(bool)show; |
| @@ -642,6 +647,20 @@ private: |
| - (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState |
| { |
| + enum { |
|
chrishtr
2015/11/25 00:28:49
Please document that these are reverse-engineered.
ccameron
2015/11/25 00:34:32
Done.
|
| + NSScrollerStateInvisible = 0, |
| + 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 |
| @@ -1069,6 +1088,8 @@ void ScrollAnimatorMac::updateScrollerStyle() |
| NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle]; |
| if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) { |
| + verticalScrollbar->setTrackNeedsRepaint(true); |
| + verticalScrollbar->setThumbNeedsRepaint(true); |
| verticalScrollbar->setNeedsPaintInvalidation(); |
| ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController.get() verticalScrollerImp]; |
| @@ -1087,6 +1108,8 @@ void ScrollAnimatorMac::updateScrollerStyle() |
| } |
| if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar()) { |
| + horizontalScrollbar->setTrackNeedsRepaint(true); |
| + horizontalScrollbar->setThumbNeedsRepaint(true); |
| horizontalScrollbar->setNeedsPaintInvalidation(); |
| ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController.get() horizontalScrollerImp]; |