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

Side by Side Diff: ui/views/bubble/bubble_border.cc

Issue 10808066: Fix position of web notification bubble and arrow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 years, 4 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 | « ui/views/bubble/bubble_border.h ('k') | ui/views/bubble/bubble_delegate.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 "ui/views/bubble/bubble_border.h" 5 #include "ui/views/bubble/bubble_border.h"
6 6
7 #include <algorithm> // for std::max 7 #include <algorithm> // for std::max
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 case FLOAT: 168 case FLOAT:
169 y += h / 2 - border_size.height() / 2; 169 y += h / 2 - border_size.height() / 2;
170 break; 170 break;
171 } 171 }
172 172
173 return gfx::Rect(x, y, border_size.width(), border_size.height()); 173 return gfx::Rect(x, y, border_size.width(), border_size.height());
174 } 174 }
175 175
176 void BubbleBorder::GetInsets(gfx::Insets* insets) const { 176 void BubbleBorder::GetInsets(gfx::Insets* insets) const {
177 return GetInsetsForArrowLocation(insets, arrow_location());
178 }
179
180 void BubbleBorder::GetInsetsForArrowLocation(gfx::Insets* insets,
181 ArrowLocation arrow_loc) const {
177 int top = images_->top->height(); 182 int top = images_->top->height();
178 int bottom = images_->bottom->height(); 183 int bottom = images_->bottom->height();
179 int left = images_->left->width(); 184 int left = images_->left->width();
180 int right = images_->right->width(); 185 int right = images_->right->width();
181 switch (arrow_location_) { 186 switch (arrow_loc) {
182 case TOP_LEFT: 187 case TOP_LEFT:
183 case TOP_RIGHT: 188 case TOP_RIGHT:
184 top = std::max(top, images_->top_arrow->height()); 189 top = std::max(top, images_->top_arrow->height());
185 break; 190 break;
186 191
187 case BOTTOM_LEFT: 192 case BOTTOM_LEFT:
188 case BOTTOM_RIGHT: 193 case BOTTOM_RIGHT:
189 bottom = std::max(bottom, images_->bottom_arrow->height()); 194 bottom = std::max(bottom, images_->bottom_arrow->height());
190 break; 195 break;
191 196
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 paint.setColor(border_->background_color()); 505 paint.setColor(border_->background_color());
501 SkPath path; 506 SkPath path;
502 gfx::Rect bounds(view->GetContentsBounds()); 507 gfx::Rect bounds(view->GetContentsBounds());
503 bounds.Inset(-border_->border_thickness(), -border_->border_thickness()); 508 bounds.Inset(-border_->border_thickness(), -border_->border_thickness());
504 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); 509 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius());
505 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); 510 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
506 canvas->DrawPath(path, paint); 511 canvas->DrawPath(path, paint);
507 } 512 }
508 513
509 } // namespace views 514 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_border.h ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698