| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 switch (key) { | 2147 switch (key) { |
| 2148 case VK_RIGHT: | 2148 case VK_RIGHT: |
| 2149 // TODO(sky): figure out RTL. | 2149 // TODO(sky): figure out RTL. |
| 2150 if (base::i18n::IsRTL()) | 2150 if (base::i18n::IsRTL()) |
| 2151 return false; | 2151 return false; |
| 2152 { | 2152 { |
| 2153 CHARRANGE selection; | 2153 CHARRANGE selection; |
| 2154 GetSel(selection); | 2154 GetSel(selection); |
| 2155 return (selection.cpMin == selection.cpMax) && | 2155 return (selection.cpMin == selection.cpMax) && |
| 2156 (selection.cpMin == GetTextLength()) && | 2156 (selection.cpMin == GetTextLength()) && |
| 2157 model()->CommitSuggestedText(true); | 2157 model()->CommitSuggestedText(); |
| 2158 } | 2158 } |
| 2159 | 2159 |
| 2160 case VK_RETURN: | 2160 case VK_RETURN: |
| 2161 model()->AcceptInput((flags & KF_ALTDOWN) ? | 2161 model()->AcceptInput((flags & KF_ALTDOWN) ? |
| 2162 NEW_FOREGROUND_TAB : CURRENT_TAB, false); | 2162 NEW_FOREGROUND_TAB : CURRENT_TAB, false); |
| 2163 return true; | 2163 return true; |
| 2164 | 2164 |
| 2165 case VK_PRIOR: | 2165 case VK_PRIOR: |
| 2166 case VK_NEXT: | 2166 case VK_NEXT: |
| 2167 count = model()->result().size(); | 2167 count = model()->result().size(); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2836 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
| 2837 } | 2837 } |
| 2838 | 2838 |
| 2839 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2839 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
| 2840 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because | 2840 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because |
| 2841 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with | 2841 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with |
| 2842 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than | 2842 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than |
| 2843 // 1. | 2843 // 1. |
| 2844 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2844 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2845 } | 2845 } |
| OLD | NEW |