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

Unified Diff: ui/app_list/search_result_view.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/page_switcher.cc ('k') | ui/base/gestures/gesture_point.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/search_result_view.cc
diff --git a/ui/app_list/search_result_view.cc b/ui/app_list/search_result_view.cc
index 321b3a5bfbc4703e939f602c5d366f2435b74e9e..7e4559dce604dbb033f5ed6c47adafbe597df86d 100644
--- a/ui/app_list/search_result_view.cc
+++ b/ui/app_list/search_result_view.cc
@@ -168,7 +168,8 @@ void SearchResultView::Layout() {
gfx::Rect icon_bounds(rect);
icon_bounds.set_width(kIconViewWidth);
icon_bounds.Inset(kIconPadding, (rect.height() - kIconDimension) / 2);
- icon_->SetBoundsRect(icon_bounds.Intersect(rect));
+ icon_bounds.Intersect(rect);
+ icon_->SetBoundsRect(icon_bounds);
size_t num_buttons = action_buttons_.size();
for (size_t i = 0; i < num_buttons; ++i) {
@@ -199,7 +200,8 @@ void SearchResultView::OnPaint(gfx::Canvas* canvas) {
canvas->FillRect(content_rect, kHoverAndPushedColor);
}
- gfx::Rect border_bottom = rect.Subtract(content_rect);
+ gfx::Rect border_bottom(rect);
+ border_bottom.Subtract(content_rect);
canvas->FillRect(border_bottom,
selected ? kSelectedBorderColor : kBorderColor);
@@ -231,7 +233,9 @@ void SearchResultView::OnPaint(gfx::Canvas* canvas) {
} else if (title_text_.get()) {
gfx::Size title_size(text_bounds.width(),
title_text_->GetStringSize().height());
- title_text_->SetDisplayRect(text_bounds.Center(title_size));
+ gfx::Rect centered_title_rect(text_bounds);
+ centered_title_rect.ClampToCenteredSize(title_size);
+ title_text_->SetDisplayRect(centered_title_rect);
title_text_->Draw(canvas);
}
}
« no previous file with comments | « ui/app_list/page_switcher.cc ('k') | ui/base/gestures/gesture_point.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698