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

Issue 23619016: Switch the offset conversion routines from... (Closed)

Created:
7 years, 3 months ago by Peter Kasting
Modified:
7 years, 3 months ago
CC:
chromium-reviews, James Su, erikwright+watch_chromium.org, jshin+watch_chromium.org
Visibility:
Public.

Description

Switch the offset conversion routines from an "offsets point at characters" worldview to an "offsets point between characters" worldview. This more closely aligns with how the omnibox autocomplete code (which is what this was originally written for) expects things to behave. Direct fallout from this change: * An input offset of 0 will always map to an output offset of 0. * An input offset of (length of string) will always map to the length of the output string, instead of npos. * It's possible for multiple unique input offsets to map to a single non-npos output offset, if they e.g. point to the start and end of a collapsed sequence. * Input offsets pointing into the middle of a completely-removed sequence may not be set to npos if they fall on the boundaries of a subsequence processed by the transformer. For example, when running FormatUrlWithOffsets() on "http://user:pass@domain.com/" and directing it to omit both the scheme and username/password, an input offset of "7" that points in between the scheme and the username/password will be transformed to an output offset of 0 instead of npos. Indirect fallout: * A caller like SearchProvider::NavigationToMatch() will now mark certain matches as "allowed to be default" that it didn't before. Specifically, if the user's input string ends at the same point as the desired |fill_into_edit|, the autocomplete offset will be calculated as (length of string) instead of npos, and thus the match will be thought of as "inlinable" and thus "allowed to be default". BUG=284781 TEST=none R=msw@chromium.org, willchan@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=222426

Patch Set 1 #

Total comments: 17

Patch Set 2 : #

Total comments: 43

Patch Set 3 : #

Patch Set 4 : #

Total comments: 10

Patch Set 5 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -355 lines) Patch
M base/strings/utf_offset_string_conversions.h View 1 2 3 2 chunks +13 lines, -7 lines 0 comments Download
M base/strings/utf_offset_string_conversions.cc View 1 1 chunk +0 lines, -4 lines 0 comments Download
M base/strings/utf_offset_string_conversions_unittest.cc View 1 9 chunks +26 lines, -16 lines 0 comments Download
M chrome/browser/autocomplete/search_provider_unittest.cc View 1 2 3 4 4 chunks +24 lines, -3 lines 0 comments Download
M net/base/escape_unittest.cc View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M net/base/net_util.h View 1 2 3 1 chunk +19 lines, -9 lines 0 comments Download
M net/base/net_util.cc View 1 2 3 4 19 chunks +113 lines, -128 lines 0 comments Download
M net/base/net_util_unittest.cc View 1 2 3 4 2 chunks +82 lines, -186 lines 1 comment Download

Messages

Total messages: 14 (0 generated)
Peter Kasting
There are no great reviewers for this, since mrossetti wrote the original code and I ...
7 years, 3 months ago (2013-09-04 20:39:17 UTC) #1
willchan no longer on Chromium
Running off to a meeting, just wanted to say a few things first: * The ...
7 years, 3 months ago (2013-09-04 20:59:23 UTC) #2
msw
https://codereview.chromium.org/23619016/diff/1/base/strings/utf_offset_string_conversions.h File base/strings/utf_offset_string_conversions.h (right): https://codereview.chromium.org/23619016/diff/1/base/strings/utf_offset_string_conversions.h#newcode47 base/strings/utf_offset_string_conversions.h:47: // which is greater than |limit| with npos. I ...
7 years, 3 months ago (2013-09-04 23:58:50 UTC) #3
Peter Kasting
I'm ignoring all of Mike's comments for now because the net_util test failures exposed more ...
7 years, 3 months ago (2013-09-05 06:07:27 UTC) #4
msw
On 2013/09/05 06:07:27, Peter Kasting wrote: > I'm ignoring all of Mike's comments for now ...
7 years, 3 months ago (2013-09-05 19:18:01 UTC) #5
Peter Kasting
On 2013/09/05 19:18:01, msw wrote: > Sorry I didn't read all that, but hopefully my ...
7 years, 3 months ago (2013-09-05 19:31:36 UTC) #6
Peter Kasting
New snap up that implements the larger worldview changeover. https://codereview.chromium.org/23619016/diff/1/base/strings/utf_offset_string_conversions.h File base/strings/utf_offset_string_conversions.h (right): https://codereview.chromium.org/23619016/diff/1/base/strings/utf_offset_string_conversions.h#newcode47 base/strings/utf_offset_string_conversions.h:47: ...
7 years, 3 months ago (2013-09-05 20:11:59 UTC) #7
msw
On 2013/09/05 19:31:36, Peter Kasting wrote: > On 2013/09/05 19:18:01, msw wrote: > > Sorry ...
7 years, 3 months ago (2013-09-06 00:31:07 UTC) #8
Peter Kasting
Thanks for the thorough review, although I hadn't been expecting you to review net/ or ...
7 years, 3 months ago (2013-09-06 19:04:36 UTC) #9
msw
Okay, this is looking pretty good; I do like the "modified worldview" change overall. I ...
7 years, 3 months ago (2013-09-09 19:15:52 UTC) #10
Peter Kasting
New snap up. I think you're probably right that the existing FormatUrl...() functions could work ...
7 years, 3 months ago (2013-09-09 23:43:01 UTC) #11
msw
LGTM with a nit; thanks for doing some difficult work here. https://codereview.chromium.org/23619016/diff/77001/net/base/net_util_unittest.cc File net/base/net_util_unittest.cc (right): ...
7 years, 3 months ago (2013-09-10 17:01:14 UTC) #12
willchan no longer on Chromium
base/ LGTM As far as net/, I didn't do a detailed review for correctness and ...
7 years, 3 months ago (2013-09-11 00:09:36 UTC) #13
Peter Kasting
7 years, 3 months ago (2013-09-11 00:42:32 UTC) #14
Message was sent while issue was closed.
Committed patchset #5 manually as r222426 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698