DescriptionOmnibox: Highlight Matches in URLs Properly
Previously we'd match the omnibox input against a cleaned-up version of
the URL. Precisely, we'd remove the escaping and interpret as UTF8 (and
lower-case it) so non-Latin characters can be matched correctly. This is
all well and good, but then we'd take the offsets of those matches
and use them to highlight segments of the original URL (properly escaped).
Oops. At best this caused bad highlighting; at middle, it caused weirdness
as we attempted to highlight the middle of a multi-string character;
at worst, it'd cause crashes because our offsets calculation would put
us in no-man's-land.
This fixes all that. :-)
Precisely, we keep track of the adjustments made during cleaning. We
take the offsets where terms matched and apply them through the
transformation in reverse.
TBR=sky
(as usual for history and bookmarks stuff that just change internals relative to how they behave with the omnibox)
BUG=252630, 359270
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266630
Patch Set 1 #Patch Set 2 : spacing #
Total comments: 14
Patch Set 3 : Peter's comments #
Total comments: 8
Patch Set 4 : Peter's comments #
Total comments: 3
Patch Set 5 : remove unnecessary includes #Patch Set 6 : add casts #Patch Set 7 : add missing include #Patch Set 8 : rebase #Patch Set 9 : apparently unit tests aren't always run in debug mode #Patch Set 10 : fix OffsetsFromTermMatches test #Messages
Total messages: 45 (0 generated)
|