Chromium Code Reviews| Index: ui/base/ime/input_method_win.cc |
| diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc |
| index 49efa46632113f4ed070bb20fea853d86bc49869..dbca1174fad9b752b9e3721e338cef12673caf4d 100644 |
| --- a/ui/base/ime/input_method_win.cc |
| +++ b/ui/base/ime/input_method_win.cc |
| @@ -16,11 +16,11 @@ |
| #include "ui/base/ime/text_input_client.h" |
| #include "ui/base/ime/win/tsf_input_scope.h" |
| #include "ui/base/ui_base_switches.h" |
| -#include "ui/display/win/screen_win.h" |
| #include "ui/events/event.h" |
| #include "ui/events/event_constants.h" |
| #include "ui/events/event_utils.h" |
| #include "ui/events/keycodes/keyboard_codes.h" |
| +#include "ui/gfx/geometry/rect.h" |
| #include "ui/gfx/win/hwnd_util.h" |
| namespace { |
| @@ -233,12 +233,12 @@ void InputMethodWin::OnCaretBoundsChanged(const TextInputClient* client) { |
| // The current text input type should not be NONE if |client| is focused. |
| DCHECK(!IsTextInputTypeNone()); |
| - // Tentatively assume that the returned value is DIP (Density Independent |
| - // Pixel). See the comment in text_input_client.h and http://crbug.com/360334. |
| + // Windows IME uses the non-dip coordinates. |
| + // See the comment in text_input_client.h and http://crbug.com/360334. |
| const gfx::Rect dip_screen_bounds(GetTextInputClient()->GetCaretBounds()); |
| const gfx::Rect screen_bounds = |
| - display::win::ScreenWin::DIPToScreenRect(toplevel_window_handle_, |
|
sadrul
2016/12/22 01:30:22
Does the old code not do the right thing, because
Shu Chen
2016/12/22 03:02:27
The old code does the right thing but I think it w
|
| - dip_screen_bounds); |
| + gfx::ScaleToEnclosingRect( |
| + dip_screen_bounds, GetTextInputClient()->GetScaleFactor()); |
| HWND attached_window = toplevel_window_handle_; |
| // TODO(ime): see comment in TextInputClient::GetCaretBounds(), this |
| @@ -630,9 +630,6 @@ LRESULT InputMethodWin::OnQueryCharPosition(IMECHARPOSITION* char_positon) { |
| if (!client) |
| return 0; |
| - // Tentatively assume that the returned value from |client| is DIP (Density |
| - // Independent Pixel). See the comment in text_input_client.h and |
| - // http://crbug.com/360334. |
| gfx::Rect dip_rect; |
| if (client->HasCompositionText()) { |
| if (!client->GetCompositionCharacterBounds(char_positon->dwCharPos, |
| @@ -646,9 +643,10 @@ LRESULT InputMethodWin::OnQueryCharPosition(IMECHARPOSITION* char_positon) { |
| return 0; |
| dip_rect = client->GetCaretBounds(); |
| } |
| + // Windows IME uses the non-dip coordinates. |
| + // See the comment in text_input_client.h and http://crbug.com/360334. |
| const gfx::Rect rect = |
| - display::win::ScreenWin::DIPToScreenRect(toplevel_window_handle_, |
| - dip_rect); |
| + gfx::ScaleToEnclosingRect(dip_rect, client->GetScaleFactor()); |
|
sadrul
2016/12/22 01:30:22
Can you use ConvertRectToDIP/ConvertRectToPixel in
Shu Chen
2016/12/22 03:02:27
I don't think so, because that would require a Lay
|
| char_positon->pt.x = rect.x(); |
| char_positon->pt.y = rect.y(); |