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

Unified Diff: chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc

Issue 11956008: Move SetCursorLocation bypass code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests: add TextInputTestSupport initialzation Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
index 2f917020be001a74e73606533960a0dd9a81b789..1fdf9a470fc9124f623eb04791ff5feb5dd716fe 100644
--- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
@@ -30,6 +30,11 @@ namespace {
const int kInfolistShowDelayMilliSeconds = 500;
// The milliseconds of the delay to hide the infolist window.
const int kInfolistHideDelayMilliSeconds = 500;
+
+// Converts from ibus::Rect to gfx::Rect.
+gfx::Rect IBusRectToGfxRect(const ibus::Rect& rect) {
+ return gfx::Rect(rect.x, rect.y, rect.width, rect.height);
+}
} // namespace
bool CandidateWindowControllerImpl::Init(IBusController* controller) {
@@ -124,23 +129,24 @@ void CandidateWindowControllerImpl::OnHidePreeditText() {
}
void CandidateWindowControllerImpl::OnSetCursorLocation(
- const gfx::Rect& cursor_location,
- const gfx::Rect& composition_head) {
+ const ibus::Rect& cursor_location,
+ const ibus::Rect& composition_head) {
// A workaround for http://crosbug.com/6460. We should ignore very short Y
// move to prevent the window from shaking up and down.
const int kKeepPositionThreshold = 2; // px
const gfx::Rect& last_location =
candidate_window_->cursor_location();
- const int delta_y = abs(last_location.y() - cursor_location.y());
- if ((last_location.x() == cursor_location.x()) &&
+ const int delta_y = abs(last_location.y() - cursor_location.y);
+ if ((last_location.x() == cursor_location.x) &&
(delta_y <= kKeepPositionThreshold)) {
DVLOG(1) << "Ignored set_cursor_location signal to prevent window shake";
return;
}
// Remember the cursor location.
- candidate_window_->set_cursor_location(cursor_location);
- candidate_window_->set_composition_head_location(composition_head);
+ candidate_window_->set_cursor_location(IBusRectToGfxRect(cursor_location));
+ candidate_window_->set_composition_head_location(
+ IBusRectToGfxRect(composition_head));
// Move the window per the cursor location.
candidate_window_->ResizeAndMoveParentFrame();
UpdateInfolistBounds();

Powered by Google App Engine
This is Rietveld 408576698