diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 22:40:50 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 22:40:50 +0000 |
commit | 3f783369aa10fa323d79b6ec69afbd7035350fcd (patch) | |
tree | e1a5000171b7c854a8625947817e541a5843f419 /content/renderer/render_view_impl.cc | |
parent | 5d921d4cb8e9d5c90366183a523817b99c9bc63f (diff) | |
download | chromium_src-3f783369aa10fa323d79b6ec69afbd7035350fcd.zip chromium_src-3f783369aa10fa323d79b6ec69afbd7035350fcd.tar.gz chromium_src-3f783369aa10fa323d79b6ec69afbd7035350fcd.tar.bz2 |
Handle the change from CaretBounds to SelectionBounds for PPAPI Plugins.
BUG=101173
TEST=Manual: run ppapi_example_ime and verify the candidate window to pop up
in a correct place, or open a Flash website with text field on Chrome OS, and
verify that the candidate window is displayed in the bottom-left corner of
the Flash rect.
This CL is to reflect the refactoring http://crrev.com/105699 on IPCs also
for Pepper plugins, and make IME candidate windows to be displayed on intended
positions.
Review URL: http://codereview.chromium.org/8363015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/render_view_impl.cc')
-rw-r--r-- | content/renderer/render_view_impl.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index ac6f1aa..d92fd2f 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -4201,12 +4201,17 @@ void RenderViewImpl::OnSetFocus(bool enable) { void RenderViewImpl::PpapiPluginFocusChanged() { UpdateTextInputState(); + UpdateSelectionBounds(); } void RenderViewImpl::PpapiPluginTextInputTypeChanged() { UpdateTextInputState(); } +void RenderViewImpl::PpapiPluginCaretPositionChanged() { + UpdateSelectionBounds(); +} + void RenderViewImpl::PpapiPluginCancelComposition() { Send(new ViewHostMsg_ImeCancelComposition(routing_id())); ui::Range range(ui::Range::InvalidRange()); @@ -4297,9 +4302,18 @@ ui::TextInputType RenderViewImpl::GetTextInputType() { pepper_delegate_.GetTextInputType() : RenderWidget::GetTextInputType(); } -gfx::Rect RenderViewImpl::GetCaretBounds() { - return pepper_delegate_.IsPluginFocused() ? - pepper_delegate_.GetCaretBounds() : RenderWidget::GetCaretBounds(); +void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { + if (pepper_delegate_.IsPluginFocused()) { + // TODO(kinaba) http://crbug.com/101101 + // Current Pepper IME API does not handle selection bounds. So we simply + // use the caret position as an empty range for now. It will be updated + // after Pepper API equips features related to surrounding text retrieval. + gfx::Rect caret = pepper_delegate_.GetCaretBounds(); + *start = caret; + *end = caret; + return; + } + RenderWidget::GetSelectionBounds(start, end); } bool RenderViewImpl::CanComposeInline() { |