OLD | NEW |
---|---|
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 "ui/views/controls/textfield/native_textfield_win.h" | 5 #include "ui/views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1055 if (!clipboard_str.empty()) { | 1055 if (!clipboard_str.empty()) { |
1056 string16 collapsed(CollapseWhitespace(clipboard_str, false)); | 1056 string16 collapsed(CollapseWhitespace(clipboard_str, false)); |
1057 if (textfield_->style() & Textfield::STYLE_LOWERCASE) | 1057 if (textfield_->style() & Textfield::STYLE_LOWERCASE) |
1058 collapsed = base::i18n::ToLower(collapsed); | 1058 collapsed = base::i18n::ToLower(collapsed); |
1059 // Force a Paste operation to trigger ContentsChanged, even if identical | 1059 // Force a Paste operation to trigger ContentsChanged, even if identical |
1060 // contents are pasted into the text box. See http://crbug.com/79002 | 1060 // contents are pasted into the text box. See http://crbug.com/79002 |
1061 ReplaceSel(L"", false); | 1061 ReplaceSel(L"", false); |
1062 textfield_->SyncText(); | 1062 textfield_->SyncText(); |
1063 text_before_change_.clear(); | 1063 text_before_change_.clear(); |
1064 ReplaceSel(collapsed.c_str(), true); | 1064 ReplaceSel(collapsed.c_str(), true); |
1065 if (TextfieldController* controller = textfield_->GetController()) | |
msw
2013/06/04 01:30:23
Assignment in conditionals is uncommon, and some r
Yuki
2013/06/04 03:35:04
Thanks.
| |
1066 controller->OnAfterPaste(); | |
1065 } | 1067 } |
1066 } | 1068 } |
1067 | 1069 |
1068 void NativeTextfieldWin::OnSetFocus(HWND hwnd) { | 1070 void NativeTextfieldWin::OnSetFocus(HWND hwnd) { |
1069 SetMsgHandled(FALSE); // We still want the default processing of the message. | 1071 SetMsgHandled(FALSE); // We still want the default processing of the message. |
1070 | 1072 |
1071 views::FocusManager* focus_manager = textfield_->GetFocusManager(); | 1073 views::FocusManager* focus_manager = textfield_->GetFocusManager(); |
1072 if (!focus_manager) { | 1074 if (!focus_manager) { |
1073 NOTREACHED(); | 1075 NOTREACHED(); |
1074 return; | 1076 return; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1308 return true; | 1310 return true; |
1309 MSG msg(*GetCurrentMessage()); | 1311 MSG msg(*GetCurrentMessage()); |
1310 // ATL doesn't set the |time| field. | 1312 // ATL doesn't set the |time| field. |
1311 if (!msg.time) | 1313 if (!msg.time) |
1312 msg.time = GetMessageTime(); | 1314 msg.time = GetMessageTime(); |
1313 ui::MouseEvent mouse_event(msg); | 1315 ui::MouseEvent mouse_event(msg); |
1314 return !controller->HandleMouseEvent(textfield_, mouse_event); | 1316 return !controller->HandleMouseEvent(textfield_, mouse_event); |
1315 } | 1317 } |
1316 | 1318 |
1317 } // namespace views | 1319 } // namespace views |
OLD | NEW |