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

Unified Diff: views/controls/textfield/native_textfield_win.h

Issue 2741007: Fix unicode bidi mirroring characters are not correctly mirrored in textfield (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | views/controls/textfield/native_textfield_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
//
« no previous file with comments | « no previous file | views/controls/textfield/native_textfield_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698