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

Side by Side Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 17101019: Consider IME is associated with the top level widget rather than child widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Revise the comment. Created 7 years, 6 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
« no previous file with comments | « no previous file | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 textfield_->obscured_reveal_duration(); 960 textfield_->obscured_reveal_duration();
961 if (reveal_duration != base::TimeDelta()) { 961 if (reveal_duration != base::TimeDelta()) {
962 const size_t change_offset = model_->GetCursorPosition(); 962 const size_t change_offset = model_->GetCursorPosition();
963 DCHECK_GT(change_offset, 0u); 963 DCHECK_GT(change_offset, 0u);
964 RevealObscuredChar(change_offset - 1, reveal_duration); 964 RevealObscuredChar(change_offset - 1, reveal_duration);
965 } 965 }
966 } 966 }
967 } 967 }
968 968
969 gfx::NativeWindow NativeTextfieldViews::GetAttachedWindow() const { 969 gfx::NativeWindow NativeTextfieldViews::GetAttachedWindow() const {
970 return GetWidget()->GetNativeWindow(); 970 // Imagine the following hierarchy.
971 // [NativeWidget A] - FocusManager
972 // [View]
973 // [NativeWidget B]
974 // [View]
975 // [View X]
976 // An important thing is that [NativeWidget A] owns Win32 input focus even
977 // when [View X] is logically focused by FocusManager. As a result, an Win32
978 // IME may want to interact with the native view of [NativeWidget A] rather
979 // than that of [NativeWidget B]. This is why we need to call
980 // GetTopLevelWidget() here.
981 return GetWidget()->GetTopLevelWidget()->GetNativeView();
971 } 982 }
972 983
973 ui::TextInputType NativeTextfieldViews::GetTextInputType() const { 984 ui::TextInputType NativeTextfieldViews::GetTextInputType() const {
974 return textfield_->GetTextInputType(); 985 return textfield_->GetTextInputType();
975 } 986 }
976 987
977 bool NativeTextfieldViews::CanComposeInline() const { 988 bool NativeTextfieldViews::CanComposeInline() const {
978 return true; 989 return true;
979 } 990 }
980 991
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 if (index != -1) { 1519 if (index != -1) {
1509 obscured_reveal_timer_.Start( 1520 obscured_reveal_timer_.Start(
1510 FROM_HERE, 1521 FROM_HERE,
1511 duration, 1522 duration,
1512 base::Bind(&NativeTextfieldViews::RevealObscuredChar, 1523 base::Bind(&NativeTextfieldViews::RevealObscuredChar,
1513 base::Unretained(this), -1, base::TimeDelta())); 1524 base::Unretained(this), -1, base::TimeDelta()));
1514 } 1525 }
1515 } 1526 }
1516 1527
1517 } // namespace views 1528 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698