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

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: Temporary fix to force Layout enabling within contents_viewport_ 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
186 background_color_ = SK_ColorWHITE; 186 background_color_ = SK_ColorWHITE;
sky 2016/10/17 15:32:49 Call EnableViewPortLayer() rather than duplicating
djacobo_ 2016/10/17 17:11:25 Done.
187 contents_viewport_->set_background( 187 contents_viewport_->set_background(
188 Background::CreateSolidBackground(background_color_)); 188 Background::CreateSolidBackground(background_color_));
189 contents_viewport_->SetPaintToLayer(true); 189 contents_viewport_->SetPaintToLayer(true);
190 contents_viewport_->layer()->SetMasksToBounds(true); 190 contents_viewport_->layer()->SetMasksToBounds(true);
191 } 191 }
192 192
193 ScrollView::~ScrollView() { 193 ScrollView::~ScrollView() {
194 // The scrollbars may not have been added, delete them to ensure they get 194 // The scrollbars may not have been added, delete them to ensure they get
195 // deleted. 195 // deleted.
196 delete horiz_sb_; 196 delete horiz_sb_;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 ScrollHeader(); 676 ScrollHeader();
677 } 677 }
678 } 678 }
679 679
680 bool ScrollView::ScrollsWithLayers() const { 680 bool ScrollView::ScrollsWithLayers() const {
681 // Just check for the presence of a layer since it's cheaper than querying the 681 // Just check for the presence of a layer since it's cheaper than querying the
682 // Feature flag each time. 682 // Feature flag each time.
683 return contents_viewport_->layer() != nullptr; 683 return contents_viewport_->layer() != nullptr;
684 } 684 }
685 685
686 void ScrollView::EnableViewPortLayer() {
687 background_color_ = SK_ColorWHITE;
688 contents_viewport_->set_background(
689 Background::CreateSolidBackground(background_color_));
690 contents_viewport_->SetPaintToLayer(true);
691 contents_viewport_->layer()->SetMasksToBounds(true);
692 }
693
686 void ScrollView::OnLayerScrolled() { 694 void ScrollView::OnLayerScrolled() {
687 UpdateScrollBarPositions(); 695 UpdateScrollBarPositions();
688 ScrollHeader(); 696 ScrollHeader();
689 } 697 }
690 698
691 void ScrollView::ScrollHeader() { 699 void ScrollView::ScrollHeader() {
692 if (!header_) 700 if (!header_)
693 return; 701 return;
694 702
695 int x_offset = CurrentOffset().x(); 703 int x_offset = CurrentOffset().x();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 774
767 VariableRowHeightScrollHelper::RowInfo 775 VariableRowHeightScrollHelper::RowInfo
768 FixedRowHeightScrollHelper::GetRowInfo(int y) { 776 FixedRowHeightScrollHelper::GetRowInfo(int y) {
769 if (y < top_margin_) 777 if (y < top_margin_)
770 return RowInfo(0, top_margin_); 778 return RowInfo(0, top_margin_);
771 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 779 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
772 row_height_); 780 row_height_);
773 } 781 }
774 782
775 } // namespace views 783 } // 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