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

Side by Side Diff: ash/tooltips/tooltip_controller.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 2 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
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/tooltips/tooltip_controller_unittest.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 (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/tooltips/tooltip_controller.h" 5 #include "ash/tooltips/tooltip_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (tooltip_rect.right() > display_bounds.right()) { 172 if (tooltip_rect.right() > display_bounds.right()) {
173 int h_offset = tooltip_rect.right() - display_bounds.right(); 173 int h_offset = tooltip_rect.right() - display_bounds.right();
174 tooltip_rect.Offset(-h_offset, 0); 174 tooltip_rect.Offset(-h_offset, 0);
175 } 175 }
176 176
177 // If tooltip is out of bounds on the y axis, we flip it to appear above the 177 // If tooltip is out of bounds on the y axis, we flip it to appear above the
178 // mouse cursor instead of below. 178 // mouse cursor instead of below.
179 if (tooltip_rect.bottom() > display_bounds.bottom()) 179 if (tooltip_rect.bottom() > display_bounds.bottom())
180 tooltip_rect.set_y(mouse_pos.y() - tooltip_height); 180 tooltip_rect.set_y(mouse_pos.y() - tooltip_height);
181 181
182 GetWidget()->SetBounds(tooltip_rect.AdjustToFit(display_bounds)); 182 tooltip_rect.AdjustToFit(display_bounds);
183 GetWidget()->SetBounds(tooltip_rect);
183 } 184 }
184 185
185 views::Widget* GetWidget() { 186 views::Widget* GetWidget() {
186 if (!widget_) { 187 if (!widget_) {
187 widget_ = CreateTooltip(); 188 widget_ = CreateTooltip();
188 widget_->SetContentsView(&label_); 189 widget_->SetContentsView(&label_);
189 widget_->AddObserver(this); 190 widget_->AddObserver(this);
190 } 191 }
191 return widget_; 192 return widget_;
192 } 193 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 471 }
471 472
472 TooltipController::Tooltip* TooltipController::GetTooltip() { 473 TooltipController::Tooltip* TooltipController::GetTooltip() {
473 if (!tooltip_.get()) 474 if (!tooltip_.get())
474 tooltip_.reset(new Tooltip); 475 tooltip_.reset(new Tooltip);
475 return tooltip_.get(); 476 return tooltip_.get();
476 } 477 }
477 478
478 } // namespace internal 479 } // namespace internal
479 } // namespace ash 480 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/tooltips/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698