New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 613438 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

MacViews: Behavior of some moveAndSelect commands is incorrect when selection direction changes.

Project Member Reported by karandeepb@chromium.org, May 20 2016

Issue description

Version: 52.0.2742.0
OS: Mac

What steps will reproduce the problem?
(1) Enable MacViews.
(2) Go To Bookmark bubble.
(3) In the name textfield, type abcdefg.
(4) Select cde from left to right.

Now Press Command + Shift + Left.

Actual behavior- "ab" is selected.
Expected behavior - "abcde" is selected.

Also, with cde selected from left to right, press Alt + Shift + Left.

Actual behavior- "ab" is selected
Expected behavior - "ab|cdefg" i.e the existing selection reduces to a caret.

Commands with incorrect behavior for the case where selection direction is changed- 

-moveWordForwardAndModifySelection
-moveWordBackwardAndModifySelection
-moveToBeginningOfLineAndModifySelection
-moveToEndOfLineAndModifySelection
-moveToBeginningOfParagraphAndModifySelection
-moveToEndOfParagraphAndModifySelection
-moveToEndOfDocumentAndModifySelection
-moveToBeginningOfDocumentAndModifySelection
-moveParagraphForwardAndModifySelection
-moveParagraphBackwardAndModifySelection
-moveWordRightAndModifySelection
-moveWordLeftAndModifySelection
-moveToLeftEndOfLineAndModifySelection
-moveToRightEndOfLineAndModifySelection
 

Comment 1 by tapted@chromium.org, May 31 2016

Labels: M-53
Project Member

Comment 2 by sheriffbot@chromium.org, Jul 9 2016

Labels: -M-53 M-54 MovedFrom-53
Moving this nonessential bug to the next milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 3 by shrike@chromium.org, Jul 27 2016

Also, if you drag select cde from right to left and press Shift+Right Arrow:

Actual behavior- "de" is selected.
Expected behavior - "cdef" is selected.

Similarly, if you drag select cde from left to right and press Shift+Left Arrow:

Actual behavior- "bcde" is selected.
Expected behavior - "cd" is selected.

Yeah it seems Cocoa disregards the selection direction when a selection is made using the mouse.
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 18 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/84ab6fac6177ca421e01391de629bcfa36fda381

commit 84ab6fac6177ca421e01391de629bcfa36fda381
Author: karandeepb <karandeepb@chromium.org>
Date: Thu Aug 18 00:22:07 2016

MacViews: Fix behavior of move and select commands when selection direction changes.

Currently the following commands do not behave similarly to Cocoa textfields
when the selection direction changes-
-moveWordForwardAndModifySelection
-moveWordBackwardAndModifySelection
-moveToBeginningOfLineAndModifySelection
-moveToEndOfLineAndModifySelection
-moveToBeginningOfParagraphAndModifySelection
-moveToEndOfParagraphAndModifySelection
-moveToEndOfDocumentAndModifySelection
-moveToBeginningOfDocumentAndModifySelection
-moveParagraphForwardAndModifySelection
-moveParagraphBackwardAndModifySelection
-moveWordRightAndModifySelection
-moveWordLeftAndModifySelection
-moveToLeftEndOfLineAndModifySelection
-moveToRightEndOfLineAndModifySelection

This CL adds a new enum gfx::SelectionBehavior which specifies whether a
selection is to be made and how. RenderText::MoveCursor() is modified to take
this enum as a parameter. Also, two new text edit commands are added to the
ui::TextEditCommand enum-
-MOVE_PARAGRAPH_BACKWARD_AND_MODIFY_SELECTION
-MOVE_PARAGRAPH_FORWARD_AND_MODIFY_SELECTION

Textfield::IsTextEditCommandEnabled is modified to enable the following commands on
Mac-
 -MOVE_DOWN:
 -MOVE_DOWN_AND_MODIFY_SELECTION:
 -MOVE_PAGE_DOWN:
 -MOVE_PAGE_DOWN_AND_MODIFY_SELECTION:
 -MOVE_PAGE_UP:
 -MOVE_PAGE_UP_AND_MODIFY_SELECTION:
 -MOVE_UP:
 -MOVE_UP_AND_MODIFY_SELECTION:

Further, Textfield::ExecuteEditCommand is modified to set the correct
SelectionBehavior value for the different text editing commands. Also, lots of
tests are added.

This CL should have no behavior change for non-Mac platforms.

BUG= 613438 , 586985

Review-Url: https://codereview.chromium.org/2228833002
Cr-Commit-Position: refs/heads/master@{#412702}

[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/base/ime/linux/text_edit_command_auralinux.cc
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/base/ime/text_edit_commands.h
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/gfx/render_text.cc
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/gfx/render_text.h
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/gfx/render_text_unittest.cc
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/gfx/text_constants.h
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/cocoa/bridged_content_view.mm
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/cocoa/bridged_native_widget_unittest.mm
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/controls/textfield/textfield.cc
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/controls/textfield/textfield_model.cc
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/controls/textfield/textfield_model.h
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/controls/textfield/textfield_model_unittest.cc
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/controls/textfield/textfield_test_api.h
[modify] https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381/ui/views/controls/textfield/textfield_unittest.cc

Status: Fixed (was: Started)
Marking this as fixed. 

@shrike: Regarding comment 3, I don't think it's worth fixing. It's just that Cocoa disregards the initial selection direction we get from mouse dragging, while Views takes it into account. Hence with Cocoa, the mouse selection is always expanded on using the keyboard initially. Personally, I think the Views behavior is more intuitive. Please reopen the bug if you think this is not the case.

Also, you probably mixed up the Actual and Expected behaviors for the second case.
Cc: brajkumar@chromium.org
Labels: Needs-Feedback
karandeepb@- Could you please let us know which flag do we need to enable to test this issue from Chrome TE end. While navigating to chrome://flags we could see 5 macviews flags.
Labels: -Needs-Feedback
You need to enable chrome://flags/#mac-views-native-dialogs to enable MacViews for the bookmark bubble.
Labels: TE-Verified-M54 TE-Verified-54.0.2832.2
Verified this issue on Mac OS 10.11.6 using chrome latest Dev M54-54.0.2832.2 by following steps mentioned in the original comment. Observed text 'ab' gets selected as expected. Hence adding TE-Verified label.

613438.mp4
923 KB View Download

Sign in to add a comment