OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 void ScrollableArea::scrollPositionChanged(const DoublePoint& position, ScrollTy
pe scrollType) | 237 void ScrollableArea::scrollPositionChanged(const DoublePoint& position, ScrollTy
pe scrollType) |
238 { | 238 { |
239 TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged"); | 239 TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged"); |
240 | 240 |
241 DoublePoint oldPosition = scrollPositionDouble(); | 241 DoublePoint oldPosition = scrollPositionDouble(); |
242 DoublePoint truncatedPosition = shouldUseIntegerScrollOffset() ? flooredIntP
oint(position) : position; | 242 DoublePoint truncatedPosition = shouldUseIntegerScrollOffset() ? flooredIntP
oint(position) : position; |
243 | 243 |
244 // Tell the derived class to scroll its contents. | 244 // Tell the derived class to scroll its contents. |
245 setScrollOffset(truncatedPosition, scrollType); | 245 setScrollOffset(truncatedPosition, scrollType); |
246 | 246 |
| 247 Scrollbar* verticalScrollbar = this->verticalScrollbar(); |
| 248 |
247 // Tell the scrollbars to update their thumb postions. | 249 // Tell the scrollbars to update their thumb postions. |
248 // If a scrollbar does not have its own layer, it must always be invalidated | |
249 // to reflect the new thumb position, even if the theme would not otherwise | |
250 // require invalidation of any part. | |
251 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 250 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
252 bool offsetChanged = horizontalScrollbar->offsetDidChange(); | 251 horizontalScrollbar->offsetDidChange(); |
253 if (offsetChanged && !hasLayerForHorizontalScrollbar()) | 252 if (horizontalScrollbar->isOverlayScrollbar() && !hasLayerForHorizontalS
crollbar()) |
254 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); | 253 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); |
255 } | 254 } |
256 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 255 if (verticalScrollbar) { |
257 bool offsetChanged = verticalScrollbar->offsetDidChange(); | 256 verticalScrollbar->offsetDidChange(); |
258 if (offsetChanged && !hasLayerForVerticalScrollbar()) | 257 if (verticalScrollbar->isOverlayScrollbar() && !hasLayerForVerticalScrol
lbar()) |
259 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); | 258 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); |
260 } | 259 } |
261 | 260 |
262 if (scrollPositionDouble() != oldPosition) { | 261 if (scrollPositionDouble() != oldPosition) { |
263 // FIXME: Pass in DoubleSize. crbug.com/414283. | 262 // FIXME: Pass in DoubleSize. crbug.com/414283. |
264 scrollAnimator().notifyContentAreaScrolled(toFloatSize(scrollPositionDou
ble() - oldPosition)); | 263 scrollAnimator().notifyContentAreaScrolled(toFloatSize(scrollPositionDou
ble() - oldPosition)); |
265 } | 264 } |
266 | 265 |
267 scrollAnimator().setCurrentPosition(toFloatPoint(position)); | 266 scrollAnimator().setCurrentPosition(toFloatPoint(position)); |
268 } | 267 } |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 std::max(0, size.height() - horizontalScrollbarHeight)); | 585 std::max(0, size.height() - horizontalScrollbarHeight)); |
587 } | 586 } |
588 | 587 |
589 DEFINE_TRACE(ScrollableArea) | 588 DEFINE_TRACE(ScrollableArea) |
590 { | 589 { |
591 visitor->trace(m_scrollAnimator); | 590 visitor->trace(m_scrollAnimator); |
592 visitor->trace(m_programmaticScrollAnimator); | 591 visitor->trace(m_programmaticScrollAnimator); |
593 } | 592 } |
594 | 593 |
595 } // namespace blink | 594 } // namespace blink |
OLD | NEW |