| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 pressed_pos_(0), | 56 pressed_pos_(0), |
| 57 scroll_pos_(0), | 57 scroll_pos_(0), |
| 58 dragging_document_(false), | 58 dragging_document_(false), |
| 59 document_drag_pos_(0), | 59 document_drag_pos_(0), |
| 60 enabled_(true), | 60 enabled_(true), |
| 61 scroll_timer_(scrollable_area->GetTimerTaskRunner(), | 61 scroll_timer_(scrollable_area->GetTimerTaskRunner(), |
| 62 this, | 62 this, |
| 63 &Scrollbar::AutoscrollTimerFired), | 63 &Scrollbar::AutoscrollTimerFired), |
| 64 elastic_overscroll_(0), | 64 elastic_overscroll_(0), |
| 65 track_needs_repaint_(true), | 65 track_needs_repaint_(true), |
| 66 thumb_needs_repaint_(true) { | 66 thumb_needs_repaint_(true), |
| 67 parent_(nullptr) { |
| 67 theme_.RegisterScrollbar(*this); | 68 theme_.RegisterScrollbar(*this); |
| 68 | 69 |
| 69 // FIXME: This is ugly and would not be necessary if we fix cross-platform | 70 // FIXME: This is ugly and would not be necessary if we fix cross-platform |
| 70 // code to actually query for scrollbar thickness and use it when sizing | 71 // code to actually query for scrollbar thickness and use it when sizing |
| 71 // scrollbars (rather than leaving one dimension of the scrollbar alone when | 72 // scrollbars (rather than leaving one dimension of the scrollbar alone when |
| 72 // sizing). | 73 // sizing). |
| 73 int thickness = theme_.ScrollbarThickness(control_size); | 74 int thickness = theme_.ScrollbarThickness(control_size); |
| 74 theme_scrollbar_thickness_ = thickness; | 75 theme_scrollbar_thickness_ = thickness; |
| 75 if (chrome_client_) | 76 if (chrome_client_) |
| 76 thickness = chrome_client_->WindowToViewportScalar(thickness); | 77 thickness = chrome_client_->WindowToViewportScalar(thickness); |
| 77 FrameViewBase::SetFrameRect(IntRect(0, 0, thickness, thickness)); | 78 frame_rect_ = IntRect(0, 0, thickness, thickness); |
| 78 | 79 |
| 79 current_pos_ = ScrollableAreaCurrentPos(); | 80 current_pos_ = ScrollableAreaCurrentPos(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 Scrollbar::~Scrollbar() { | 83 Scrollbar::~Scrollbar() { |
| 83 theme_.UnregisterScrollbar(*this); | 84 theme_.UnregisterScrollbar(*this); |
| 84 } | 85 } |
| 85 | 86 |
| 86 DEFINE_TRACE(Scrollbar) { | 87 DEFINE_TRACE(Scrollbar) { |
| 87 visitor->Trace(scrollable_area_); | 88 visitor->Trace(scrollable_area_); |
| 88 visitor->Trace(chrome_client_); | 89 visitor->Trace(chrome_client_); |
| 89 FrameViewBase::Trace(visitor); | 90 visitor->Trace(parent_); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void Scrollbar::SetFrameRect(const IntRect& frame_rect) { | 93 void Scrollbar::SetFrameRect(const IntRect& frame_rect) { |
| 93 if (frame_rect == this->FrameRect()) | 94 if (frame_rect == frame_rect_) |
| 94 return; | 95 return; |
| 95 | 96 |
| 96 FrameViewBase::SetFrameRect(frame_rect); | 97 frame_rect_ = frame_rect; |
| 97 SetNeedsPaintInvalidation(kAllParts); | 98 SetNeedsPaintInvalidation(kAllParts); |
| 98 if (scrollable_area_) | 99 if (scrollable_area_) |
| 99 scrollable_area_->ScrollbarFrameRectChanged(); | 100 scrollable_area_->ScrollbarFrameRectChanged(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 ScrollbarOverlayColorTheme Scrollbar::GetScrollbarOverlayColorTheme() const { | 103 ScrollbarOverlayColorTheme Scrollbar::GetScrollbarOverlayColorTheme() const { |
| 103 return scrollable_area_ ? scrollable_area_->GetScrollbarOverlayColorTheme() | 104 return scrollable_area_ ? scrollable_area_->GetScrollbarOverlayColorTheme() |
| 104 : kScrollbarOverlayColorThemeDark; | 105 : kScrollbarOverlayColorThemeDark; |
| 105 } | 106 } |
| 106 | 107 |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 invalid_parts = kAllParts; | 640 invalid_parts = kAllParts; |
| 640 if (invalid_parts & ~kThumbPart) | 641 if (invalid_parts & ~kThumbPart) |
| 641 track_needs_repaint_ = true; | 642 track_needs_repaint_ = true; |
| 642 if (invalid_parts & kThumbPart) | 643 if (invalid_parts & kThumbPart) |
| 643 thumb_needs_repaint_ = true; | 644 thumb_needs_repaint_ = true; |
| 644 if (scrollable_area_) | 645 if (scrollable_area_) |
| 645 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); | 646 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); |
| 646 } | 647 } |
| 647 | 648 |
| 648 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |