Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Issue 2832123002: Do not count extra trailing space for the last word in a range (Closed)

Created:
3 years, 8 months ago by Tima Vaisburd
Modified:
3 years, 7 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, boliu, chromium-reviews, dglazkov+blink, eae+blinkwatch, rlanday, rwlbuis, sgurun-gerrit only, sof, Theresa
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Do not count extra trailing space for the last word in a range Sometimes when a text selection ends with the last word on a line (for instance when just one word is selected) the generated text for the selection range contains an extra trailing space. This happens when a text node is split into several InlineTextBoxes (e.g. a <span> inside a narrow table) and the last selected word happens to be the last one in such text box. The TextIterator algorithm restores the spaces between the text boxes and will add a trailing space for this word. For the SurroundingText, however, we need the length that corresponds to the visible selection. This CL introduces a new text iterator behavior that prevents that extra space to be added. This behavior is used in combination with DefaultRangeLengthBehavior() for the selection range calculation in the SurroundingText. BUG=708329 Review-Url: https://codereview.chromium.org/2832123002 Cr-Commit-Position: refs/heads/master@{#467538} Committed: https://chromium.googlesource.com/chromium/src/+/9305554380ee3a02c680009b5dee4b9e82cba334

Patch Set 1 #

Total comments: 2

Patch Set 2 : Removed behavior check #

Patch Set 3 : Rebased #

Patch Set 4 : Added a new behavior, modified RangeLength() instead of GetText() #

Total comments: 11

Patch Set 5 : Renamed behavior and fixed the test #

Total comments: 1

Patch Set 6 : Rebased for behavior parameter in RangeLength() #

Patch Set 7 : Rebased #

Patch Set 8 : getElementById #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -10 lines) Patch
M third_party/WebKit/Source/core/editing/SurroundingText.cpp View 1 2 3 4 5 1 chunk +6 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorBehavior.h View 1 2 3 4 5 6 3 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorBehavior.cpp View 1 2 3 4 5 6 4 chunks +20 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp View 1 2 3 4 5 6 7 1 chunk +28 lines, -0 lines 0 comments Download

Messages

Total messages: 57 (37 generated)
Tima Vaisburd
This fix is needed for the Smart Text selection feature in Android. PTAL. https://codereview.chromium.org/2832123002/diff/1/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp File ...
3 years, 8 months ago (2017-04-21 02:16:14 UTC) #4
rlanday
https://codereview.chromium.org/2832123002/diff/1/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp File third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp (right): https://codereview.chromium.org/2832123002/diff/1/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp#newcode788 third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp:788: if (behavior_.CollapseTrailingSpace()) { On 2017/04/21 at 02:16:14, Tima Vaisburd ...
3 years, 8 months ago (2017-04-21 03:20:05 UTC) #8
Tima Vaisburd
On 2017/04/21 03:20:05, rlanday wrote: > I suspect the problem is that Position doesn't specify ...
3 years, 8 months ago (2017-04-21 20:19:29 UTC) #13
Tima Vaisburd
On 2017/04/21 20:19:29, Tima Vaisburd wrote: > On 2017/04/21 03:20:05, rlanday wrote: > > > ...
3 years, 8 months ago (2017-04-21 23:16:27 UTC) #21
Tima Vaisburd
I fixed the e-mail address for Yoshifumi, please accept my apology in case you did ...
3 years, 8 months ago (2017-04-22 02:41:09 UTC) #26
Tima Vaisburd
> Would VisiblePosition help me in calculation of the proper > selected text length? Answering ...
3 years, 8 months ago (2017-04-22 02:47:35 UTC) #27
yosin_UTC9
https://codereview.chromium.org/2832123002/diff/80001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp File third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp (right): https://codereview.chromium.org/2832123002/diff/80001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp#newcode787 third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp:787: if (behavior_.ForVisibleSelection()) { Could you pick up another name? ...
3 years, 8 months ago (2017-04-24 03:42:48 UTC) #30
Tima Vaisburd
https://codereview.chromium.org/2832123002/diff/80001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp File third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp (right): https://codereview.chromium.org/2832123002/diff/80001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp#newcode787 third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp:787: if (behavior_.ForVisibleSelection()) { On 2017/04/24 03:42:48, yosin_UTC9 wrote: > ...
3 years, 7 months ago (2017-04-24 20:14:55 UTC) #32
yosin_UTC9
https://codereview.chromium.org/2832123002/diff/100001/third_party/WebKit/Source/core/editing/iterators/TextIterator.h File third_party/WebKit/Source/core/editing/iterators/TextIterator.h (right): https://codereview.chromium.org/2832123002/diff/100001/third_party/WebKit/Source/core/editing/iterators/TextIterator.h#newcode113 third_party/WebKit/Source/core/editing/iterators/TextIterator.h:113: bool for_visible_selection = false); Sorry, I misunderstanding this change. ...
3 years, 7 months ago (2017-04-25 02:09:12 UTC) #36
Tima Vaisburd
On 2017/04/25 02:09:12, yosin_UTC9 wrote: > https://codereview.chromium.org/2832123002/diff/100001/third_party/WebKit/Source/core/editing/iterators/TextIterator.h > File third_party/WebKit/Source/core/editing/iterators/TextIterator.h (right): > > https://codereview.chromium.org/2832123002/diff/100001/third_party/WebKit/Source/core/editing/iterators/TextIterator.h#newcode113 > ...
3 years, 7 months ago (2017-04-25 02:53:16 UTC) #37
Tima Vaisburd
On 2017/04/25 02:53:16, Tima Vaisburd wrote: > Sorry, two patches: would you like to see ...
3 years, 7 months ago (2017-04-25 02:55:25 UTC) #38
yosin_UTC9
On 2017/04/25 at 02:55:25, timav wrote: > On 2017/04/25 02:53:16, Tima Vaisburd wrote: > > ...
3 years, 7 months ago (2017-04-25 06:28:09 UTC) #39
Tima Vaisburd
On 2017/04/25 06:28:09, yosin_UTC9 wrote: > On 2017/04/25 at 02:55:25, timav wrote: > > On ...
3 years, 7 months ago (2017-04-26 05:44:42 UTC) #41
yosin_UTC9
lgtm
3 years, 7 months ago (2017-04-26 06:34:40 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2832123002/140001
3 years, 7 months ago (2017-04-26 21:49:49 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/439584)
3 years, 7 months ago (2017-04-26 22:07:59 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2832123002/160001
3 years, 7 months ago (2017-04-26 22:17:46 UTC) #50
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/440030)
3 years, 7 months ago (2017-04-27 00:09:20 UTC) #52
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2832123002/160001
3 years, 7 months ago (2017-04-27 00:22:55 UTC) #54
commit-bot: I haz the power
3 years, 7 months ago (2017-04-27 01:20:25 UTC) #57
Message was sent while issue was closed.
Committed patchset #8 (id:160001) as
https://chromium.googlesource.com/chromium/src/+/9305554380ee3a02c680009b5dee...

Powered by Google App Engine
This is Rietveld 408576698