Commit 94c87940 authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

Implement SetWindowTextAndCaretPos and SetCaretPos on iOS.

Implements the two methods on iOS.

Bug: 726702
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ib2a8a40be00c555096ca79915654d62e6ee1ac77
Reviewed-on: https://chromium-review.googlesource.com/1165085Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584400}
parent 3ad26936
...@@ -279,11 +279,18 @@ void OmniboxViewIOS::SetWindowTextAndCaretPos(const base::string16& text, ...@@ -279,11 +279,18 @@ void OmniboxViewIOS::SetWindowTextAndCaretPos(const base::string16& text,
if (notify_text_changed) if (notify_text_changed)
model()->OnChanged(); model()->OnChanged();
SetCaretPos(caret_pos);
} }
// TODO(crbug.com/726702): Implement this and have |SetWindowTextAndCaretPos()| void OmniboxViewIOS::SetCaretPos(size_t caret_pos) {
// call it. DCHECK(caret_pos <= field_.text.length || caret_pos == 0);
void OmniboxViewIOS::SetCaretPos(size_t caret_pos) {} UITextPosition* start = field_.beginningOfDocument;
UITextPosition* newPosition =
[field_ positionFromPosition:start offset:caret_pos];
field_.selectedTextRange =
[field_ textRangeFromPosition:newPosition toPosition:newPosition];
}
void OmniboxViewIOS::RevertAll() { void OmniboxViewIOS::RevertAll() {
ignore_popup_updates_ = true; ignore_popup_updates_ = true;
......
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