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

Unified Diff: ui/views/controls/scroll_view.cc

Issue 2883273007: Revert of Ensure that the focus ring in the bookmarks bar does not paint outside the parent view. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scroll_view.cc
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc
index c28b51349a29256aaea3138651c7fd2114859ae9..74cefcc61f7e9dd75aea8fc1593af824d7066290 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -61,16 +61,13 @@
}
// Make sure the content is not scrolled out of bounds
-void ConstrainScrollToBounds(View* viewport,
- View* view,
- bool scroll_with_layers_enabled) {
+void ConstrainScrollToBounds(View* viewport, View* view) {
if (!view)
return;
// Note that even when ScrollView::ScrollsWithLayers() is true, the header row
// scrolls by repainting.
- const bool scrolls_with_layers =
- scroll_with_layers_enabled && viewport->layer() != nullptr;
+ const bool scrolls_with_layers = viewport->layer() != nullptr;
if (scrolls_with_layers) {
DCHECK(view->layer());
DCHECK_EQ(0, view->x());
@@ -155,9 +152,7 @@
min_height_(-1),
max_height_(-1),
background_color_(SK_ColorTRANSPARENT),
- hide_horizontal_scrollbar_(false),
- scroll_with_layers_enabled_(
- base::FeatureList::IsEnabled(kToolkitViewsScrollWithLayers)) {
+ hide_horizontal_scrollbar_(false) {
set_notify_enter_exit_on_child(true);
AddChildView(contents_viewport_);
@@ -171,9 +166,8 @@
vert_sb_->set_controller(this);
corner_view_->SetVisible(false);
- if (!scroll_with_layers_enabled_)
- return;
-
+ if (!base::FeatureList::IsEnabled(kToolkitViewsScrollWithLayers))
+ return;
EnableViewPortLayer();
}
@@ -456,10 +450,8 @@
if (header_)
header_->Layout();
- ConstrainScrollToBounds(header_viewport_, header_,
- scroll_with_layers_enabled_);
- ConstrainScrollToBounds(contents_viewport_, contents_,
- scroll_with_layers_enabled_);
+ ConstrainScrollToBounds(header_viewport_, header_);
+ ConstrainScrollToBounds(contents_viewport_, contents_);
SchedulePaint();
UpdateScrollBarPositions();
}
@@ -533,16 +525,6 @@
void ScrollView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
UpdateBorder();
-}
-
-void ScrollView::ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) {
- if (details.is_add && !viewport_layer_enabled_ && Contains(details.parent))
- EnableLayeringRecursivelyForChild(details.child);
-}
-
-void ScrollView::OnChildLayerChanged(View* child) {
- EnableViewPortLayer();
}
void ScrollView::ScrollToPosition(ScrollBar* source, int position) {
@@ -735,18 +717,12 @@
}
bool ScrollView::ScrollsWithLayers() const {
- if (!scroll_with_layers_enabled_)
- return false;
// Just check for the presence of a layer since it's cheaper than querying the
// Feature flag each time.
return contents_viewport_->layer() != nullptr;
}
void ScrollView::EnableViewPortLayer() {
- if (viewport_layer_enabled_)
- return;
-
- viewport_layer_enabled_ = true;
background_color_ = SK_ColorWHITE;
contents_viewport_->set_background(
Background::CreateSolidBackground(background_color_));
@@ -785,22 +761,6 @@
draw_focus_indicator_
? ui::NativeTheme::kColorId_FocusedBorderColor
: ui::NativeTheme::kColorId_UnfocusedBorderColor)));
-}
-
-bool ScrollView::EnableLayeringRecursivelyForChild(View* view) {
- if (viewport_layer_enabled_ || scroll_with_layers_enabled_)
- return true;
-
- if (view->layer()) {
- EnableViewPortLayer();
- return true;
- }
-
- for (int i = 0; i < view->child_count(); ++i) {
- if (EnableLayeringRecursivelyForChild(view->child_at(i)))
- return true;
- }
- return false;
}
// VariableRowHeightScrollHelper ----------------------------------------------
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698