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

Issue 2746153008: Fix bug causing TextIterator to duplicate leading spaces (Closed)

Created:
3 years, 9 months ago by rlanday
Modified:
3 years, 9 months ago
Reviewers:
yoichio, *yosin_UTC9
CC:
blink-reviews, chromium-reviews, joone, yoichio
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix bug causing TextIterator to duplicate leading spaces I ran into a TextIterator bug causing spaces at the beginning of a line occuring immediately after another element to be duplicated. If you're iterating over ranges, you get a range containing just the space, and then a range containing the space together with the rest of the line, and if you call plainText() on a range to get the text, the space occurs twice in the output. The bug occurs because the line break gets output as one space, and then the actual space at the beginning of the line is supposed to be skipped over. The method restoreCollapsedLeadingSpace() is called, which incorrectly causes TextIterator to output the real space in addition to the space from the line break. It appears this method was originally added to fix a text copying bug. Text copying does use the plainText() function, but does not exhibit the bug because it sets the emitsImageAltText behavior, and this method immediately returns if that flag is set. It appears that the correct fix is to remove this method. It may have been necessary at some point but now it just appears to be introducing this bug. I took out this method and re-ran all the webkit_unit_tests and blink layout tests, and the only test that failed was one with a TODO saying to fix the behavior. So my change actually fixes another bug there. Additionally, I think the change in https://codereview.chromium.org/2723913002 is just a workaround for this bug and is no longer necessary, so I'm reverting it. I don't understand it super well though so I could be wrong. BUG=697654 Review-Url: https://codereview.chromium.org/2746153008 Cr-Commit-Position: refs/heads/master@{#458365} Committed: https://chromium.googlesource.com/chromium/src/+/477e319330d3ad4eccfb32fbd5c7d28a75c6d7e3

Patch Set 1 #

Patch Set 2 : also remove method definition from header #

Total comments: 2

Patch Set 3 : Remove obsolete comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -35 lines) Patch
M third_party/WebKit/Source/core/editing/FrameSelection.cpp View 1 2 1 chunk +1 line, -10 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIterator.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp View 1 2 2 chunks +0 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp View 1 chunk +10 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 25 (19 generated)
rlanday
3 years, 9 months ago (2017-03-16 04:07:14 UTC) #9
yoichio
lgtm Cool! https://codereview.chromium.org/2746153008/diff/20001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2746153008/diff/20001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode1042 third_party/WebKit/Source/core/editing/FrameSelection.cpp:1042: // Then we don't need |hasNonSeparatorCharacter|. Please ...
3 years, 9 months ago (2017-03-16 05:41:14 UTC) #13
rlanday
https://codereview.chromium.org/2746153008/diff/20001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2746153008/diff/20001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode1042 third_party/WebKit/Source/core/editing/FrameSelection.cpp:1042: // Then we don't need |hasNonSeparatorCharacter|. On 2017/03/16 at ...
3 years, 9 months ago (2017-03-16 16:40:17 UTC) #16
yosin_UTC9
lgtm Thanks for better solution!
3 years, 9 months ago (2017-03-21 09:08:06 UTC) #19
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/2746153008/40001
3 years, 9 months ago (2017-03-21 09:08:27 UTC) #22
commit-bot: I haz the power
3 years, 9 months ago (2017-03-21 10:31:22 UTC) #25
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/477e319330d3ad4eccfb32fbd5c7...

Powered by Google App Engine
This is Rietveld 408576698