Commit 5f0ee342 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Reland "Change Range::expand() to VisiblePosition-free functions for word and sentence"

This reverts commit 8226b54c.

Reason for revert: The original bug is fixed.

Original change's description:
> Revert "Change Range::expand() to VisiblePosition-free functions for word and sentence"
> 
> This reverts commit 775938b6.
> 
> Reason for revert: need to revert this to revert r608849
> 
> Original change's description:
> > Change Range::expand() to VisiblePosition-free functions for word and sentence
> > 
> > This patch changes Range::expand() to call VP-free version of word and
> > sentence start/end functions, by hoisting the creation of VP from
> > the functions into itself. In this way we reduce the usage of functions
> > relying on VP.
> > 
> > Bug: 657237
> > Change-Id: I56ea3cb88972144887eba7701cfdc3628bdbf67b
> > Reviewed-on: https://chromium-review.googlesource.com/c/1338719
> > Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
> > Reviewed-by: Kent Tamura <tkent@chromium.org>
> > Reviewed-by: Yoichi Osato <yoichio@chromium.org>
> > Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#608855}
> 
> TBR=yosin@chromium.org,tkent@chromium.org,yoichio@chromium.org,xiaochengh@chromium.org
> 
> Bug: 657237, 906174
> Change-Id: I46b8df3cfd8ed7f7636f9ef1dabfa350168cb820
> Reviewed-on: https://chromium-review.googlesource.com/c/1340906
> Reviewed-by: Ella Ge <eirage@chromium.org>
> Commit-Queue: Ella Ge <eirage@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#608957}

TBR=yosin@chromium.org,tkent@chromium.org,yoichio@chromium.org,xiaochengh@chromium.org,eirage@chromium.org

Change-Id: Iad61aa1c53fc7225f9795a1aa0e5ff9cc0704bc2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 657237, 906174
Reviewed-on: https://chromium-review.googlesource.com/c/1340837Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609043}
parent 9987bfb7
...@@ -1618,11 +1618,12 @@ void Range::expand(const String& unit, ExceptionState& exception_state) { ...@@ -1618,11 +1618,12 @@ void Range::expand(const String& unit, ExceptionState& exception_state) {
VisiblePosition start = CreateVisiblePosition(StartPosition()); VisiblePosition start = CreateVisiblePosition(StartPosition());
VisiblePosition end = CreateVisiblePosition(EndPosition()); VisiblePosition end = CreateVisiblePosition(EndPosition());
if (unit == "word") { if (unit == "word") {
start = StartOfWord(start); start = CreateVisiblePosition(StartOfWordPosition(start.DeepEquivalent()));
end = EndOfWord(end); end = CreateVisiblePosition(EndOfWordPosition(end.DeepEquivalent()));
} else if (unit == "sentence") { } else if (unit == "sentence") {
start = StartOfSentence(start); start =
end = EndOfSentence(end); CreateVisiblePosition(StartOfSentencePosition(start.DeepEquivalent()));
end = CreateVisiblePosition(EndOfSentence(end.DeepEquivalent()));
} else if (unit == "block") { } else if (unit == "block") {
start = StartOfParagraph(start); start = StartOfParagraph(start);
end = EndOfParagraph(end); end = EndOfParagraph(end);
......
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