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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.cc

Issue 2387503002: Fix menu scroll indicators and highlights overlapping the menu border. (Closed)
Patch Set: inset in layout instead Created 4 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 | « chrome/browser/ui/views/infobars/infobar_view.h ('k') | ui/views/controls/menu/menu_config.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 "chrome/browser/ui/views/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 int InfoBarView::EndX() const { 219 int InfoBarView::EndX() const {
220 return close_button_->x() - kBeforeCloseButtonSpacing; 220 return close_button_->x() - kBeforeCloseButtonSpacing;
221 } 221 }
222 222
223 int InfoBarView::OffsetY(views::View* view) const { 223 int InfoBarView::OffsetY(views::View* view) const {
224 return std::max((bar_target_height() - view->height()) / 2, 0) - 224 return std::max((bar_target_height() - view->height()) / 2, 0) -
225 (bar_target_height() - bar_height()); 225 (bar_target_height() - bar_height());
226 } 226 }
227 227
228 void InfoBarView::RunMenuAt(ui::MenuModel* menu_model,
229 views::MenuButton* button,
230 views::MenuAnchorPosition anchor) {
231 DCHECK(owner()); // We'd better not open any menus while we're closing.
232 gfx::Point screen_point;
233 views::View::ConvertPointToScreen(button, &screen_point);
234 menu_runner_.reset(
235 new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS));
236 // Ignore the result since we don't need to handle a deleted menu specially.
237 ignore_result(menu_runner_->RunMenuAt(GetWidget(),
238 button,
239 gfx::Rect(screen_point, button->size()),
240 anchor,
241 ui::MENU_SOURCE_NONE));
242 }
243
244 void InfoBarView::AddViewToContentArea(views::View* view) { 228 void InfoBarView::AddViewToContentArea(views::View* view) {
245 child_container_->AddChildView(view); 229 child_container_->AddChildView(view);
246 } 230 }
247 231
248 // static 232 // static
249 void InfoBarView::AssignWidthsSorted(Labels* labels, int available_width) { 233 void InfoBarView::AssignWidthsSorted(Labels* labels, int available_width) {
250 if (labels->empty()) 234 if (labels->empty())
251 return; 235 return;
252 gfx::Size back_label_size(labels->back()->GetPreferredSize()); 236 gfx::Size back_label_size(labels->back()->GetPreferredSize());
253 back_label_size.set_width( 237 back_label_size.set_width(
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 307 }
324 308
325 bool InfoBarView::DoesIntersectRect(const View* target, 309 bool InfoBarView::DoesIntersectRect(const View* target,
326 const gfx::Rect& rect) const { 310 const gfx::Rect& rect) const {
327 DCHECK_EQ(this, target); 311 DCHECK_EQ(this, target);
328 // Only events that intersect the portion below the arrow are interesting. 312 // Only events that intersect the portion below the arrow are interesting.
329 gfx::Rect non_arrow_bounds = GetLocalBounds(); 313 gfx::Rect non_arrow_bounds = GetLocalBounds();
330 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0);
331 return rect.Intersects(non_arrow_bounds); 315 return rect.Intersects(non_arrow_bounds);
332 } 316 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.h ('k') | ui/views/controls/menu/menu_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698