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

Side by Side Diff: ash/common/system/tray/tray_details_view.cc

Issue 2509783002: Don't reset scroll position of contents on every ScrollView layout. (Closed)
Patch Set: Created 4 years, 1 month 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 "ash/common/system/tray/tray_details_view.h" 5 #include "ash/common/system/tray/tray_details_view.h"
6 6
7 #include "ash/common/ash_view_ids.h" 7 #include "ash/common/ash_view_ids.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
10 #include "ash/common/system/tray/system_tray.h" 10 #include "ash/common/system/tray/system_tray.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); 414 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
415 owner->set_restore_focus(false); 415 owner->set_restore_focus(false);
416 } 416 }
417 417
418 void TrayDetailsView::Layout() { 418 void TrayDetailsView::Layout() {
419 if (UseMd()) { 419 if (UseMd()) {
420 views::View::Layout(); 420 views::View::Layout();
421 if (scroller_ && !scroller_->is_bounded()) 421 if (scroller_ && !scroller_->is_bounded())
422 scroller_->ClipHeightTo(0, scroller_->height()); 422 scroller_->ClipHeightTo(0, scroller_->height());
423 return;
423 } 424 }
424 425
425 if (UseMd() || bounds().IsEmpty()) { 426 if (bounds().IsEmpty()) {
426 views::View::Layout(); 427 views::View::Layout();
427 return; 428 return;
428 } 429 }
429 430
430 if (scroller_) { 431 if (scroller_) {
431 scroller_->set_fixed_size(gfx::Size()); 432 scroller_->set_fixed_size(gfx::Size());
432 gfx::Size size = GetPreferredSize(); 433 gfx::Size size = GetPreferredSize();
433 434
434 // Set the scroller to fill the space above the bottom row, so that the 435 // Set the scroller to fill the space above the bottom row, so that the
435 // bottom row of the detailed view will always stay just above the title 436 // bottom row of the detailed view will always stay just above the title
(...skipping 30 matching lines...) Expand all
466 if (index < child_count() - 1 && child_at(index + 1) != title_row_) 467 if (index < child_count() - 1 && child_at(index + 1) != title_row_)
467 scroll_border_->set_visible(true); 468 scroll_border_->set_visible(true);
468 else 469 else
469 scroll_border_->set_visible(false); 470 scroll_border_->set_visible(false);
470 } 471 }
471 472
472 views::View::OnPaintBorder(canvas); 473 views::View::OnPaintBorder(canvas);
473 } 474 }
474 475
475 } // namespace ash 476 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698