Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 2855523002: Deleted Widget/FrameViewBase (Closed)
Patch Set: removed FrameViewBase.h file now that dependent CL submitted Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) {
68 theme_.RegisterScrollbar(*this); 67 theme_.RegisterScrollbar(*this);
69 68
70 // FIXME: This is ugly and would not be necessary if we fix cross-platform 69 // FIXME: This is ugly and would not be necessary if we fix cross-platform
71 // code to actually query for scrollbar thickness and use it when sizing 70 // code to actually query for scrollbar thickness and use it when sizing
72 // scrollbars (rather than leaving one dimension of the scrollbar alone when 71 // scrollbars (rather than leaving one dimension of the scrollbar alone when
73 // sizing). 72 // sizing).
74 int thickness = theme_.ScrollbarThickness(control_size); 73 int thickness = theme_.ScrollbarThickness(control_size);
75 theme_scrollbar_thickness_ = thickness; 74 theme_scrollbar_thickness_ = thickness;
76 if (chrome_client_) 75 if (chrome_client_)
77 thickness = chrome_client_->WindowToViewportScalar(thickness); 76 thickness = chrome_client_->WindowToViewportScalar(thickness);
78 frame_rect_ = IntRect(0, 0, thickness, thickness); 77 frame_rect_ = IntRect(0, 0, thickness, thickness);
79 78
80 current_pos_ = ScrollableAreaCurrentPos(); 79 current_pos_ = ScrollableAreaCurrentPos();
81 } 80 }
82 81
83 Scrollbar::~Scrollbar() { 82 Scrollbar::~Scrollbar() {
84 theme_.UnregisterScrollbar(*this); 83 theme_.UnregisterScrollbar(*this);
85 } 84 }
86 85
87 DEFINE_TRACE(Scrollbar) { 86 DEFINE_TRACE(Scrollbar) {
88 visitor->Trace(scrollable_area_); 87 visitor->Trace(scrollable_area_);
89 visitor->Trace(chrome_client_); 88 visitor->Trace(chrome_client_);
90 visitor->Trace(parent_);
91 } 89 }
92 90
93 void Scrollbar::SetFrameRect(const IntRect& frame_rect) { 91 void Scrollbar::SetFrameRect(const IntRect& frame_rect) {
94 if (frame_rect == frame_rect_) 92 if (frame_rect == frame_rect_)
95 return; 93 return;
96 94
97 frame_rect_ = frame_rect; 95 frame_rect_ = frame_rect;
98 SetNeedsPaintInvalidation(kAllParts); 96 SetNeedsPaintInvalidation(kAllParts);
99 if (scrollable_area_) 97 if (scrollable_area_)
100 scrollable_area_->ScrollbarFrameRectChanged(); 98 scrollable_area_->ScrollbarFrameRectChanged();
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return true; 566 return true;
569 return !scrollable_area_->ScrollbarsHidden(); 567 return !scrollable_area_->ScrollbarsHidden();
570 } 568 }
571 569
572 bool Scrollbar::IsWindowActive() const { 570 bool Scrollbar::IsWindowActive() const {
573 return scrollable_area_ && scrollable_area_->IsActive(); 571 return scrollable_area_ && scrollable_area_->IsActive();
574 } 572 }
575 573
576 IntPoint Scrollbar::ConvertFromRootFrame( 574 IntPoint Scrollbar::ConvertFromRootFrame(
577 const IntPoint& point_in_root_frame) const { 575 const IntPoint& point_in_root_frame) const {
578 if (const FrameViewBase* parent = Parent()) { 576 if (scrollable_area_) {
579 IntPoint parent_point = parent->ConvertFromRootFrame(point_in_root_frame); 577 IntPoint parent_point =
580 if (scrollable_area_) { 578 scrollable_area_->ConvertFromRootFrame(point_in_root_frame);
581 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar( 579 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar(
582 *this, parent_point); 580 *this, parent_point);
583 }
584 } 581 }
585 582
586 return point_in_root_frame; 583 return point_in_root_frame;
587 } 584 }
588 585
589 IntRect Scrollbar::ConvertToContainingFrameViewBase( 586 IntRect Scrollbar::ConvertToContainingFrameViewBase(
590 const IntRect& local_rect) const { 587 const IntRect& local_rect) const {
591 if (scrollable_area_) { 588 if (scrollable_area_) {
592 return scrollable_area_->ConvertFromScrollbarToContainingFrameViewBase( 589 return scrollable_area_->ConvertFromScrollbarToContainingFrameViewBase(
593 *this, local_rect); 590 *this, local_rect);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 invalid_parts = kAllParts; 634 invalid_parts = kAllParts;
638 if (invalid_parts & ~kThumbPart) 635 if (invalid_parts & ~kThumbPart)
639 track_needs_repaint_ = true; 636 track_needs_repaint_ = true;
640 if (invalid_parts & kThumbPart) 637 if (invalid_parts & kThumbPart)
641 thumb_needs_repaint_ = true; 638 thumb_needs_repaint_ = true;
642 if (scrollable_area_) 639 if (scrollable_area_)
643 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); 640 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation());
644 } 641 }
645 642
646 } // namespace blink 643 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698