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/autocomplete/autocomplete_edit_view_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" |
6 | 6 |
7 #include <locale> | 7 #include <locale> |
8 #include <richedit.h> | 8 #include <richedit.h> |
9 #include <textserv.h> | 9 #include <textserv.h> |
10 | 10 |
11 #include "app/clipboard/clipboard.h" | 11 #include "app/clipboard/clipboard.h" |
12 #include "app/clipboard/scoped_clipboard_writer.h" | 12 #include "app/clipboard/scoped_clipboard_writer.h" |
13 #include "app/gfx/canvas.h" | 13 #include "app/gfx/canvas.h" |
14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
15 #include "app/l10n_util_win.h" | 15 #include "app/l10n_util_win.h" |
16 #include "app/os_exchange_data.h" | 16 #include "app/os_exchange_data.h" |
17 #include "app/os_exchange_data_provider_win.h" | 17 #include "app/os_exchange_data_provider_win.h" |
18 #include "app/win_util.h" | 18 #include "app/win_util.h" |
19 #include "base/auto_reset.h" | 19 #include "base/auto_reset.h" |
20 #include "base/base_drag_source.h" | 20 #include "base/base_drag_source.h" |
21 #include "base/base_drop_target.h" | 21 #include "base/base_drop_target.h" |
22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 23 #include "base/i18n/rtl.h" |
23 #include "base/iat_patch.h" | 24 #include "base/iat_patch.h" |
24 #include "base/keyboard_codes.h" | 25 #include "base/keyboard_codes.h" |
25 #include "base/lazy_instance.h" | 26 #include "base/lazy_instance.h" |
26 #include "base/ref_counted.h" | 27 #include "base/ref_counted.h" |
27 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
28 #include "chrome/app/chrome_dll_resource.h" | 29 #include "chrome/app/chrome_dll_resource.h" |
29 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" | 30 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" |
30 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 31 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
31 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" | 32 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
32 #include "chrome/browser/autocomplete/keyword_provider.h" | 33 #include "chrome/browser/autocomplete/keyword_provider.h" |
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 // Clip the X coordinate to the left edge of the text. Careful: | 1987 // Clip the X coordinate to the left edge of the text. Careful: |
1987 // PosFromChar(0) may return a negative X coordinate if the beginning of the | 1988 // PosFromChar(0) may return a negative X coordinate if the beginning of the |
1988 // text has scrolled off the edit, so don't go past the clip rect's edge. | 1989 // text has scrolled off the edit, so don't go past the clip rect's edge. |
1989 PARAFORMAT2 pf2; | 1990 PARAFORMAT2 pf2; |
1990 GetParaFormat(pf2); | 1991 GetParaFormat(pf2); |
1991 // Calculation of the clipped coordinate is more complicated if the paragraph | 1992 // Calculation of the clipped coordinate is more complicated if the paragraph |
1992 // layout is RTL layout, or if there is RTL characters inside the LTR layout | 1993 // layout is RTL layout, or if there is RTL characters inside the LTR layout |
1993 // paragraph. | 1994 // paragraph. |
1994 bool ltr_text_in_ltr_layout = true; | 1995 bool ltr_text_in_ltr_layout = true; |
1995 if ((pf2.wEffects & PFE_RTLPARA) || | 1996 if ((pf2.wEffects & PFE_RTLPARA) || |
1996 l10n_util::StringContainsStrongRTLChars(GetText())) { | 1997 base::i18n::StringContainsStrongRTLChars(GetText())) { |
1997 ltr_text_in_ltr_layout = false; | 1998 ltr_text_in_ltr_layout = false; |
1998 } | 1999 } |
1999 const int length = GetTextLength(); | 2000 const int length = GetTextLength(); |
2000 RECT r; | 2001 RECT r; |
2001 GetRect(&r); | 2002 GetRect(&r); |
2002 // The values returned by PosFromChar() seem to refer always | 2003 // The values returned by PosFromChar() seem to refer always |
2003 // to the left edge of the character's bounding box. | 2004 // to the left edge of the character's bounding box. |
2004 const LONG first_position_x = PosFromChar(0).x; | 2005 const LONG first_position_x = PosFromChar(0).x; |
2005 LONG min_x = first_position_x; | 2006 LONG min_x = first_position_x; |
2006 if (!ltr_text_in_ltr_layout) { | 2007 if (!ltr_text_in_ltr_layout) { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, | 2430 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, |
2430 IDS_PASTE_AND_GO); | 2431 IDS_PASTE_AND_GO); |
2431 context_menu_contents_->AddSeparator(); | 2432 context_menu_contents_->AddSeparator(); |
2432 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); | 2433 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); |
2433 context_menu_contents_->AddSeparator(); | 2434 context_menu_contents_->AddSeparator(); |
2434 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, | 2435 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, |
2435 IDS_EDIT_SEARCH_ENGINES); | 2436 IDS_EDIT_SEARCH_ENGINES); |
2436 } | 2437 } |
2437 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); | 2438 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
2438 } | 2439 } |
OLD | NEW |