| Index: ash/tooltips/tooltip_controller.cc
|
| diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc
|
| index 85f27628acd9040a995bdce04d186b8d45abc0af..c5395c5dc19450a0b391ad68a30dbdbe859e2858 100644
|
| --- a/ash/tooltips/tooltip_controller.cc
|
| +++ b/ash/tooltips/tooltip_controller.cc
|
| @@ -191,6 +191,19 @@ class TooltipController::Tooltip {
|
| tooltip_rect.Offset(kCursorOffsetX, kCursorOffsetY);
|
| gfx::Rect monitor_bounds =
|
| gfx::Screen::GetMonitorAreaNearestPoint(tooltip_rect.origin());
|
| +
|
| + // If tooltip is out of bounds on the x axis, we simply shift it
|
| + // horizontally by the offset.
|
| + if (tooltip_rect.right() > monitor_bounds.right()) {
|
| + int h_offset = tooltip_rect.right() - monitor_bounds.right();
|
| + tooltip_rect.Offset(-h_offset, 0);
|
| + }
|
| +
|
| + // If tooltip is out of bounds on the y axis, we flip it to appear above the
|
| + // mouse cursor instead of below.
|
| + if (tooltip_rect.bottom() > monitor_bounds.bottom())
|
| + tooltip_rect.set_y(mouse_pos.y() - tooltip_height);
|
| +
|
| widget_->SetBounds(tooltip_rect.AdjustToFit(monitor_bounds));
|
| }
|
|
|
|
|