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

Unified Diff: ui/base/win/accessibility_misc_utils.cc

Issue 61923005: Make NativeTextfieldViews update the win system caret. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: const gfx::Rect& 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
« no previous file with comments | « ui/base/win/accessibility_misc_utils.h ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/accessibility_misc_utils.cc
diff --git a/ui/base/win/accessibility_misc_utils.cc b/ui/base/win/accessibility_misc_utils.cc
index 5074ce372a7999676e33c31c61a97dd09e8de279..391482b9a35bb9c40d40bc8d92daa10895c93709 100644
--- a/ui/base/win/accessibility_misc_utils.cc
+++ b/ui/base/win/accessibility_misc_utils.cc
@@ -4,11 +4,29 @@
#include "ui/base/win/accessibility_misc_utils.h"
#include "base/logging.h"
+#include "base/win/scoped_gdi_object.h"
#include "ui/base/win/atl_module.h"
namespace base {
namespace win {
+void SetInvisibleSystemCaretRect(HWND hwnd, const gfx::Rect& caret_rect) {
+ // Create an invisible bitmap.
+ base::win::ScopedGDIObject<HBITMAP> caret_bitmap(
+ CreateBitmap(1, caret_rect.height(), 1, 1, NULL));
+
+ // This destroys the previous caret (no matter what window it belonged to)
+ // and creates a new one owned by this window.
+ if (!CreateCaret(hwnd, caret_bitmap, 1, caret_rect.height()))
+ return;
+
+ ShowCaret(hwnd);
+ RECT window_rect;
+ GetWindowRect(hwnd, &window_rect);
+ SetCaretPos(caret_rect.x() - window_rect.left + 2,
+ caret_rect.y() - window_rect.top + 2);
+}
+
// UIA TextProvider implementation.
UIATextProvider::UIATextProvider()
: editable_(false) {}
« no previous file with comments | « ui/base/win/accessibility_misc_utils.h ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698