Commit d9affa23 authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Chopped off touch selection menu in RTL after Harmony changes.

Fixed Widget::SetBoundsConstrained & ensured TouchSelectionMenuRunnerViews is clamped to the desktop bounds.

Bug: 791507
Change-Id: I3386fc2a93bee2c10ce98ffa3b2974ab40b9606a
Reviewed-on: https://chromium-review.googlesource.com/888259
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532880}
parent 0cbad4b9
......@@ -10,6 +10,8 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
......@@ -120,7 +122,16 @@ TouchSelectionMenuRunnerViews::Menu::Menu(TouchSelectionMenuRunnerViews* owner,
SetAnchorRect(adjusted_anchor_rect);
BubbleDialogDelegateView::CreateBubble(this);
GetWidget()->Show();
Widget* widget = GetWidget();
gfx::Rect bounds = widget->GetWindowBoundsInScreen();
gfx::Rect work_area = display::Screen::GetScreen()
->GetDisplayNearestPoint(bounds.origin())
.work_area();
if (!work_area.IsEmpty()) {
bounds.AdjustToFit(work_area);
widget->SetBounds(bounds);
}
widget->Show();
}
bool TouchSelectionMenuRunnerViews::Menu::IsMenuAvailable(
......
......@@ -525,6 +525,8 @@ void Widget::SetBoundsConstrained(const gfx::Rect& bounds) {
if (work_area.IsEmpty()) {
SetBounds(bounds);
} else {
// TODO(https://crbug.com/806936): The following code doesn't actually do
// what the comment describing this function says it should.
// Inset the work area slightly.
work_area.Inset(10, 10, 10, 10);
work_area.AdjustToFit(bounds);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment