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

Side by Side Diff: ui/views/controls/scroll_view.cc

Issue 2229943003: Reusing Ok/Cancel buttons for intent picker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Getting rid of GetDefaultDialogButton() Created 4 years, 2 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/scroll_view.h" 5 #include "ui/views/controls/scroll_view.h"
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Don't add the scrollbars as children until we discover we need them 175 // Don't add the scrollbars as children until we discover we need them
176 // (ShowOrHideScrollBar). 176 // (ShowOrHideScrollBar).
177 horiz_sb_->SetVisible(false); 177 horiz_sb_->SetVisible(false);
178 horiz_sb_->set_controller(this); 178 horiz_sb_->set_controller(this);
179 vert_sb_->SetVisible(false); 179 vert_sb_->SetVisible(false);
180 vert_sb_->set_controller(this); 180 vert_sb_->set_controller(this);
181 corner_view_->SetVisible(false); 181 corner_view_->SetVisible(false);
182 182
183 if (!base::FeatureList::IsEnabled(kToolkitViewsScrollWithLayers)) 183 if (!base::FeatureList::IsEnabled(kToolkitViewsScrollWithLayers))
184 return; 184 return;
185 185 EnableViewPortLayer();
186 background_color_ = SK_ColorWHITE;
187 contents_viewport_->set_background(
188 Background::CreateSolidBackground(background_color_));
189 contents_viewport_->SetPaintToLayer(true);
190 contents_viewport_->layer()->SetMasksToBounds(true);
191 } 186 }
192 187
193 ScrollView::~ScrollView() { 188 ScrollView::~ScrollView() {
194 // The scrollbars may not have been added, delete them to ensure they get 189 // The scrollbars may not have been added, delete them to ensure they get
195 // deleted. 190 // deleted.
196 delete horiz_sb_; 191 delete horiz_sb_;
197 delete vert_sb_; 192 delete vert_sb_;
198 delete corner_view_; 193 delete corner_view_;
199 } 194 }
200 195
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 ScrollHeader(); 671 ScrollHeader();
677 } 672 }
678 } 673 }
679 674
680 bool ScrollView::ScrollsWithLayers() const { 675 bool ScrollView::ScrollsWithLayers() const {
681 // Just check for the presence of a layer since it's cheaper than querying the 676 // Just check for the presence of a layer since it's cheaper than querying the
682 // Feature flag each time. 677 // Feature flag each time.
683 return contents_viewport_->layer() != nullptr; 678 return contents_viewport_->layer() != nullptr;
684 } 679 }
685 680
681 void ScrollView::EnableViewPortLayer() {
682 background_color_ = SK_ColorWHITE;
683 contents_viewport_->set_background(
684 Background::CreateSolidBackground(background_color_));
685 contents_viewport_->SetPaintToLayer(true);
686 contents_viewport_->layer()->SetMasksToBounds(true);
687 }
688
686 void ScrollView::OnLayerScrolled() { 689 void ScrollView::OnLayerScrolled() {
687 UpdateScrollBarPositions(); 690 UpdateScrollBarPositions();
688 ScrollHeader(); 691 ScrollHeader();
689 } 692 }
690 693
691 void ScrollView::ScrollHeader() { 694 void ScrollView::ScrollHeader() {
692 if (!header_) 695 if (!header_)
693 return; 696 return;
694 697
695 int x_offset = CurrentOffset().x(); 698 int x_offset = CurrentOffset().x();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 769
767 VariableRowHeightScrollHelper::RowInfo 770 VariableRowHeightScrollHelper::RowInfo
768 FixedRowHeightScrollHelper::GetRowInfo(int y) { 771 FixedRowHeightScrollHelper::GetRowInfo(int y) {
769 if (y < top_margin_) 772 if (y < top_margin_)
770 return RowInfo(0, top_margin_); 773 return RowInfo(0, top_margin_);
771 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 774 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
772 row_height_); 775 row_height_);
773 } 776 }
774 777
775 } // namespace views 778 } // namespace views
OLDNEW
« chrome/browser/ui/views/intent_picker_bubble_view.cc ('K') | « ui/views/controls/scroll_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698