OLD | NEW |
---|---|
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/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 // Just check for the presence of a layer since it's cheaper than querying the | 740 // Just check for the presence of a layer since it's cheaper than querying the |
741 // Feature flag each time. | 741 // Feature flag each time. |
742 return contents_viewport_->layer() != nullptr; | 742 return contents_viewport_->layer() != nullptr; |
743 } | 743 } |
744 | 744 |
745 void ScrollView::EnableViewPortLayer() { | 745 void ScrollView::EnableViewPortLayer() { |
746 if (viewport_layer_enabled_) | 746 if (viewport_layer_enabled_) |
747 return; | 747 return; |
748 | 748 |
749 viewport_layer_enabled_ = true; | 749 viewport_layer_enabled_ = true; |
750 background_color_ = SK_ColorWHITE; | 750 |
751 contents_viewport_->set_background( | |
752 Background::CreateSolidBackground(background_color_)); | |
753 contents_viewport_->SetPaintToLayer(); | 751 contents_viewport_->SetPaintToLayer(); |
sky
2017/05/22 16:23:40
Does supplying LAYER_SOLID_COLOR work for your nee
ananta
2017/05/22 19:22:43
Sadly no. The content does not show up.
| |
752 | |
753 if (scroll_with_layers_enabled_) { | |
754 background_color_ = SK_ColorWHITE; | |
755 contents_viewport_->set_background( | |
756 Background::CreateSolidBackground(background_color_)); | |
757 } else { | |
758 // We may have transparent children who want to blend into the default | |
759 // background. | |
760 contents_viewport_->layer()->SetFillsBoundsOpaquely(false); | |
761 } | |
754 contents_viewport_->layer()->SetMasksToBounds(true); | 762 contents_viewport_->layer()->SetMasksToBounds(true); |
755 } | 763 } |
756 | 764 |
757 void ScrollView::OnLayerScrolled(const gfx::ScrollOffset&) { | 765 void ScrollView::OnLayerScrolled(const gfx::ScrollOffset&) { |
758 UpdateScrollBarPositions(); | 766 UpdateScrollBarPositions(); |
759 ScrollHeader(); | 767 ScrollHeader(); |
760 } | 768 } |
761 | 769 |
762 void ScrollView::ScrollHeader() { | 770 void ScrollView::ScrollHeader() { |
763 if (!header_) | 771 if (!header_) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 | 878 |
871 VariableRowHeightScrollHelper::RowInfo | 879 VariableRowHeightScrollHelper::RowInfo |
872 FixedRowHeightScrollHelper::GetRowInfo(int y) { | 880 FixedRowHeightScrollHelper::GetRowInfo(int y) { |
873 if (y < top_margin_) | 881 if (y < top_margin_) |
874 return RowInfo(0, top_margin_); | 882 return RowInfo(0, top_margin_); |
875 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, | 883 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, |
876 row_height_); | 884 row_height_); |
877 } | 885 } |
878 | 886 |
879 } // namespace views | 887 } // namespace views |
OLD | NEW |