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

Side by Side Diff: ui/views/test/test_views.cc

Issue 2538513002: [ash-md] Fixed TriView to relayout child Views when their preferred size changed. (Closed)
Patch Set: Created 4 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/test_views.h" 5 #include "ui/views/test/test_views.h"
6 6
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/views/widget/native_widget_private.h" 8 #include "ui/views/widget/native_widget_private.h"
9 #include "ui/views/widget/widget.h" 9 #include "ui/views/widget/widget.h"
10 10
(...skipping 17 matching lines...) Expand all
28 28
29 gfx::Size StaticSizedView::GetMaximumSize() const { 29 gfx::Size StaticSizedView::GetMaximumSize() const {
30 return maximum_size_; 30 return maximum_size_;
31 } 31 }
32 32
33 ProportionallySizedView::ProportionallySizedView(int factor) 33 ProportionallySizedView::ProportionallySizedView(int factor)
34 : factor_(factor), preferred_width_(-1) {} 34 : factor_(factor), preferred_width_(-1) {}
35 35
36 ProportionallySizedView::~ProportionallySizedView() {} 36 ProportionallySizedView::~ProportionallySizedView() {}
37 37
38 void ProportionallySizedView::SetPreferredWidth(int width) {
39 preferred_width_ = width;
40 PreferredSizeChanged();
41 }
42
38 int ProportionallySizedView::GetHeightForWidth(int w) const { 43 int ProportionallySizedView::GetHeightForWidth(int w) const {
39 return w * factor_; 44 return w * factor_;
40 } 45 }
41 46
42 gfx::Size ProportionallySizedView::GetPreferredSize() const { 47 gfx::Size ProportionallySizedView::GetPreferredSize() const {
43 if (preferred_width_ >= 0) 48 if (preferred_width_ >= 0)
44 return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_)); 49 return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_));
45 return View::GetPreferredSize(); 50 return View::GetPreferredSize();
46 } 51 }
47 52
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 104 }
100 105
101 void EventCountView::RecordEvent(ui::Event* event) { 106 void EventCountView::RecordEvent(ui::Event* event) {
102 ++event_count_[event->type()]; 107 ++event_count_[event->type()];
103 last_flags_ = event->flags(); 108 last_flags_ = event->flags();
104 if (handle_mode_ == CONSUME_EVENTS) 109 if (handle_mode_ == CONSUME_EVENTS)
105 event->SetHandled(); 110 event->SetHandled();
106 } 111 }
107 112
108 } // namespace views 113 } // namespace views
OLDNEW
« ash/common/system/tray/tri_view.cc ('K') | « ui/views/test/test_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698