Commit 558cdbee authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Removed TableHeader::Layout(). Does header layout in TableView::Layout().

Bug: 1005568
Change-Id: Idd5cec9dea5e717279487a5601c16522c78278c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825458
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Auto-Submit: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699868}
parent 91281c25
......@@ -57,10 +57,6 @@ TableHeader::TableHeader(TableView* table) : table_(table) {}
TableHeader::~TableHeader() = default;
void TableHeader::Layout() {
SetBounds(x(), y(), table_->width(), GetPreferredSize().height());
}
void TableHeader::OnPaint(gfx::Canvas* canvas) {
ui::NativeTheme* theme = GetNativeTheme();
const SkColor text_color =
......
......@@ -34,7 +34,6 @@ class VIEWS_EXPORT TableHeader : public views::View {
TableView::AdvanceDirection direction);
// views::View overrides.
void Layout() override;
void OnPaint(gfx::Canvas* canvas) override;
const char* GetClassName() const override;
gfx::Size CalculatePreferredSize() const override;
......
......@@ -375,9 +375,8 @@ void TableView::SetSortOnPaint(bool sort_on_paint) {
}
void TableView::Layout() {
// parent()->parent() is the scrollview. When its width changes we force
// recalculating column sizes.
View* scroll_view = parent() ? parent()->parent() : nullptr;
// When the scrollview's width changes we force recalculating column sizes.
ScrollView* scroll_view = ScrollView::GetScrollViewForContents(this);
if (scroll_view) {
const int scroll_view_width = scroll_view->GetContentsBounds().width();
if (scroll_view_width != last_parent_width_) {
......@@ -399,6 +398,11 @@ void TableView::Layout() {
height = std::max(parent()->height(), height);
}
SetBounds(x(), y(), width, height);
if (header_) {
header_->SetBoundsRect(
gfx::Rect(header_->bounds().origin(),
gfx::Size(width, header_->GetPreferredSize().height())));
}
if (focus_ring_)
focus_ring_->Layout();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment