Chromium Code Reviews
DescriptionFix issue 21587, a regression of CL 196020.
This CL fixes issue 21587: REGRESSION: Omnibox does nothing when pressing enter after a single character of input.
It's a regression of my CL: http://codereview.chromium.org/196020, which reverts the text of omnibox in OnAfterPossibleChanges(), when enter key is pressed:
...
// If the change is caused by an Enter key press event, and the event was not
// handled by IME, then it's an unexpected change and shall be reverted here.
// {Start|Finish}UpdatingHighlightedText() are called here to prevent the
// PRIMARY selection from being changed.
if (enter_was_pressed_ &&
(char_inserted_ == '\n' || char_inserted_ == '\r')) {
StartUpdatingHighlightedText();
SetTextAndSelectedRange(text_before_change_, sel_before_change_);
FinishUpdatingHighlightedText();
return false;
}
...
Unfortunately, this piece of code causes the char_inserted_ to be set to wrong value in HandleInsertText(), if the text has only one character. See the source code of HandleInsertText():
...
// Filter out new line and tab characters.
// |text| is guaranteed to be a valid UTF-8 string, so it's safe here to
// filter byte by byte.
//
// If there was only a single character, then it might be generated by a key
// event. In this case, we save the single character to help our
// "key-press-event" signal handler distinguish if an Enter key event is
// handled by IME or not.
if (len == 1)
char_inserted_ = text[0];
...
This CL uses a boolean |enter_was_inserted_| instead of char |char_inserted_| to record the enter key status, to make sure it won't be reset unexpectly.
The test has been updated to cover this case. An unexpected dns lookup issue in the test which causes a failure on Windows was also fixed.
BUG=21587
: REGRESSION: Omnibox does nothing when pressing enter after a single character of input.
TEST=Input one character in omnibox and press enter, the default link matched with the character should be opened.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=26315
Patch Set 1 #
Total comments: 2
Messages
Total messages: 4 (0 generated)
|
|||||||||||||||||||||||||||||||||||||