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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 11188063: Merge 161515 - Fix omnibox suggestion: restore selection on WM_IME_ENDCOMPOSITION (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/omnibox/omnibox_view_win.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <locale> 8 #include <locale>
9 #include <string> 9 #include <string>
10 10
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 ScopedFreeze freeze(this, GetTextObjectModel()); 1408 ScopedFreeze freeze(this, GetTextObjectModel());
1409 OnBeforePossibleChange(); 1409 OnBeforePossibleChange();
1410 LRESULT result = DefWindowProc(message, wparam, lparam); 1410 LRESULT result = DefWindowProc(message, wparam, lparam);
1411 // Force an IME composition confirmation operation to trigger the text_changed 1411 // Force an IME composition confirmation operation to trigger the text_changed
1412 // code in OnAfterPossibleChange(), even if identical contents are confirmed, 1412 // code in OnAfterPossibleChange(), even if identical contents are confirmed,
1413 // to make sure the model can update its internal states correctly. 1413 // to make sure the model can update its internal states correctly.
1414 OnAfterPossibleChangeInternal((lparam & GCS_RESULTSTR) != 0); 1414 OnAfterPossibleChangeInternal((lparam & GCS_RESULTSTR) != 0);
1415 return result; 1415 return result;
1416 } 1416 }
1417 1417
1418
1419 LRESULT OmniboxViewWin::OnImeEndComposition(UINT message, WPARAM wparam,
1420 LPARAM lparam) {
1421 // The edit control auto-clears the selection on WM_IME_ENDCOMPOSITION, which
1422 // means any inline autocompletion we were showing will no longer be
1423 // selected, and therefore no longer replaced by further user typing. To
1424 // avoid this we manually restore the original selection after the edit
1425 // handles the message.
1426 CHARRANGE range;
1427 GetSel(range);
1428 LRESULT result = DefWindowProc(message, wparam, lparam);
1429 SetSel(range);
1430 return result;
1431 }
1432
1418 LRESULT OmniboxViewWin::OnImeNotify(UINT message, 1433 LRESULT OmniboxViewWin::OnImeNotify(UINT message,
1419 WPARAM wparam, 1434 WPARAM wparam,
1420 LPARAM lparam) { 1435 LPARAM lparam) {
1421 // Close the popup when the IME composition window is open, so they don't 1436 // Close the popup when the IME composition window is open, so they don't
1422 // overlap. 1437 // overlap.
1423 switch (wparam) { 1438 switch (wparam) {
1424 case IMN_OPENCANDIDATE: 1439 case IMN_OPENCANDIDATE:
1425 ime_candidate_window_open_ = true; 1440 ime_candidate_window_open_ = true;
1426 CloseOmniboxPopup(); 1441 CloseOmniboxPopup();
1427 break; 1442 break;
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2681 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2667 } 2682 }
2668 2683
2669 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2684 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2670 // Use font_.GetStringWidth() instead of 2685 // Use font_.GetStringWidth() instead of
2671 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2686 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2672 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2687 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2673 // PosFromChar(i) might return 0 when i is greater than 1. 2688 // PosFromChar(i) might return 0 when i is greater than 1.
2674 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2689 return font_.GetStringWidth(text) + GetHorizontalMargin();
2675 } 2690 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698