diff options
author | dmazzoni@google.com <dmazzoni@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-20 07:25:45 +0000 |
---|---|---|
committer | dmazzoni@google.com <dmazzoni@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-20 07:25:45 +0000 |
commit | 8b003b6a4664cb7c962bffa829e6ab6a20c395d7 (patch) | |
tree | aac0fdb742965bc9fed628256e67cbf514ca89a9 /ui | |
parent | 3ad63d062eac595157672c25acbc23436581bbed (diff) | |
download | chromium_src-8b003b6a4664cb7c962bffa829e6ab6a20c395d7.zip chromium_src-8b003b6a4664cb7c962bffa829e6ab6a20c395d7.tar.gz chromium_src-8b003b6a4664cb7c962bffa829e6ab6a20c395d7.tar.bz2 |
Revert 233759 "Make NativeTextfieldViews update the win system c..."
Caused new bug: http://crbug.com/320758
> Make NativeTextfieldViews update the win system caret.
>
> Added a helper function to ui/base/win because we're
> going to need to do the same thing from content/browser.
>
> BUG=142133
>
> Review URL: https://codereview.chromium.org/61923005
TBR=dmazzoni@chromium.org
BUG=320758,142133
Review URL: https://codereview.chromium.org/77173004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236198 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/win/accessibility_misc_utils.cc | 18 | ||||
-rw-r--r-- | ui/base/win/accessibility_misc_utils.h | 11 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.cc | 37 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.h | 9 |
4 files changed, 1 insertions, 74 deletions
diff --git a/ui/base/win/accessibility_misc_utils.cc b/ui/base/win/accessibility_misc_utils.cc index 391482b..5074ce3 100644 --- a/ui/base/win/accessibility_misc_utils.cc +++ b/ui/base/win/accessibility_misc_utils.cc @@ -4,29 +4,11 @@ #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) {} diff --git a/ui/base/win/accessibility_misc_utils.h b/ui/base/win/accessibility_misc_utils.h index dfee14f..3789efb 100644 --- a/ui/base/win/accessibility_misc_utils.h +++ b/ui/base/win/accessibility_misc_utils.h @@ -10,20 +10,11 @@ #include "base/compiler_specific.h" #include "ui/base/ui_export.h" -#include "ui/gfx/rect.h" namespace base { namespace win { -// This is used when we draw our own caret. Updates the system caret rect -// to the given bounding rectangle but makes it invisible. This allows -// utilities that help the user find the system caret to continue to work. -// |hwnd| should be the owning window, and |caret_rect| is in global -// screen coordinates. -UI_EXPORT void SetInvisibleSystemCaretRect(HWND hwnd, - const gfx::Rect& caret_rect); - -// UIA Text provider implementation for edit controls. + // UIA Text provider implementation for edit controls. class UI_EXPORT UIATextProvider : public NON_EXPORTED_BASE(CComObjectRootEx<CComMultiThreadModel>), public IValueProvider, diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index b587672..6d4199a 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -51,11 +51,6 @@ #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) { @@ -702,8 +697,6 @@ void NativeTextfieldViews::HandleBlur() { RepaintCursor(); } - PlatformHideSystemCaret(); - touch_selection_controller_.reset(); } @@ -1170,7 +1163,6 @@ void NativeTextfieldViews::RepaintCursor() { gfx::Rect r(GetRenderText()->GetUpdatedCursorBounds()); r.Inset(-1, -1, -1, -1); SchedulePaintInRect(r); - PlatformUpdateSystemCaret(); } void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) { @@ -1543,33 +1535,4 @@ void NativeTextfieldViews::RevealObscuredChar(int index, } } - -void NativeTextfieldViews::PlatformUpdateSystemCaret() { -#if defined(OS_WIN) - if (!GetRenderText()->focused()) - return; - - // Move an invisible system caret to this location for accessibility. - if (!is_drop_cursor_visible_) { - gfx::Rect caret_rect(GetRenderText()->GetUpdatedCursorBounds()); - caret_rect = ConvertRectToWidget(caret_rect); - caret_rect += GetWidget()->GetClientAreaBoundsInScreen().OffsetFromOrigin(); - if (caret_rect != last_caret_rect_) { - base::win::SetInvisibleSystemCaretRect(HWNDForView(this), caret_rect); - last_caret_rect_ = caret_rect; - } - } else { - DestroyCaret(); - last_caret_rect_ = gfx::Rect(); - } -#endif -} - -void NativeTextfieldViews::PlatformHideSystemCaret() { -#if defined(OS_WIN) - DestroyCaret(); - last_caret_rect_ = gfx::Rect(); -#endif -} - } // namespace views diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h index 0870ec2..aad8dad8 100644 --- a/ui/views/controls/textfield/native_textfield_views.h +++ b/ui/views/controls/textfield/native_textfield_views.h @@ -288,12 +288,6 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, // is -1, existing revealed index will be cleared. void RevealObscuredChar(int index, const base::TimeDelta& duration); - // Platform-specific updating of the system caret location to match ours. - void PlatformUpdateSystemCaret(); - - // Platform-specific hiding of the system caret whe we lose focus. - void PlatformHideSystemCaret(); - // The parent textfield, the owner of this object. Textfield* textfield_; @@ -340,9 +334,6 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, // and when the time expires, the last typed char is obscured. base::OneShotTimer<NativeTextfieldViews> obscured_reveal_timer_; - // The last caret rect, in screen coordinates. - gfx::Rect last_caret_rect_; - DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); }; |