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

Issue 2395233005: [Mac] Preserve original selection when suggesting completions with diacritics (Closed)

Created:
4 years, 2 months ago by lgrey
Modified:
4 years, 2 months ago
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Preserve original selection when suggesting completions with diacritics When NSTextView is asked to select a range which does not begin on a grapheme boundary, it expands the selection to the previous boundary. This change preserves the original selection, then contracts the range sent to NSTextView to fall on the *next* boundary. Text editing operations that operate on the selection use the original selection instead of the visual selection. Since the omnibox view uses the text view's selected range, the view's |selectedRange| returns the original range and not the visual range. BUG=603883 Committed: https://crrev.com/8a8bae9fbc2e72afc208a0376c0f4a49388a6da3 Cr-Commit-Position: refs/heads/master@{#425671}

Patch Set 1 #

Patch Set 2 : Tests #

Patch Set 3 : Selected range test #

Patch Set 4 : s/ASSERT/EXPECT #

Total comments: 9

Patch Set 5 : Review comments #

Patch Set 6 : Expose actualSelectionRange as a property change calls to selectedRange to use it instead when appr… #

Total comments: 7

Patch Set 7 : No braces for single-line ifs #

Patch Set 8 : Restore lost paren #

Patch Set 9 : Handle setSelectedRanges: #

Total comments: 2

Patch Set 10 : Switch to overriding setSelectedRanges:... #

Patch Set 11 : Don't use generics #

Patch Set 12 : Missing import #

Total comments: 2

Patch Set 13 : Wrap retained object in scoped_nsobject #

Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -10 lines) Patch
M chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h View 1 2 3 4 5 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +86 lines, -9 lines 0 comments Download
M chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor_unittest.mm View 1 2 3 4 5 6 7 1 chunk +37 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm View 1 2 3 4 5 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_browsertest.mm View 1 2 3 4 5 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 44 (23 generated)
lgrey
4 years, 2 months ago (2016-10-11 21:19:45 UTC) #3
Alexei Svitkine (slow)
Sorry. I'm not a good reviewer for this - I don't work on Mac code ...
4 years, 2 months ago (2016-10-12 21:03:47 UTC) #5
erikchen
Thanks for looking into this. Really nice tests. :) https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode58 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:58: ...
4 years, 2 months ago (2016-10-12 22:37:48 UTC) #6
lgrey
https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode58 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:58: // TODO(lgrey): Should the break iterator be cached? On ...
4 years, 2 months ago (2016-10-13 15:42:52 UTC) #7
erikchen
https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode64 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:64: while (range.location < text.length() && On 2016/10/13 15:42:52, lgrey ...
4 years, 2 months ago (2016-10-13 17:08:28 UTC) #8
lgrey
PTAL :) https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/60001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode527 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:527: return actualSelectionRange_; On 2016/10/13 17:08:28, erikchen wrote: ...
4 years, 2 months ago (2016-10-13 21:03:56 UTC) #9
erikchen
Thanks! lgtm
4 years, 2 months ago (2016-10-13 21:06:47 UTC) #10
Alexei Svitkine (slow)
lgtm % nits https://codereview.chromium.org/2395233005/diff/100001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/100001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode54 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:54: if (range.location >= string.length) { Nit: ...
4 years, 2 months ago (2016-10-13 21:19:43 UTC) #11
lgrey
Thanks! https://codereview.chromium.org/2395233005/diff/100001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/100001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode54 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:54: if (range.location >= string.length) { On 2016/10/13 21:19:43, ...
4 years, 2 months ago (2016-10-14 14:20:55 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2395233005/120001
4 years, 2 months ago (2016-10-14 14:21:21 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2395233005/140001
4 years, 2 months ago (2016-10-14 15:01:39 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/314808)
4 years, 2 months ago (2016-10-14 16:20:41 UTC) #21
lgrey
PTAL erikchen@, updated to fix a case caught by the trybots (sorry!)
4 years, 2 months ago (2016-10-14 18:16:05 UTC) #24
erikchen
https://codereview.chromium.org/2395233005/diff/160001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/160001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode535 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:535: stillSelecting:(BOOL)flag { -setSelectedRange:... actually calls -setSelectedRanges: disassembly pseudocode: """ ...
4 years, 2 months ago (2016-10-14 18:41:35 UTC) #25
lgrey
https://codereview.chromium.org/2395233005/diff/160001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/160001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode535 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:535: stillSelecting:(BOOL)flag { On 2016/10/14 18:41:35, erikchen wrote: > -setSelectedRange:... ...
4 years, 2 months ago (2016-10-14 20:42:36 UTC) #34
erikchen
lgtm with nit https://codereview.chromium.org/2395233005/diff/220001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/220001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode525 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:525: NSMutableArray* mutableRanges = [ranges mutableCopy]; gotta ...
4 years, 2 months ago (2016-10-14 21:06:07 UTC) #35
lgrey
https://codereview.chromium.org/2395233005/diff/220001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm File chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm (right): https://codereview.chromium.org/2395233005/diff/220001/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm#newcode525 chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm:525: NSMutableArray* mutableRanges = [ranges mutableCopy]; On 2016/10/14 21:06:07, erikchen ...
4 years, 2 months ago (2016-10-17 13:30:28 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2395233005/240001
4 years, 2 months ago (2016-10-17 13:30:50 UTC) #39
commit-bot: I haz the power
Committed patchset #13 (id:240001)
4 years, 2 months ago (2016-10-17 13:57:10 UTC) #41
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/8a8bae9fbc2e72afc208a0376c0f4a49388a6da3 Cr-Commit-Position: refs/heads/master@{#425671}
4 years, 2 months ago (2016-10-17 13:58:54 UTC) #43
lgrey
4 years, 2 months ago (2016-10-18 15:22:30 UTC) #44
Message was sent while issue was closed.
A revert of this CL (patchset #13 id:240001) has been created in
https://codereview.chromium.org/2426983002/ by lgrey@chromium.org.

The reason for reverting is: This almost definitely caused crbug.com/656972, but
I can't repro the issue. Reverting while I investigate..

Powered by Google App Engine
This is Rietveld 408576698