Index: views/controls/textfield/native_textfield_win.h |
=================================================================== |
--- views/controls/textfield/native_textfield_win.h (revision 49443) |
+++ views/controls/textfield/native_textfield_win.h (working copy) |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -118,6 +118,21 @@ |
DISALLOW_COPY_AND_ASSIGN(ScopedFreeze); |
}; |
+ // This object suspends placing any operations on the edit's undo stack until |
+ // the object is destroyed. If we don't do this, some of the operations we |
+ // perform behind the user's back will be undoable by the user, which feels |
+ // bizarre and confusing. |
+ class ScopedSuspendUndo { |
+ public: |
+ explicit ScopedSuspendUndo(ITextDocument* text_object_model); |
+ ~ScopedSuspendUndo(); |
+ |
+ private: |
+ ITextDocument* const text_object_model_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedSuspendUndo); |
+ }; |
+ |
// message handlers |
void OnChar(TCHAR key, UINT repeat_count, UINT flags); |
void OnContextMenu(HWND window, const POINT& point); |
@@ -149,8 +164,18 @@ |
// before and after the change. These functions determine if anything |
// meaningful changed, and do any necessary updating and notification. |
void OnBeforePossibleChange(); |
- void OnAfterPossibleChange(); |
+ // When a user types a BIDI mirroring character (e.g. left parenthesis |
+ // U+0028, which should be rendered as '(' in LTR context unless surrounded |
+ // by RTL characters in both sides, and it should be rendered as ')' in RTL |
+ // context unless surrounded by LTR characters in both sides.), the textfield |
+ // does not properly mirror the character when necessary. However, if we |
+ // explicitly set the text in the edit to the entire current string, then |
+ // the BIDI mirroring characters will be mirrored properly. When |
+ // |should_redraw_text| is true, we explicitly set the text in the edit to |
+ // the entire current string any time the text changes. |
+ void OnAfterPossibleChange(bool should_redraw_text); |
+ |
// Given an X coordinate in client coordinates, returns that coordinate |
// clipped to be within the horizontal bounds of the visible text. |
// |