The following revision refers to this bug:
https://chromium.googlesource.com/chromium/src.git/+/e86f927228e135784931a9eb9825cb9ec4509267
commit e86f927228e135784931a9eb9825cb9ec4509267
Author: karandeepb <karandeepb@chromium.org>
Date: Wed Jun 08 23:43:28 2016
BridgedContentView: Modify IsTextRTL to use GetFirstStrongCharacterDirection.
Currently, IsTextRTL method in BridgedContentView uses
base::i18n::GetStringDirection to get the string text direction. This is
inconsistent with RenderText::GetTextDirection. This CL modifies IsTextRTL to
use base::i18n::GetFirstStrongCharacterDirection to ensure consistency with
RenderText::GetTextDirection.
This also necessitates modifying SendHomeEvent and SendEvent in
textfield_unittest.cc, to prevent the tests TextfieldTest.HitOutsideTextAreaTest
and TextfieldTest.HitOutsideTextAreaInRTLTest from regressing on MacViews. This
is because currently, SendHomeEvent and SendEndEvent correspond to logical
direction on other platforms but visual direction on Mac.
The reason that the tests TextfieldTest.HitOutsideTextAreaTest and
TextfieldTest.HitOutsideTextAreaInRTLTest passed up-till now is that the
incorrect IsTextRTL and Send{Home/End}Event implementations cancelled each other
out. IsTextRTL depends on GetStringDirection currently, and hence it always
returned false for text of mixed directionality. A SendHomeEvent would do a
Cmd+Left which would generate a moveToLeftEndOfLine. Since IsTextRTL returned
false, a moveToLeftEndOfLine mapped to a moveToBeginningOfLine in
BridgedContentView. Hence a Send{Home/End}Event mapped to
moveTo{Beginning/End}OfLine, the two incorrect implementations cancelling each
other out.
BUG= 618184
Review-Url: https://codereview.chromium.org/2050583002
Cr-Commit-Position: refs/heads/master@{#398736}
[modify] https://crrev.com/e86f927228e135784931a9eb9825cb9ec4509267/ui/views/cocoa/bridged_content_view.mm
[modify] https://crrev.com/e86f927228e135784931a9eb9825cb9ec4509267/ui/views/controls/textfield/textfield_unittest.cc
Comment 1 by bugdroid1@chromium.org
, Jun 8 2016