OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/input_method/candidate_window.h" | 5 #include "chrome/browser/chromeos/input_method/candidate_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 shortcut_label->SetText( | 229 shortcut_label->SetText( |
230 CreateShortcutText(i, lookup_table.orientation)); | 230 CreateShortcutText(i, lookup_table.orientation)); |
231 shortcut_column_width = | 231 shortcut_column_width = |
232 std::max(shortcut_column_width, | 232 std::max(shortcut_column_width, |
233 wrapped_shortcut_label->GetPreferredSize().width()); | 233 wrapped_shortcut_label->GetPreferredSize().width()); |
234 } | 234 } |
235 | 235 |
236 return shortcut_column_width; | 236 return shortcut_column_width; |
237 } | 237 } |
238 | 238 |
| 239 // Computes the page index. For instance, if the page size is 9, and the |
| 240 // cursor is pointing to 13th candidate, the page index will be 1 (2nd |
| 241 // page, as the index is zero-origin). Returns -1 on error. |
| 242 int ComputePageIndex(const chromeos::InputMethodLookupTable& lookup_table) { |
| 243 if (lookup_table.page_size > 0) |
| 244 return lookup_table.cursor_absolute_index / lookup_table.page_size; |
| 245 return -1; |
| 246 } |
| 247 |
239 // Computes candidate column width. | 248 // Computes candidate column width. |
240 int ComputeCandidateColumnWidth( | 249 int ComputeCandidateColumnWidth( |
241 const chromeos::InputMethodLookupTable& lookup_table) { | 250 const chromeos::InputMethodLookupTable& lookup_table) { |
242 int candidate_column_width = 0; | 251 int candidate_column_width = 0; |
243 scoped_ptr<views::Label> candidate_label( | 252 scoped_ptr<views::Label> candidate_label( |
244 CreateCandidateLabel(lookup_table.orientation)); | 253 CreateCandidateLabel(lookup_table.orientation)); |
245 | 254 |
246 // Compute the start index of |lookup_table_|. | 255 // Compute the start index of |lookup_table_|. |
247 const int current_page_index = | 256 const int current_page_index = ComputePageIndex(lookup_table); |
248 lookup_table.cursor_absolute_index / lookup_table.page_size; | 257 if (current_page_index < 0) |
| 258 return 0; |
249 const size_t start_from = current_page_index * lookup_table.page_size; | 259 const size_t start_from = current_page_index * lookup_table.page_size; |
250 | 260 |
251 // Compute the max width in candidate labels. | 261 // Compute the max width in candidate labels. |
252 // We'll create temporary candidate labels, and choose the largest width. | 262 // We'll create temporary candidate labels, and choose the largest width. |
253 for (size_t i = 0; i < lookup_table.candidates.size(); ++i) { | 263 for (size_t i = 0; i < lookup_table.candidates.size(); ++i) { |
254 const size_t index = start_from + i; | 264 const size_t index = start_from + i; |
255 | 265 |
256 candidate_label->SetText( | 266 candidate_label->SetText( |
257 UTF8ToWide(lookup_table.candidates[index])); | 267 UTF8ToWide(lookup_table.candidates[index])); |
258 candidate_column_width = | 268 candidate_column_width = |
259 std::max(candidate_column_width, | 269 std::max(candidate_column_width, |
260 candidate_label->GetPreferredSize().width()); | 270 candidate_label->GetPreferredSize().width()); |
261 } | 271 } |
262 | 272 |
263 return candidate_column_width; | 273 return candidate_column_width; |
264 } | 274 } |
265 | 275 |
266 // Computes annotation column width. | 276 // Computes annotation column width. |
267 int ComputeAnnotationColumnWidth( | 277 int ComputeAnnotationColumnWidth( |
268 const chromeos::InputMethodLookupTable& lookup_table) { | 278 const chromeos::InputMethodLookupTable& lookup_table) { |
269 int annotation_column_width = 0; | 279 int annotation_column_width = 0; |
270 scoped_ptr<views::Label> annotation_label( | 280 scoped_ptr<views::Label> annotation_label( |
271 CreateAnnotationLabel(lookup_table.orientation)); | 281 CreateAnnotationLabel(lookup_table.orientation)); |
272 | 282 |
273 // Compute the start index of |lookup_table_|. | 283 // Compute the start index of |lookup_table_|. |
274 const int current_page_index = | 284 const int current_page_index = ComputePageIndex(lookup_table); |
275 lookup_table.cursor_absolute_index / lookup_table.page_size; | 285 if (current_page_index < 0) |
| 286 return 0; |
276 const size_t start_from = current_page_index * lookup_table.page_size; | 287 const size_t start_from = current_page_index * lookup_table.page_size; |
277 | 288 |
278 // Compute max width in annotation labels. | 289 // Compute max width in annotation labels. |
279 // We'll create temporary annotation labels, and choose the largest width. | 290 // We'll create temporary annotation labels, and choose the largest width. |
280 for (size_t i = 0; i < lookup_table.annotations.size(); ++i) { | 291 for (size_t i = 0; i < lookup_table.annotations.size(); ++i) { |
281 const size_t index = start_from + i; | 292 const size_t index = start_from + i; |
282 | 293 |
283 annotation_label->SetText( | 294 annotation_label->SetText( |
284 UTF8ToWide(lookup_table.annotations[index])); | 295 UTF8ToWide(lookup_table.annotations[index])); |
285 annotation_column_width = | 296 annotation_column_width = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 349 |
339 // Hides the auxiliary text. | 350 // Hides the auxiliary text. |
340 void HideAuxiliaryText(); | 351 void HideAuxiliaryText(); |
341 | 352 |
342 // Shows the auxiliary text. | 353 // Shows the auxiliary text. |
343 void ShowAuxiliaryText(); | 354 void ShowAuxiliaryText(); |
344 | 355 |
345 // Updates the auxiliary text. | 356 // Updates the auxiliary text. |
346 void UpdateAuxiliaryText(const std::string& utf8_text); | 357 void UpdateAuxiliaryText(const std::string& utf8_text); |
347 | 358 |
| 359 // Returns true if we should update candidate views in the window. For |
| 360 // instance, if we are going to show the same candidates as before, we |
| 361 // don't have to update candidate views. This happens when the user just |
| 362 // moves the cursor in the same page in the candidate window. |
| 363 bool ShouldUpdateCandidateViews( |
| 364 const InputMethodLookupTable& old_table, |
| 365 const InputMethodLookupTable& new_table); |
| 366 |
348 // Updates candidates of the candidate window from |lookup_table|. | 367 // Updates candidates of the candidate window from |lookup_table|. |
349 // Candidates are arranged per |orientation|. | 368 // Candidates are arranged per |orientation|. |
350 void UpdateCandidates(const InputMethodLookupTable& lookup_table); | 369 void UpdateCandidates(const InputMethodLookupTable& lookup_table); |
351 | 370 |
352 // Resizes the parent frame and schedules painting. This needs to be | 371 // Resizes the parent frame and schedules painting. This needs to be |
353 // called when the visible contents of the candidate window are | 372 // called when the visible contents of the candidate window are |
354 // modified. | 373 // modified. |
355 void ResizeAndSchedulePaint(); | 374 void ResizeAndSchedulePaint(); |
356 | 375 |
357 // Returns the horizontal offset used for placing the vertical candidate | 376 // Returns the horizontal offset used for placing the vertical candidate |
(...skipping 17 matching lines...) Expand all Loading... |
375 // Creates the footer area, where we show status information. | 394 // Creates the footer area, where we show status information. |
376 // For instance, we show a cursor position like 2/19. | 395 // For instance, we show a cursor position like 2/19. |
377 views::View* CreateFooterArea(); | 396 views::View* CreateFooterArea(); |
378 | 397 |
379 // Creates the header area, where we show auxiliary text. | 398 // Creates the header area, where we show auxiliary text. |
380 views::View* CreateHeaderArea(); | 399 views::View* CreateHeaderArea(); |
381 | 400 |
382 // The lookup table (candidates). | 401 // The lookup table (candidates). |
383 InputMethodLookupTable lookup_table_; | 402 InputMethodLookupTable lookup_table_; |
384 | 403 |
385 // Zero-origin index of the current page. If the cursor is on the first | |
386 // page, the value will be 0. | |
387 int current_page_index_; | |
388 | |
389 // The index in the current page of the candidate currently being selected. | 404 // The index in the current page of the candidate currently being selected. |
390 int selected_candidate_index_in_page_; | 405 int selected_candidate_index_in_page_; |
391 | 406 |
392 // The observers of the object. | 407 // The observers of the object. |
393 ObserverList<Observer> observers_; | 408 ObserverList<Observer> observers_; |
394 | 409 |
395 // The parent frame. | 410 // The parent frame. |
396 views::Widget* parent_frame_; | 411 views::Widget* parent_frame_; |
397 | 412 |
398 // Views created in the class will be part of tree of |this|, so these | 413 // Views created in the class will be part of tree of |this|, so these |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 void CandidateView::OnMouseReleased(const views::MouseEvent& event, | 704 void CandidateView::OnMouseReleased(const views::MouseEvent& event, |
690 bool canceled) { | 705 bool canceled) { |
691 // Commit the current candidate unless it's canceled. | 706 // Commit the current candidate unless it's canceled. |
692 if (!canceled) { | 707 if (!canceled) { |
693 parent_candidate_window_->CommitCandidate(); | 708 parent_candidate_window_->CommitCandidate(); |
694 } | 709 } |
695 } | 710 } |
696 | 711 |
697 CandidateWindowView::CandidateWindowView( | 712 CandidateWindowView::CandidateWindowView( |
698 views::Widget* parent_frame) | 713 views::Widget* parent_frame) |
699 : current_page_index_(0), | 714 : selected_candidate_index_in_page_(0), |
700 selected_candidate_index_in_page_(0), | |
701 parent_frame_(parent_frame), | 715 parent_frame_(parent_frame), |
702 candidate_area_(NULL), | 716 candidate_area_(NULL), |
703 footer_area_(NULL), | 717 footer_area_(NULL), |
704 header_area_(NULL), | 718 header_area_(NULL), |
705 header_label_(NULL), | 719 header_label_(NULL), |
706 footer_label_(NULL), | 720 footer_label_(NULL), |
707 previous_shortcut_column_width_(0), | 721 previous_shortcut_column_width_(0), |
708 previous_candidate_column_width_(0), | 722 previous_candidate_column_width_(0), |
709 previous_annotation_column_width_(0) { | 723 previous_annotation_column_width_(0) { |
710 } | 724 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 ResizeAndSchedulePaint(); | 784 ResizeAndSchedulePaint(); |
771 } | 785 } |
772 | 786 |
773 void CandidateWindowView::UpdateAuxiliaryText(const std::string& utf8_text) { | 787 void CandidateWindowView::UpdateAuxiliaryText(const std::string& utf8_text) { |
774 views::Label* target_label = ( | 788 views::Label* target_label = ( |
775 lookup_table_.orientation == InputMethodLookupTable::kHorizontal ? | 789 lookup_table_.orientation == InputMethodLookupTable::kHorizontal ? |
776 header_label_ : footer_label_); | 790 header_label_ : footer_label_); |
777 target_label->SetText(UTF8ToWide(utf8_text)); | 791 target_label->SetText(UTF8ToWide(utf8_text)); |
778 } | 792 } |
779 | 793 |
| 794 bool CandidateWindowView::ShouldUpdateCandidateViews( |
| 795 const InputMethodLookupTable& old_table, |
| 796 const InputMethodLookupTable& new_table) { |
| 797 // Check if most table contents are identical. |
| 798 if (old_table.page_size == new_table.page_size && |
| 799 old_table.orientation == new_table.orientation && |
| 800 old_table.candidates == new_table.candidates && |
| 801 old_table.labels == new_table.labels && |
| 802 old_table.annotations == new_table.annotations && |
| 803 // Check if the page indexes are identical. |
| 804 ComputePageIndex(old_table) == ComputePageIndex(new_table)) { |
| 805 // If all of the conditions are met, we don't have to update candidate |
| 806 // views. |
| 807 return false; |
| 808 } |
| 809 return true; |
| 810 } |
| 811 |
780 void CandidateWindowView::UpdateCandidates( | 812 void CandidateWindowView::UpdateCandidates( |
781 const InputMethodLookupTable& lookup_table) { | 813 const InputMethodLookupTable& new_lookup_table) { |
782 // Initialize candidate views if necessary. | 814 const bool should_update = ShouldUpdateCandidateViews(lookup_table_, |
783 MaybeInitializeCandidateViews(lookup_table); | 815 new_lookup_table); |
| 816 // Updating the candidate views is expensive. We'll skip this if possible. |
| 817 if (should_update) { |
| 818 // Initialize candidate views if necessary. |
| 819 MaybeInitializeCandidateViews(new_lookup_table); |
784 | 820 |
785 // In MaybeInitializeCandidateViews(), | 821 // Compute the index of the current page. |
786 // |lookup_table| values and |lookup_table_| values are compared, | 822 const int current_page_index = ComputePageIndex(new_lookup_table); |
787 // so this substitution is needed after the function. | 823 if (current_page_index < 0) { |
788 lookup_table_ = lookup_table; | 824 LOG(ERROR) << "Invalid lookup_table: " << new_lookup_table.ToString(); |
| 825 return; |
| 826 } |
789 | 827 |
790 // Compute the index of the current page. | 828 // Update the candidates in the current page. |
791 current_page_index_ = | 829 const size_t start_from = current_page_index * new_lookup_table.page_size; |
792 lookup_table.cursor_absolute_index / lookup_table.page_size; | |
793 | 830 |
794 // Update the candidates in the current page. | 831 // In some cases, engines send empty shortcut labels. For instance, |
795 const size_t start_from = current_page_index_ * lookup_table.page_size; | 832 // ibus-mozc sends empty labels when they show suggestions. In this |
796 | 833 // case, we should not show shortcut labels. |
797 // In some cases, engines send empty shortcut labels. For instance, | 834 const bool no_shortcut_mode = |
798 // ibus-mozc sends empty labels when they show suggestions. In this | 835 (start_from < new_lookup_table.labels.size() && |
799 // case, we should not show shortcut labels. | 836 new_lookup_table.labels[start_from] == ""); |
800 const bool no_shortcut_mode = (start_from < lookup_table_.labels.size() && | 837 for (size_t i = 0; i < candidate_views_.size(); ++i) { |
801 lookup_table_.labels[start_from] == ""); | 838 const size_t index_in_page = i; |
802 for (size_t i = 0; i < candidate_views_.size(); ++i) { | 839 const size_t candidate_index = start_from + index_in_page; |
803 const size_t index_in_page = i; | 840 CandidateView* candidate_view = candidate_views_[index_in_page]; |
804 const size_t candidate_index = start_from + index_in_page; | 841 // Set the shortcut text. |
805 CandidateView* candidate_view = candidate_views_[index_in_page]; | 842 if (no_shortcut_mode) { |
806 // Set the shortcut text. | 843 candidate_view->SetShortcutText(L""); |
807 if (no_shortcut_mode) { | 844 } else { |
808 candidate_view->SetShortcutText(L""); | 845 // At this moment, we don't use labels sent from engines for UX |
809 } else { | 846 // reasons. First, we want to show shortcut labels in empty rows |
810 // At this moment, we don't use labels sent from engines for UX | 847 // (ex. show 6, 7, 8, ... in empty rows when the number of |
811 // reasons. First, we want to show shortcut labels in empty rows | 848 // candidates is 5). Second, we want to add a period after each |
812 // (ex. show 6, 7, 8, ... in empty rows when the number of | 849 // shortcut label when the candidate window is horizontal. |
813 // candidates is 5). Second, we want to add a period after each | 850 candidate_view->SetShortcutText( |
814 // shortcut label when the candidate window is horizontal. | 851 CreateShortcutText(i, new_lookup_table.orientation)); |
815 candidate_view->SetShortcutText( | 852 } |
816 CreateShortcutText(i, lookup_table_.orientation)); | 853 // Set the candidate text. |
817 } | 854 if (candidate_index < new_lookup_table.candidates.size() && |
818 // Set the candidate text. | 855 candidate_index < new_lookup_table.annotations.size()) { |
819 if (candidate_index < lookup_table_.candidates.size() && | 856 candidate_view->SetCandidateText( |
820 candidate_index < lookup_table_.annotations.size()) { | 857 UTF8ToWide(new_lookup_table.candidates[candidate_index])); |
821 candidate_view->SetCandidateText( | 858 candidate_view->SetAnnotationText( |
822 UTF8ToWide(lookup_table_.candidates[candidate_index])); | 859 UTF8ToWide(new_lookup_table.annotations[candidate_index])); |
823 candidate_view->SetAnnotationText( | 860 candidate_view->SetRowEnabled(true); |
824 UTF8ToWide(lookup_table_.annotations[candidate_index])); | 861 } else { |
825 candidate_view->SetRowEnabled(true); | 862 // Disable the empty row. |
826 } else { | 863 candidate_view->SetCandidateText(L""); |
827 // Disable the empty row. | 864 candidate_view->SetAnnotationText(L""); |
828 candidate_view->SetCandidateText(L""); | 865 candidate_view->SetRowEnabled(false); |
829 candidate_view->SetAnnotationText(L""); | 866 } |
830 candidate_view->SetRowEnabled(false); | |
831 } | 867 } |
832 } | 868 } |
| 869 // Update the current lookup table. We'll use lookup_table_ from here. |
| 870 // Note that SelectCandidateAt() uses lookup_table_. |
| 871 lookup_table_ = new_lookup_table; |
833 | 872 |
834 // Select the first candidate candidate in the page. | 873 // Select the current candidate in the page. |
835 const int first_candidate_in_page = | 874 const int current_candidate_in_page = |
836 lookup_table.cursor_absolute_index % lookup_table.page_size; | 875 lookup_table_.cursor_absolute_index % lookup_table_.page_size; |
837 SelectCandidateAt(first_candidate_in_page); | 876 SelectCandidateAt(current_candidate_in_page); |
838 } | 877 } |
839 | 878 |
840 void CandidateWindowView::MaybeInitializeCandidateViews( | 879 void CandidateWindowView::MaybeInitializeCandidateViews( |
841 const InputMethodLookupTable& lookup_table) { | 880 const InputMethodLookupTable& lookup_table) { |
842 const InputMethodLookupTable::Orientation orientation = | 881 const InputMethodLookupTable::Orientation orientation = |
843 lookup_table.orientation; | 882 lookup_table.orientation; |
844 const int page_size = lookup_table.page_size; | 883 const int page_size = lookup_table.page_size; |
845 | 884 |
846 // Current column width. | 885 // Current column width. |
847 int shortcut_column_width = 0; | 886 int shortcut_column_width = 0; |
848 int candidate_column_width = 0; | 887 int candidate_column_width = 0; |
849 int annotation_column_width = 0; | 888 int annotation_column_width = 0; |
850 | 889 |
851 // If orientation is horizontal, don't need to compute width, | 890 // If orientation is horizontal, don't need to compute width, |
852 // because each label is left aligned. | 891 // because each label is left aligned. |
853 if (orientation == InputMethodLookupTable::kVertical) { | 892 if (orientation == InputMethodLookupTable::kVertical) { |
854 shortcut_column_width = ComputeShortcutColumnWidth(lookup_table); | 893 shortcut_column_width = ComputeShortcutColumnWidth(lookup_table); |
855 candidate_column_width = ComputeCandidateColumnWidth(lookup_table); | 894 candidate_column_width = ComputeCandidateColumnWidth(lookup_table); |
856 annotation_column_width = ComputeAnnotationColumnWidth(lookup_table); | 895 annotation_column_width = ComputeAnnotationColumnWidth(lookup_table); |
857 } | 896 } |
858 | 897 |
859 // If the requested number of views matches the number of current views, and | 898 // If the requested number of views matches the number of current views, and |
860 // previous and current column width are same, just reuse these. | 899 // previous and current column width are same, just reuse these. |
| 900 // |
| 901 // Note that the early exit logic is not only useful for improving |
| 902 // performance, but also necessary for the horizontal candidate window |
| 903 // to be redrawn properly. If we get rid of the logic, the horizontal |
| 904 // candidate window won't get redrawn properly for some reason when |
| 905 // there is no size change. You can test this by removing "return" here |
| 906 // and type "ni" with Pinyin input method. |
861 if (static_cast<int>(candidate_views_.size()) == page_size && | 907 if (static_cast<int>(candidate_views_.size()) == page_size && |
862 lookup_table_.orientation == orientation && | 908 lookup_table_.orientation == orientation && |
863 previous_shortcut_column_width_ == shortcut_column_width && | 909 previous_shortcut_column_width_ == shortcut_column_width && |
864 previous_candidate_column_width_ == candidate_column_width && | 910 previous_candidate_column_width_ == candidate_column_width && |
865 previous_annotation_column_width_ == annotation_column_width) { | 911 previous_annotation_column_width_ == annotation_column_width) { |
866 return; | 912 return; |
867 } | 913 } |
868 | 914 |
869 // Update the previous column widths. | 915 // Update the previous column widths. |
870 previous_shortcut_column_width_ = shortcut_column_width; | 916 previous_shortcut_column_width_ = shortcut_column_width; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 kFooterBottomColor)); | 1035 kFooterBottomColor)); |
990 | 1036 |
991 views::View* footer_area = new views::View; | 1037 views::View* footer_area = new views::View; |
992 footer_area->SetLayoutManager(new views::FillLayout); | 1038 footer_area->SetLayoutManager(new views::FillLayout); |
993 // Initialize the footer area with the place holder (i.e. show nothing). | 1039 // Initialize the footer area with the place holder (i.e. show nothing). |
994 footer_area->AddChildView(footer_area_place_holder_.get()); | 1040 footer_area->AddChildView(footer_area_place_holder_.get()); |
995 return footer_area; | 1041 return footer_area; |
996 } | 1042 } |
997 | 1043 |
998 void CandidateWindowView::SelectCandidateAt(int index_in_page) { | 1044 void CandidateWindowView::SelectCandidateAt(int index_in_page) { |
999 int cursor_absolute_index = | 1045 const int current_page_index = ComputePageIndex(lookup_table_); |
1000 lookup_table_.page_size * current_page_index_ + index_in_page; | 1046 if (current_page_index < 0) { |
| 1047 LOG(ERROR) << "Invalid lookup_table: " << lookup_table_.ToString(); |
| 1048 return; |
| 1049 } |
| 1050 |
| 1051 const int cursor_absolute_index = |
| 1052 lookup_table_.page_size * current_page_index + index_in_page; |
1001 // Ignore click on out of range views. | 1053 // Ignore click on out of range views. |
1002 if (cursor_absolute_index < 0 || | 1054 if (cursor_absolute_index < 0 || |
1003 cursor_absolute_index >= | 1055 cursor_absolute_index >= |
1004 static_cast<int>(lookup_table_.candidates.size())) { | 1056 static_cast<int>(lookup_table_.candidates.size())) { |
1005 return; | 1057 return; |
1006 } | 1058 } |
1007 | 1059 |
1008 // Remember the currently selected candidate index in the current page. | 1060 // Remember the currently selected candidate index in the current page. |
1009 selected_candidate_index_in_page_ = index_in_page; | 1061 selected_candidate_index_in_page_ = index_in_page; |
1010 | 1062 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 DLOG(INFO) << "Ignored set_cursor_location signal to prevent window shake"; | 1256 DLOG(INFO) << "Ignored set_cursor_location signal to prevent window shake"; |
1205 return; | 1257 return; |
1206 } | 1258 } |
1207 | 1259 |
1208 // Remember the cursor location. | 1260 // Remember the cursor location. |
1209 controller->set_cursor_location(gfx::Rect(x, y, width, height)); | 1261 controller->set_cursor_location(gfx::Rect(x, y, width, height)); |
1210 // Move the window per the cursor location. | 1262 // Move the window per the cursor location. |
1211 controller->MoveCandidateWindow( | 1263 controller->MoveCandidateWindow( |
1212 controller->cursor_location(), | 1264 controller->cursor_location(), |
1213 controller->candidate_window_->GetHorizontalOffset()); | 1265 controller->candidate_window_->GetHorizontalOffset()); |
1214 // The call is needed to ensure that the candidate window is redrawed | 1266 // The call is needed to ensure that the candidate window is redrawn |
1215 // properly after the cursor location is changed. | 1267 // properly after the cursor location is changed. |
1216 controller->candidate_window_->ResizeAndSchedulePaint(); | 1268 controller->candidate_window_->ResizeAndSchedulePaint(); |
1217 } | 1269 } |
1218 | 1270 |
1219 void CandidateWindowController::Impl::OnUpdateAuxiliaryText( | 1271 void CandidateWindowController::Impl::OnUpdateAuxiliaryText( |
1220 void* input_method_library, | 1272 void* input_method_library, |
1221 const std::string& utf8_text, | 1273 const std::string& utf8_text, |
1222 bool visible) { | 1274 bool visible) { |
1223 CandidateWindowController::Impl* controller = | 1275 CandidateWindowController::Impl* controller = |
1224 static_cast<CandidateWindowController::Impl*>(input_method_library); | 1276 static_cast<CandidateWindowController::Impl*>(input_method_library); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 | 1333 |
1282 CandidateWindowController::~CandidateWindowController() { | 1334 CandidateWindowController::~CandidateWindowController() { |
1283 delete impl_; | 1335 delete impl_; |
1284 } | 1336 } |
1285 | 1337 |
1286 bool CandidateWindowController::Init() { | 1338 bool CandidateWindowController::Init() { |
1287 return impl_->Init(); | 1339 return impl_->Init(); |
1288 } | 1340 } |
1289 | 1341 |
1290 } // namespace chromeos | 1342 } // namespace chromeos |
OLD | NEW |