Commit 3656c9a8 authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

[iOS] Update outdated comments in OmniboxViewIOS.

Removes mentions of iOS <10 and removes one unnecessary if-condition.

Bug: None
Test: None
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I14b5e26b5b311011f3430fad813c164a8c682a27
Reviewed-on: https://chromium-review.googlesource.com/893186
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537332}
parent 8ce0e372
...@@ -221,8 +221,9 @@ void OmniboxViewIOS::SetWindowTextAndCaretPos(const base::string16& text, ...@@ -221,8 +221,9 @@ void OmniboxViewIOS::SetWindowTextAndCaretPos(const base::string16& text,
bool notify_text_changed) { bool notify_text_changed) {
// Do not call SetUserText() here, as the user has not triggered this change. // Do not call SetUserText() here, as the user has not triggered this change.
// Instead, set the field's text directly. // Instead, set the field's text directly.
// TODO(justincohen): b/5244062 Temporary fix to set the text_field value // Set the field_ value before calling ApplyTextAttributes(), because that
// before model()->CurrentTextIsUrl(), since that pulls from text_field.value. // internally calls model()->CurrentTextIsUrl(), which uses the text in the
// field_.
[field_ setText:base::SysUTF16ToNSString(text)]; [field_ setText:base::SysUTF16ToNSString(text)];
NSAttributedString* as = ApplyTextAttributes(text); NSAttributedString* as = ApplyTextAttributes(text);
...@@ -510,15 +511,13 @@ void OmniboxViewIOS::OnDidChange(bool processing_user_event) { ...@@ -510,15 +511,13 @@ void OmniboxViewIOS::OnDidChange(bool processing_user_event) {
// Generally do not notify the autocomplete system of a text change unless the // Generally do not notify the autocomplete system of a text change unless the
// change was a direct result of a user event. One exception is if the marked // change was a direct result of a user event. One exception is if the marked
// text changed, which could happen through a delayed IME recognition // text changed, which could happen through a delayed IME recognition
// callback. iOS4 does not provide API access to marked text, so use // callback.
// |IsImeComposing()| as a proxy.
bool proceed_without_user_event = false; bool proceed_without_user_event = false;
// The IME exception does not work for Korean text, because Korean does not // The IME exception does not work for Korean text, because Korean does not
// seem to ever have marked text. It simply replaces or modifies previous // seem to ever have marked text. It simply replaces or modifies previous
// characters as you type. Always proceed without user input on iOS7 if the // characters as you type. Always proceed without user input if the
// Korean keyboard is currently active. (This Korean exception is not // Korean keyboard is currently active.
// possible on iOS6 due to crbug.com/285294.)
NSString* current_language = [[field_ textInputMode] primaryLanguage]; NSString* current_language = [[field_ textInputMode] primaryLanguage];
if ([current_language hasPrefix:@"ko-"]) { if ([current_language hasPrefix:@"ko-"]) {
...@@ -669,11 +668,9 @@ void OmniboxViewIOS::UpdateSchemeStyle(const gfx::Range& range) { ...@@ -669,11 +668,9 @@ void OmniboxViewIOS::UpdateSchemeStyle(const gfx::Range& range) {
// strikethrough attribute, typing and setting text without strikethrough // strikethrough attribute, typing and setting text without strikethrough
// attribute will still result in strikethrough. The following is a // attribute will still result in strikethrough. The following is a
// workaround that prevents crossing out the first character. // workaround that prevents crossing out the first character.
if (base::ios::IsRunningOnOrLater(11, 0, 0)) { if (strikethroughRange.location == 0 && strikethroughRange.length > 0) {
if (strikethroughRange.location == 0 && strikethroughRange.length > 0) { strikethroughRange.location += 1;
strikethroughRange.location += 1; strikethroughRange.length -= 1;
strikethroughRange.length -= 1;
}
} }
} }
...@@ -761,8 +758,8 @@ void OmniboxViewIOS::ClearText() { ...@@ -761,8 +758,8 @@ void OmniboxViewIOS::ClearText() {
RemoveQueryRefinementChip(); RemoveQueryRefinementChip();
} else { } else {
// Otherwise, just remove the text in the omnibox. // Otherwise, just remove the text in the omnibox.
// Since iOS 6, calling |setText| does not trigger |textDidChange| so it // Calling -[UITextField setText:] does not trigger
// must be called explicitly. // -[id<UITextFieldDelegate> textDidChange] so it must be called explicitly.
OnClear(); OnClear();
[field_ setText:@""]; [field_ setText:@""];
OnDidChange(YES); OnDidChange(YES);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment