OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 void Scrollbar::offsetDidChange() | 134 void Scrollbar::offsetDidChange() |
135 { | 135 { |
136 ASSERT(m_scrollableArea); | 136 ASSERT(m_scrollableArea); |
137 | 137 |
138 float position = scrollableAreaCurrentPos(); | 138 float position = scrollableAreaCurrentPos(); |
139 if (position == m_currentPos) | 139 if (position == m_currentPos) |
140 return; | 140 return; |
141 | 141 |
| 142 float oldPosition = m_currentPos; |
142 int oldThumbPosition = theme().thumbPosition(*this); | 143 int oldThumbPosition = theme().thumbPosition(*this); |
143 m_currentPos = position; | 144 m_currentPos = position; |
144 // TODO(jbroman): The theme should provide the parts to invalidate. | 145 |
145 // At the moment, the only theme that doesn't invalidate everything is Mac, | 146 ScrollbarPart invalidParts = theme().invalidateOnThumbPositionChange( |
146 // which invalidates this as needed in ScrollAnimatorMac. | 147 *this, oldPosition, position); |
147 setNeedsPaintInvalidation(NoPart); | 148 setNeedsPaintInvalidation(invalidParts); |
| 149 |
148 if (m_pressedPart == ThumbPart) | 150 if (m_pressedPart == ThumbPart) |
149 setPressedPos(m_pressedPos + theme().thumbPosition(*this) - oldThumbPosi
tion); | 151 setPressedPos(m_pressedPos + theme().thumbPosition(*this) - oldThumbPosi
tion); |
150 } | 152 } |
151 | 153 |
152 void Scrollbar::disconnectFromScrollableArea() | 154 void Scrollbar::disconnectFromScrollableArea() |
153 { | 155 { |
154 m_scrollableArea = nullptr; | 156 m_scrollableArea = nullptr; |
155 } | 157 } |
156 | 158 |
157 void Scrollbar::setProportion(int visibleSize, int totalSize) | 159 void Scrollbar::setProportion(int visibleSize, int totalSize) |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 invalidParts = AllParts; | 568 invalidParts = AllParts; |
567 if (invalidParts & ~ThumbPart) | 569 if (invalidParts & ~ThumbPart) |
568 m_trackNeedsRepaint = true; | 570 m_trackNeedsRepaint = true; |
569 if (invalidParts & ThumbPart) | 571 if (invalidParts & ThumbPart) |
570 m_thumbNeedsRepaint = true; | 572 m_thumbNeedsRepaint = true; |
571 if (m_scrollableArea) | 573 if (m_scrollableArea) |
572 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); | 574 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); |
573 } | 575 } |
574 | 576 |
575 } // namespace blink | 577 } // namespace blink |
OLD | NEW |