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

Unified Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 61923005: Make NativeTextfieldViews update the win system caret. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix typo and style issue Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/native_textfield_views.cc
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index 749de28a8c69b629ccf854184d66e767855c1f0c..b9d18466c3c98acbaf276de2224d02feb31aea23 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -51,6 +51,11 @@
#include "base/win/win_util.h"
#endif
+#if defined(OS_WIN)
+#include "ui/base/win/accessibility_misc_utils.h"
+#include "ui/views/win/hwnd_util.h"
+#endif
+
namespace {
void ConvertRectToScreen(const views::View* src, gfx::Rect* r) {
@@ -696,6 +701,9 @@ void NativeTextfieldViews::HandleBlur() {
is_cursor_visible_ = false;
RepaintCursor();
}
+#if defined(OS_WIN)
+ DestroyCaret();
+#endif
touch_selection_controller_.reset();
}
@@ -1372,6 +1380,20 @@ void NativeTextfieldViews::OnCaretBoundsChanged() {
// Notify selection controller
if (touch_selection_controller_.get())
touch_selection_controller_->SelectionChanged();
+
+#if defined(OS_WIN)
+ // Move an invisible system caret to this location for accessibility.
+ if (GetRenderText()->focused() &&
+ !model_->HasSelection() &&
sky 2013/11/07 01:34:42 How come you don't do this when there is a selecti
dmazzoni 2013/11/07 20:07:14 You're right - I thought we didn't need to update
+ !is_drop_cursor_visible_) {
+ gfx::Rect caret_rect(GetRenderText()->GetUpdatedCursorBounds());
+ caret_rect = ConvertRectToWidget(caret_rect);
+ caret_rect += GetWidget()->GetClientAreaBoundsInScreen().OffsetFromOrigin();
+ base::win::SetInvisibleSystemCaretRect(HWNDForView(this), caret_rect);
+ } else {
+ DestroyCaret();
+ }
+#endif
}
void NativeTextfieldViews::OnBeforeUserAction() {
« ui/base/win/accessibility_misc_utils.cc ('K') | « ui/base/win/accessibility_misc_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698