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

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

Issue 8505051: Support mozc suggest window on ChromeOS. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years 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
« no previous file with comments | « DEPS ('k') | chrome/browser/chromeos/input_method/candidate_window_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/candidate_window.cc
diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc
index 85078ffd4f374fb1bf35f1b8a13b5229c9f3e43e..e8a4593f220821b67b4830f1dc388de1c26fd88e 100644
--- a/chrome/browser/chromeos/input_method/candidate_window.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window.cc
@@ -833,7 +833,8 @@ CandidateWindowView::CandidateWindowView(views::Widget* parent_frame)
footer_area_(NULL),
previous_shortcut_column_width_(0),
previous_candidate_column_width_(0),
- previous_annotation_column_width_(0) {
+ previous_annotation_column_width_(0),
+ is_suggestion_window_location_available_(false) {
}
CandidateWindowView::~CandidateWindowView() {
@@ -935,6 +936,24 @@ void CandidateWindowView::ShowLookupTable() {
bool CandidateWindowView::ShouldUpdateCandidateViews(
const InputMethodLookupTable& old_table,
const InputMethodLookupTable& new_table) {
+
+ // Check if mozc lookup table location is changed.
+ if (old_table.mozc_candidates.has_window_location() ||
+ new_table.mozc_candidates.has_window_location()) {
+
+ if (!old_table.mozc_candidates.IsInitialized() ||
+ !new_table.mozc_candidates.IsInitialized()) {
+ return true;
+ }
+
+ std::string old_serialized_msg;
+ std::string new_serialized_msg;
+
+ old_table.mozc_candidates.SerializeToString(&old_serialized_msg);
+ new_table.mozc_candidates.SerializeToString(&new_serialized_msg);
+ return old_serialized_msg != new_serialized_msg;
+ }
+
// Check if most table contents are identical.
if (old_table.page_size == new_table.page_size &&
old_table.orientation == new_table.orientation &&
@@ -959,6 +978,24 @@ void CandidateWindowView::UpdateCandidates(
// Initialize candidate views if necessary.
MaybeInitializeCandidateViews(new_lookup_table);
+ // Store mozc specific window location.
+ if (new_lookup_table.mozc_candidates.has_window_location() &&
+ new_lookup_table.mozc_candidates.window_location() ==
+ mozc::commands::Candidates::COMPOSITION) {
+ DCHECK(new_lookup_table.mozc_candidates.has_composition_rectangle());
+ suggestion_window_location_.set_x(
+ new_lookup_table.mozc_candidates.composition_rectangle().x());
+ suggestion_window_location_.set_y(
+ new_lookup_table.mozc_candidates.composition_rectangle().y());
+ suggestion_window_location_.set_width(
+ new_lookup_table.mozc_candidates.composition_rectangle().width());
+ suggestion_window_location_.set_height(
+ new_lookup_table.mozc_candidates.composition_rectangle().height());
+ is_suggestion_window_location_available_ = true;
+ } else {
+ is_suggestion_window_location_available_ = false;
+ }
+
// Compute the index of the current page.
const int current_page_index = ComputePageIndex(new_lookup_table);
if (current_page_index < 0) {
@@ -1183,8 +1220,16 @@ void CandidateWindowView::CommitCandidate() {
}
void CandidateWindowView::ResizeAndMoveParentFrame() {
- const int x = cursor_location_.x();
- const int y = cursor_location_.y();
+ // If rendering operation comes from mozc-engine, uses mozc specific location,
+ // otherwise lookup table is shown under the cursor.
+ const int x = is_suggestion_window_location_available_ ?
+ suggestion_window_location_.x() : cursor_location_.x();
+ // To avoid lookup-table overlapping, uses maximum y-position of mozc specific
+ // location and cursor location, because mozc-engine does not consider about
+ // multi-line composition.
+ const int y = is_suggestion_window_location_available_ ?
+ std::max(suggestion_window_location_.y(), cursor_location_.y()) :
+ cursor_location_.y();
const int height = cursor_location_.height();
const int horizontal_offset = GetHorizontalOffset();
« no previous file with comments | « DEPS ('k') | chrome/browser/chromeos/input_method/candidate_window_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698