diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-01 00:53:18 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-01 00:53:18 +0000 |
commit | ceea4a852067bb0b6a7977349c091e65b7e72976 (patch) | |
tree | a0bb4db90f93583f9177339d12be241a3ef005d3 /chrome | |
parent | eaddfe135de9e9df14cea9127b03ba03929c6aec (diff) | |
download | chromium_src-ceea4a852067bb0b6a7977349c091e65b7e72976.zip chromium_src-ceea4a852067bb0b6a7977349c091e65b7e72976.tar.gz chromium_src-ceea4a852067bb0b6a7977349c091e65b7e72976.tar.bz2 |
Re-enable the offset computation logic for the vertical candidate window.
The problem with the original change was that it didn't call
in GetHorizontalOffset() in OnSetLocationCursor().
Outside web contetns in Chrome, UpdateLookupTable signal is
followed by SetLocationCursor signal. This caused:
1. OnUpdateLookupTable() to move the candidate window
with the offset computed
2. Then OnSetLocationCursor() to move the candidate window
without the offset.
This resulted in a flicker of the candidate window.
BUG=chromium-os:2720
TEST=manually on the netbook
Review URL: http://codereview.chromium.org/2423001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/text_input/candidate_window.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/chrome/browser/chromeos/text_input/candidate_window.cc b/chrome/browser/chromeos/text_input/candidate_window.cc index 317a6e0..149db70 100644 --- a/chrome/browser/chromeos/text_input/candidate_window.cc +++ b/chrome/browser/chromeos/text_input/candidate_window.cc @@ -795,7 +795,9 @@ void CandidateWindowView::ResizeAndSchedulePaint() { } int CandidateWindowView::GetHorizontalOffset() { - if (!candidate_views_.empty()) { + // Compute the horizontal offset if the lookup table is vertical. + if (!candidate_views_.empty() && + lookup_table_.orientation == InputMethodLookupTable::kVertical) { return - candidate_views_[0]->GetCandidateLabelPosition().x(); } return 0; @@ -924,7 +926,9 @@ void CandidateWindowController::OnSetCursorLocation( // Remember the cursor location. controller->set_cursor_location(gfx::Rect(x, y, width, height)); // Move the window per the cursor location. - controller->MoveCandidateWindow(controller->cursor_location(), 0); + controller->MoveCandidateWindow( + controller->cursor_location(), + controller->candidate_window_->GetHorizontalOffset()); // The call is needed to ensure that the candidate window is redrawed // properly after the cursor location is changed. controller->candidate_window_->ResizeAndSchedulePaint(); @@ -959,20 +963,12 @@ void CandidateWindowController::OnUpdateLookupTable( controller->candidate_window_->UpdateCandidates(lookup_table); controller->frame_->Show(); - // If the orientation is vertical, move the candidate window with the - // horizontal offset. - // - // Note that we should call MoveCandidateWindow() after + // We should call MoveCandidateWindow() after // controller->frame_->Show(), as GetHorizontalOffset() returns a valid // value only after the Show() method is called. - if (lookup_table.orientation == InputMethodLookupTable::kVertical) { - // Temporarily disabled the window position adjustment since it does not - // work fine with ibus-mozc. TODO(satorux): re-enable the feature. - // - // controller->MoveCandidateWindow( - // controller->cursor_location(), - // controller->candidate_window_->GetHorizontalOffset()); - } + controller->MoveCandidateWindow( + controller->cursor_location(), + controller->candidate_window_->GetHorizontalOffset()); } void CandidateWindowController::OnCandidateCommitted(int index, |