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

Issue 2883163002: Un-insanify first-letter handling in TextIterator (to some degree) (Closed)

Created:
3 years, 7 months ago by Xiaocheng
Modified:
3 years, 7 months ago
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Un-insanify first-letter handling in TextIterator (to some degree) Background: (Once upon a time) TextIterator used to work on :first-letter in some cases, with several flawed designs magically cancelling each other's flaw. Recently, [1] fixed some flaw in TextIteratorTextState. However, it also built another level of hack over all the existing flawed designed in TextIterator, so that the class works in more cases. This patch removes the hack added by [1] and makes TextIterator work with :first-letter in an understandable way: 1. Fix the logic when TextIterator decides: - Whether text in :first-letter should be emitted; Existing implementation emits :first-letter only when |offset_ == 0|, which is wrong if the iteration starts in :first-letter.. - Whether the iteration should end in :first-letter; Existing implementation has no handling of this at all. 2. When advancing from a text node's :first-letter to remaining text, |offset_| should be set to the starting offset of the remaining text, instead of 0. 3. Fix the logic when dealing with DOM and layout offsets in a text node with :first-letter. When a text node has :first-letter, offsets in DOM and layout object differ by |TextStartOffset()|. HandleTextNode() and HandleTextBox() should be aware of and handle the difference at all time; Existing implementation has no handling of the difference at all. New unit tests have also been added for the correct behavior. This patch is also a preparation for abstracting the text box handling logic out of TextIterator. [1] crrev.com/5185769b9ba7e9239d68c7dc672a27dd19b1685f BUG=721957 TEST=TextIteratorTest.* Review-Url: https://codereview.chromium.org/2883163002 Cr-Commit-Position: refs/heads/master@{#472368} Committed: https://chromium.googlesource.com/chromium/src/+/d91d54ced7ed0c79f8140e232f4b6b80efb5921d

Patch Set 1 #

Patch Set 2 : Rebaseline #

Total comments: 2

Patch Set 3 : Tue May 16 16:31:00 PDT 2017 #

Total comments: 1

Messages

Total messages: 43 (32 generated)
Xiaocheng
dmazzoni@: Could you help me verify a behavioral change related AX? Thanks! https://codereview.chromium.org/2883163002/diff/20001/third_party/WebKit/LayoutTests/accessibility/first-letter-text-transform-causes-crash-expected.txt File third_party/WebKit/LayoutTests/accessibility/first-letter-text-transform-causes-crash-expected.txt ...
3 years, 7 months ago (2017-05-16 03:50:07 UTC) #17
Xiaocheng
yosin@: PTAL at this one since you approved the previous patch. Thanks!
3 years, 7 months ago (2017-05-16 06:08:30 UTC) #21
dmazzoni
lgtm https://codereview.chromium.org/2883163002/diff/20001/third_party/WebKit/LayoutTests/accessibility/first-letter-text-transform-causes-crash-expected.txt File third_party/WebKit/LayoutTests/accessibility/first-letter-text-transform-causes-crash-expected.txt (left): https://codereview.chromium.org/2883163002/diff/20001/third_party/WebKit/LayoutTests/accessibility/first-letter-text-transform-causes-crash-expected.txt#oldcode12 third_party/WebKit/LayoutTests/accessibility/first-letter-text-transform-causes-crash-expected.txt:12: AXRole: AXInlineTextBox "Dt" On 2017/05/16 03:50:06, Xiaocheng wrote: ...
3 years, 7 months ago (2017-05-16 16:01:15 UTC) #22
Xiaocheng
Slightly updated. Dead code related to trailing space collapsing will be done by another patch. ...
3 years, 7 months ago (2017-05-16 23:33:32 UTC) #26
yosin_UTC9
lgtm
3 years, 7 months ago (2017-05-17 01:10:18 UTC) #28
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/2883163002/40001
3 years, 7 months ago (2017-05-17 01:11:08 UTC) #32
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/456833)
3 years, 7 months ago (2017-05-17 03:10:50 UTC) #34
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/2883163002/40001
3 years, 7 months ago (2017-05-17 04:16:26 UTC) #36
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/456958)
3 years, 7 months ago (2017-05-17 05:53:48 UTC) #38
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/2883163002/40001
3 years, 7 months ago (2017-05-17 06:41:37 UTC) #40
commit-bot: I haz the power
3 years, 7 months ago (2017-05-17 07:25:13 UTC) #43
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/d91d54ced7ed0c79f8140e232f4b...

Powered by Google App Engine
This is Rietveld 408576698