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

Issue 2541163003: Fix TextIterator's behavior with first-letter (Closed)

Created:
4 years ago by Xiaocheng
Modified:
4 years ago
Reviewers:
tkent, yosin_UTC9
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix TextIterator's behavior with first-letter TextIterator's behavior with first-letter is broken: 1. If its starts in a text node with first-letter and the starting offset is non-zero, wrong text is passed to its text state. 2. When the text state is handling the remaining text of first-letter, it doesn't consider the length of first-letter, and hence, reports wrong offsets of the current text. To fix 2, this patch makes the text state remember the length of first-letter, and use it to adjust the output of start/endOffsetInCurrentContainer. To fix 1, given that the current behavior is correct when we start in a text node at offset 0 (even with first-letter), this patch performs a reduction that: - start iterating with offset 0 instead of the given start offset - have extra calls of |advance()| during initialization so that we have moved to the given start position when initialization ends - adjust text run start and end offsets when emitting text of the starting text node This patch partially corrects the behavior in two layout tests: - editing/selection/extend-by-word-002.html - editing/text-iterator/first-letter-word-boundary.html The tests are still failing for other reasons, see crbug.com/671104 This patch is not an ultimate fix of TextIterator's behavior with first-letter, but more like a first-aid hack built upon the current design. In the long term, we should rewrite TextIterator. BUG=647080 Committed: https://crrev.com/5185769b9ba7e9239d68c7dc672a27dd19b1685f Cr-Commit-Position: refs/heads/master@{#436255}

Patch Set 1 #

Patch Set 2 : Change relevant bug number #

Total comments: 7

Patch Set 3 : Thu Dec 1 19:08:08 JST 2016 #

Patch Set 4 : Mon Dec 5 15:41:31 JST 2016 #

Total comments: 8

Patch Set 5 : Mon Dec 5 18:00:48 JST 2016 #

Messages

Total messages: 40 (27 generated)
Xiaocheng
PTAL.
4 years ago (2016-12-01 09:18:27 UTC) #10
yosin_UTC9
C++ changes are fine. Could you improve layout tests? m(_ _)m https://codereview.chromium.org/2541163003/diff/20001/third_party/WebKit/LayoutTests/editing/selection/extend-by-word-002-expected.txt File third_party/WebKit/LayoutTests/editing/selection/extend-by-word-002-expected.txt (right): ...
4 years ago (2016-12-01 09:41:43 UTC) #11
Xiaocheng
I think it's better to convert the two tests in separate patches after this one ...
4 years ago (2016-12-01 10:09:56 UTC) #12
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/2541163003/60001
4 years ago (2016-12-05 06:47:39 UTC) #19
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started by full ...
4 years ago (2016-12-05 06:47:42 UTC) #21
Xiaocheng
PTAL, as yosin@ is OOO...
4 years ago (2016-12-05 08:23:34 UTC) #25
tkent
yosin@ already said "fine". So I reviewed only cosmetic stuff of the code. https://codereview.chromium.org/2541163003/diff/60001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp File ...
4 years ago (2016-12-05 08:42:47 UTC) #26
Xiaocheng
https://codereview.chromium.org/2541163003/diff/60001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp File third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp (right): https://codereview.chromium.org/2541163003/diff/60001/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp#newcode1208 third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp:1208: Node* textNode, On 2016/12/05 at 08:42:47, tkent wrote: > ...
4 years ago (2016-12-05 09:02:43 UTC) #31
tkent
rs lgtm
4 years ago (2016-12-05 09:04:19 UTC) #32
Xiaocheng
Thanks for the review!
4 years ago (2016-12-05 09:07:48 UTC) #35
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/2541163003/80001
4 years ago (2016-12-05 09:08:05 UTC) #36
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years ago (2016-12-05 10:39:31 UTC) #38
commit-bot: I haz the power
4 years ago (2016-12-05 10:43:14 UTC) #40
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/5185769b9ba7e9239d68c7dc672a27dd19b1685f
Cr-Commit-Position: refs/heads/master@{#436255}

Powered by Google App Engine
This is Rietveld 408576698