| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 void Scrollbar::moveThumb(int pos, bool draggingDocument) { | 246 void Scrollbar::moveThumb(int pos, bool draggingDocument) { |
| 247 if (!m_scrollableArea) | 247 if (!m_scrollableArea) |
| 248 return; | 248 return; |
| 249 | 249 |
| 250 int delta = pos - m_pressedPos; | 250 int delta = pos - m_pressedPos; |
| 251 | 251 |
| 252 if (draggingDocument) { | 252 if (draggingDocument) { |
| 253 if (m_draggingDocument) | 253 if (m_draggingDocument) |
| 254 delta = pos - m_documentDragPos; | 254 delta = pos - m_documentDragPos; |
| 255 m_draggingDocument = true; | 255 m_draggingDocument = true; |
| 256 ScrollOffset currentPosition = m_scrollableArea->scrollOffset(); | 256 ScrollOffset currentPosition = |
| 257 m_scrollableArea->scrollAnimator().currentOffset(); |
| 257 float destinationPosition = | 258 float destinationPosition = |
| 258 (m_orientation == HorizontalScrollbar ? currentPosition.width() | 259 (m_orientation == HorizontalScrollbar ? currentPosition.width() |
| 259 : currentPosition.height()) + | 260 : currentPosition.height()) + |
| 260 delta; | 261 delta; |
| 261 destinationPosition = | 262 destinationPosition = |
| 262 m_scrollableArea->clampScrollOffset(m_orientation, destinationPosition); | 263 m_scrollableArea->clampScrollOffset(m_orientation, destinationPosition); |
| 263 m_scrollableArea->setScrollOffsetSingleAxis( | 264 m_scrollableArea->setScrollOffsetSingleAxis( |
| 264 m_orientation, destinationPosition, UserScroll); | 265 m_orientation, destinationPosition, UserScroll); |
| 265 m_documentDragPos = pos; | 266 m_documentDragPos = pos; |
| 266 return; | 267 return; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 598 |
| 598 return m_scrollableArea->scrollOffset().height() - | 599 return m_scrollableArea->scrollOffset().height() - |
| 599 m_scrollableArea->minimumScrollOffset().height(); | 600 m_scrollableArea->minimumScrollOffset().height(); |
| 600 } | 601 } |
| 601 | 602 |
| 602 float Scrollbar::scrollableAreaTargetPos() const { | 603 float Scrollbar::scrollableAreaTargetPos() const { |
| 603 if (!m_scrollableArea) | 604 if (!m_scrollableArea) |
| 604 return 0; | 605 return 0; |
| 605 | 606 |
| 606 if (m_orientation == HorizontalScrollbar) { | 607 if (m_orientation == HorizontalScrollbar) { |
| 607 return m_scrollableArea->scrollAnimatorDesiredTargetOffset().width() - | 608 return m_scrollableArea->scrollAnimator().desiredTargetOffset().width() - |
| 608 m_scrollableArea->minimumScrollOffset().width(); | 609 m_scrollableArea->minimumScrollOffset().width(); |
| 609 } | 610 } |
| 610 | 611 |
| 611 return m_scrollableArea->scrollAnimatorDesiredTargetOffset().height() - | 612 return m_scrollableArea->scrollAnimator().desiredTargetOffset().height() - |
| 612 m_scrollableArea->minimumScrollOffset().height(); | 613 m_scrollableArea->minimumScrollOffset().height(); |
| 613 } | 614 } |
| 614 | 615 |
| 615 LayoutRect Scrollbar::visualRect() const { | 616 LayoutRect Scrollbar::visualRect() const { |
| 616 return m_scrollableArea ? m_scrollableArea->visualRectForScrollbarParts() | 617 return m_scrollableArea ? m_scrollableArea->visualRectForScrollbarParts() |
| 617 : LayoutRect(); | 618 : LayoutRect(); |
| 618 } | 619 } |
| 619 | 620 |
| 620 void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts) { | 621 void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts) { |
| 621 if (m_theme.shouldRepaintAllPartsOnInvalidation()) | 622 if (m_theme.shouldRepaintAllPartsOnInvalidation()) |
| 622 invalidParts = AllParts; | 623 invalidParts = AllParts; |
| 623 if (invalidParts & ~ThumbPart) | 624 if (invalidParts & ~ThumbPart) |
| 624 m_trackNeedsRepaint = true; | 625 m_trackNeedsRepaint = true; |
| 625 if (invalidParts & ThumbPart) | 626 if (invalidParts & ThumbPart) |
| 626 m_thumbNeedsRepaint = true; | 627 m_thumbNeedsRepaint = true; |
| 627 if (m_scrollableArea) | 628 if (m_scrollableArea) |
| 628 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); | 629 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); |
| 629 } | 630 } |
| 630 | 631 |
| 631 } // namespace blink | 632 } // namespace blink |
| OLD | NEW |