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

Side by Side Diff: ash/shelf/overflow_bubble_view.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/shelf/overflow_bubble_view.h ('k') | ash/shelf/shelf_tooltip_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/shelf/overflow_bubble_view.h" 5 #include "ash/shelf/overflow_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_constants.h" 10 #include "ash/shelf/shelf_constants.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void OverflowBubbleView::ScrollByYOffset(int y_offset) { 101 void OverflowBubbleView::ScrollByYOffset(int y_offset) {
102 const gfx::Rect visible_bounds(GetContentsBounds()); 102 const gfx::Rect visible_bounds(GetContentsBounds());
103 const gfx::Size contents_size(GetContentsSize()); 103 const gfx::Size contents_size(GetContentsSize());
104 104
105 DCHECK_GE(contents_size.width(), visible_bounds.width()); 105 DCHECK_GE(contents_size.width(), visible_bounds.width());
106 int y = std::min(contents_size.height() - visible_bounds.height(), 106 int y = std::min(contents_size.height() - visible_bounds.height(),
107 std::max(0, scroll_offset_.y() + y_offset)); 107 std::max(0, scroll_offset_.y() + y_offset));
108 scroll_offset_.set_y(y); 108 scroll_offset_.set_y(y);
109 } 109 }
110 110
111 gfx::Size OverflowBubbleView::GetPreferredSize() { 111 gfx::Size OverflowBubbleView::GetPreferredSize() const {
112 gfx::Size preferred_size = GetContentsSize(); 112 gfx::Size preferred_size = GetContentsSize();
113 113
114 const gfx::Rect monitor_rect = Shell::GetScreen()->GetDisplayNearestPoint( 114 const gfx::Rect monitor_rect = Shell::GetScreen()->GetDisplayNearestPoint(
115 GetAnchorRect().CenterPoint()).work_area(); 115 GetAnchorRect().CenterPoint()).work_area();
116 if (!monitor_rect.IsEmpty()) { 116 if (!monitor_rect.IsEmpty()) {
117 if (IsHorizontalAlignment()) { 117 if (IsHorizontalAlignment()) {
118 preferred_size.set_width(std::min( 118 preferred_size.set_width(std::min(
119 preferred_size.width(), 119 preferred_size.width(),
120 static_cast<int>(monitor_rect.width() * 120 static_cast<int>(monitor_rect.width() *
121 kMaxBubbleSizeToScreenRatio))); 121 kMaxBubbleSizeToScreenRatio)));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 bubble_rect.Offset(0, offset); 215 bubble_rect.Offset(0, offset);
216 border->set_arrow_offset(anchor_rect.CenterPoint().y() - bubble_rect.y()); 216 border->set_arrow_offset(anchor_rect.CenterPoint().y() - bubble_rect.y());
217 } 217 }
218 218
219 GetBubbleFrameView()->SchedulePaint(); 219 GetBubbleFrameView()->SchedulePaint();
220 return bubble_rect; 220 return bubble_rect;
221 } 221 }
222 222
223 } // namespace ash 223 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/overflow_bubble_view.h ('k') | ash/shelf/shelf_tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698