Commit 4e0ed7d4 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Reland "Implement ArcImeService::EnsureCaretNotInRect."

This is a reland of 10fa9630

Change from the original CL:
  Do not move up a window on Chrome side unless it's a notification

Original change's description:
> Implement ArcImeService::EnsureCaretNotInRect.
>
> It's left as unimplemented because Android WM handles insets by VK for
> most cases.
> However, Android WM can't move the SystemTray up for inline-reply in an
> Android notification because from Android WM's point of view,
> notificaiton is placed at (0, 0).
> This CL implements ArcImeService::EnsureCaretNotInRect to cover that
> case.
> This CL changes the behavior of windowed Android app with a11y keyboard.
> Before this CL, a position of a window is not changed by a11y keyboard
> visibility, but after this CL a position can be changed not to be
> covered by a11y keyboard.
>
>       SystemTray moves up if there is a space for it.
>
> Bug: b/114115612
> Test: manual - Focus on inline reply of an Android notificatioln and
> Change-Id: Ib666b6c269a8fc36195d30affa4c7a8a805560d7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631859
> Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
> Reviewed-by: Tetsui Ohkubo <tetsui@chromium.org>
> Commit-Queue: Yuichiro Hanada <yhanada@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#664583}

Bug: b/114115612
Test: manual - Open an Android notification with inline reply
Test: manual - Confirm http://b/138674508 does not reproduce with ARC
Change-Id: I589533a0d0ea6a89de7394279a461b8417eabe9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1828676Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701864}
parent 1b8a6f47
......@@ -7,4 +7,5 @@ include_rules = [
"+ui/gfx/geometry",
# Revisit this dependency when crbug.com/890403 is resovled.
"+ui/views",
"+ui/wm",
]
......@@ -26,6 +26,7 @@
#include "ui/gfx/range/range.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
#include "ui/wm/core/ime_util_chromeos.h"
namespace arc {
......@@ -496,6 +497,17 @@ bool ArcImeService::GetTextFromRange(const gfx::Range& range,
return true;
}
void ArcImeService::EnsureCaretNotInRect(const gfx::Rect& rect_in_screen) {
if (focused_arc_window_ == nullptr)
return;
aura::Window* top_level_window = focused_arc_window_->GetToplevelWindow();
// If the window is not a notification, the window move is handled by
// Android.
if (top_level_window->type() != aura::client::WINDOW_TYPE_POPUP)
return;
wm::EnsureWindowNotInRect(top_level_window, rect_in_screen);
}
ui::TextInputMode ArcImeService::GetTextInputMode() const {
return ui::TEXT_INPUT_MODE_DEFAULT;
}
......
......@@ -122,6 +122,7 @@ class ArcImeService : public KeyedService,
bool GetEditableSelectionRange(gfx::Range* range) const override;
bool GetTextFromRange(const gfx::Range& range,
base::string16* text) const override;
void EnsureCaretNotInRect(const gfx::Rect& rect) override;
// Overridden from ui::TextInputClient (with default implementation):
// TODO(kinaba): Support each of these methods to the extent possible in
......@@ -141,7 +142,6 @@ class ArcImeService : public KeyedService,
bool ChangeTextDirectionAndLayoutAlignment(
base::i18n::TextDirection direction) override;
void ExtendSelectionAndDelete(size_t before, size_t after) override;
void EnsureCaretNotInRect(const gfx::Rect& rect) override {}
bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override;
void SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) override {
}
......
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