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 | |
249 // Tell the scrollbars to update their thumb postions. | 247 // 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. |
250 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 251 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
251 horizontalScrollbar->offsetDidChange(); | 252 bool offsetChanged = horizontalScrollbar->offsetDidChange(); |
252 if (horizontalScrollbar->isOverlayScrollbar() && !hasLayerForHorizontalS
crollbar()) | 253 if (offsetChanged && !hasLayerForHorizontalScrollbar()) |
253 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); | 254 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); |
254 } | 255 } |
255 if (verticalScrollbar) { | 256 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
256 verticalScrollbar->offsetDidChange(); | 257 bool offsetChanged = verticalScrollbar->offsetDidChange(); |
257 if (verticalScrollbar->isOverlayScrollbar() && !hasLayerForVerticalScrol
lbar()) | 258 if (offsetChanged && !hasLayerForVerticalScrollbar()) |
258 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); | 259 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); |
259 } | 260 } |
260 | 261 |
261 if (scrollPositionDouble() != oldPosition) { | 262 if (scrollPositionDouble() != oldPosition) { |
262 // FIXME: Pass in DoubleSize. crbug.com/414283. | 263 // FIXME: Pass in DoubleSize. crbug.com/414283. |
263 scrollAnimator().notifyContentAreaScrolled(toFloatSize(scrollPositionDou
ble() - oldPosition)); | 264 scrollAnimator().notifyContentAreaScrolled(toFloatSize(scrollPositionDou
ble() - oldPosition)); |
264 } | 265 } |
265 | 266 |
266 scrollAnimator().setCurrentPosition(toFloatPoint(position)); | 267 scrollAnimator().setCurrentPosition(toFloatPoint(position)); |
267 } | 268 } |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 std::max(0, size.height() - horizontalScrollbarHeight)); | 586 std::max(0, size.height() - horizontalScrollbarHeight)); |
586 } | 587 } |
587 | 588 |
588 DEFINE_TRACE(ScrollableArea) | 589 DEFINE_TRACE(ScrollableArea) |
589 { | 590 { |
590 visitor->trace(m_scrollAnimator); | 591 visitor->trace(m_scrollAnimator); |
591 visitor->trace(m_programmaticScrollAnimator); | 592 visitor->trace(m_programmaticScrollAnimator); |
592 } | 593 } |
593 | 594 |
594 } // namespace blink | 595 } // namespace blink |
OLD | NEW |