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

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

Issue 12545040: A couple of fixes to bubble view: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 9 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
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_frame_view.h" 5 #include "ui/views/bubble/bubble_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "grit/ui_resources.h" 9 #include "grit/ui_resources.h"
10 #include "ui/base/hit_test.h" 10 #include "ui/base/hit_test.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Give the contents a margin. 177 // Give the contents a margin.
178 client_size.Enlarge(content_margins_.width(), content_margins_.height()); 178 client_size.Enlarge(content_margins_.width(), content_margins_.height());
179 179
180 const BubbleBorder::ArrowLocation arrow = bubble_border_->arrow_location(); 180 const BubbleBorder::ArrowLocation arrow = bubble_border_->arrow_location();
181 if (adjust_if_offscreen && BubbleBorder::has_arrow(arrow)) { 181 if (adjust_if_offscreen && BubbleBorder::has_arrow(arrow)) {
182 if (!bubble_border_->is_arrow_at_center(arrow)) { 182 if (!bubble_border_->is_arrow_at_center(arrow)) {
183 // Try to mirror the anchoring if the bubble does not fit on the screen. 183 // Try to mirror the anchoring if the bubble does not fit on the screen.
184 MirrorArrowIfOffScreen(true, anchor_rect, client_size); 184 MirrorArrowIfOffScreen(true, anchor_rect, client_size);
185 MirrorArrowIfOffScreen(false, anchor_rect, client_size); 185 MirrorArrowIfOffScreen(false, anchor_rect, client_size);
186 } else { 186 } else {
187 MirrorArrowIfOffScreen(BubbleBorder::is_arrow_on_horizontal(arrow),
msw 2013/03/14 20:17:58 nit: Add a minor comment like "Mirror as needed ve
varunjain 2013/03/14 20:54:59 Done.
188 anchor_rect, client_size);
187 OffsetArrowIfOffScreen(anchor_rect, client_size); 189 OffsetArrowIfOffScreen(anchor_rect, client_size);
188 } 190 }
189 } 191 }
190 192
191 // Calculate the bounds with the arrow in its updated location and offset. 193 // Calculate the bounds with the arrow in its updated location and offset.
192 return bubble_border_->GetBounds(anchor_rect, client_size); 194 return bubble_border_->GetBounds(anchor_rect, client_size);
193 } 195 }
194 196
195 gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) { 197 gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) {
196 // TODO(scottmg): Native is wrong. http://crbug.com/133312 198 // TODO(scottmg): Native is wrong. http://crbug.com/133312
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble 256 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble
255 // window needs to be moved to the right and that means we need to move arrow 257 // window needs to be moved to the right and that means we need to move arrow
256 // to the left, and that means negative offset. 258 // to the left, and that means negative offset.
257 bubble_border_->set_arrow_offset( 259 bubble_border_->set_arrow_offset(
258 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); 260 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust);
259 if (offscreen_adjust) 261 if (offscreen_adjust)
260 SchedulePaint(); 262 SchedulePaint();
261 } 263 }
262 264
263 } // namespace views 265 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698