Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ui/base/ime/input_method_auralinux.cc

Issue 2593323002: Use the physical-pixel space for native IME on linux platform. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/ime/input_method_auralinux.h" 5 #include "ui/base/ime/input_method_auralinux.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "ui/base/ime/ime_bridge.h" 10 #include "ui/base/ime/ime_bridge.h"
11 #include "ui/base/ime/ime_engine_handler_interface.h" 11 #include "ui/base/ime/ime_engine_handler_interface.h"
12 #include "ui/base/ime/linux/linux_input_method_context_factory.h" 12 #include "ui/base/ime/linux/linux_input_method_context_factory.h"
13 #include "ui/base/ime/text_input_client.h" 13 #include "ui/base/ime/text_input_client.h"
14 #include "ui/events/event.h" 14 #include "ui/events/event.h"
15 #include "ui/gfx/geometry/rect.h"
15 16
16 namespace { 17 namespace {
17 18
18 ui::IMEEngineHandlerInterface* GetEngine() { 19 ui::IMEEngineHandlerInterface* GetEngine() {
19 if (ui::IMEBridge::Get()) 20 if (ui::IMEBridge::Get())
20 return ui::IMEBridge::Get()->GetCurrentEngineHandler(); 21 return ui::IMEBridge::Get()->GetCurrentEngineHandler();
21 return nullptr; 22 return nullptr;
22 } 23 }
23 24
24 } // namespace 25 } // namespace
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 const TextInputClient* client) { 273 const TextInputClient* client) {
273 UpdateContextFocusState(); 274 UpdateContextFocusState();
274 InputMethodBase::OnTextInputTypeChanged(client); 275 InputMethodBase::OnTextInputTypeChanged(client);
275 // TODO(yoichio): Support inputmode HTML attribute. 276 // TODO(yoichio): Support inputmode HTML attribute.
276 } 277 }
277 278
278 void InputMethodAuraLinux::OnCaretBoundsChanged(const TextInputClient* client) { 279 void InputMethodAuraLinux::OnCaretBoundsChanged(const TextInputClient* client) {
279 if (!IsTextInputClientFocused(client)) 280 if (!IsTextInputClientFocused(client))
280 return; 281 return;
281 NotifyTextInputCaretBoundsChanged(client); 282 NotifyTextInputCaretBoundsChanged(client);
282 context_->SetCursorLocation(GetTextInputClient()->GetCaretBounds()); 283 context_->SetCursorLocation(
284 gfx::ScaleToEnclosingRect(client->GetCaretBounds(),
285 client->GetScaleFactor()));
sadrul 2016/12/22 01:30:22 Can you update the doc [1] to mention that this is
Shu Chen 2016/12/22 03:02:27 I've leveraged [2] and removed the GetScaleFactor
283 286
284 if (!IsTextInputTypeNone() && text_input_type_ != TEXT_INPUT_TYPE_PASSWORD && 287 if (!IsTextInputTypeNone() && text_input_type_ != TEXT_INPUT_TYPE_PASSWORD &&
285 GetEngine()) 288 GetEngine())
286 GetEngine()->SetCompositionBounds(GetCompositionBounds(client)); 289 GetEngine()->SetCompositionBounds(GetCompositionBounds(client));
287 } 290 }
288 291
289 void InputMethodAuraLinux::CancelComposition(const TextInputClient* client) { 292 void InputMethodAuraLinux::CancelComposition(const TextInputClient* client) {
290 if (!IsTextInputClientFocused(client)) 293 if (!IsTextInputClientFocused(client))
291 return; 294 return;
292 295
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 client->ConfirmCompositionText(); 444 client->ConfirmCompositionText();
442 445
443 if (GetEngine()) 446 if (GetEngine())
444 GetEngine()->Reset(); 447 GetEngine()->Reset();
445 } 448 }
446 449
447 ResetContext(); 450 ResetContext();
448 } 451 }
449 452
450 } // namespace ui 453 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698