Bug 228635 - Align implementation of PositionIterator::isCandidate() on Position::isCandidate()
Summary: Align implementation of PositionIterator::isCandidate() on Position::isCandid...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Frédéric Wang (:fredw)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-30 05:47 PDT by Frédéric Wang (:fredw)
Modified: 2021-08-03 13:23 PDT (History)
10 users (show)

See Also:


Attachments
Patch (5.43 KB, patch)
2021-07-30 06:02 PDT, Frédéric Wang (:fredw)
darin: review+
Details | Formatted Diff | Diff
Patch for landing (5.44 KB, patch)
2021-08-02 23:07 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2021-07-30 05:47:50 PDT
Follow-up of https://trac.webkit.org/changeset/280381/webkit

This can cause subtle bug, so we should avoid that they go out of sync.
Comment 1 Frédéric Wang (:fredw) 2021-07-30 06:02:49 PDT
Created attachment 434616 [details]
Patch
Comment 2 Frédéric Wang (:fredw) 2021-07-30 06:03:32 PDT
Comment on attachment 434616 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434616&action=review

> Source/WebCore/dom/Position.cpp:970
> +// This function should be keep in sync with PositionIterator::isCandidate().

kept*

> Source/WebCore/dom/PositionIterator.cpp:148
> +// This function should be keep in sync with Position::isCandidate().

kept*
Comment 3 Darin Adler 2021-08-02 10:05:28 PDT
Comment on attachment 434616 [details]
Patch

Seems like a good idea, and having no effect on any test is a mixed bag (is it really an improvement if it’s not detectable?).

Can we do a further improvement and make most of this be shared code, too?
Comment 4 Frédéric Wang (:fredw) 2021-08-02 23:07:00 PDT
Created attachment 434819 [details]
Patch for landing
Comment 5 Frédéric Wang (:fredw) 2021-08-02 23:14:00 PDT
(In reply to Darin Adler from comment #3)
> Seems like a good idea, and having no effect on any test is a mixed bag (is
> it really an improvement if it’s not detectable?).

Yeah, I considered writing tests but I'm not sure how difficult it is. For example in r280381 there was some subtle things happening and the crash test did not work without using a <button>. It seems more urgent to make the two functions in sync than having to spend time on testing that can be covered by fuzzing instead.

> Can we do a further improvement and make most of this be shared code, too?

OK, I opened bug 228729 for that. But again there are some subtle diffs when  m_anchorType is used, so I preferred not to touch that for now.
Comment 6 EWS 2021-08-02 23:54:12 PDT
Committed r280585 (240207@main): <https://commits.webkit.org/240207@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434819 [details].
Comment 7 Radar WebKit Bug Importer 2021-08-02 23:55:17 PDT
<rdar://problem/81447460>
Comment 8 Darin Adler 2021-08-03 13:23:05 PDT
(In reply to Frédéric Wang (:fredw) from comment #5)
> (In reply to Darin Adler from comment #3)
> > Seems like a good idea, and having no effect on any test is a mixed bag (is
> > it really an improvement if it’s not detectable?).
> 
> Yeah, I considered writing tests but I'm not sure how difficult it is. For
> example in r280381 there was some subtle things happening and the crash test
> did not work without using a <button>. It seems more urgent to make the two
> functions in sync than having to spend time on testing that can be covered
> by fuzzing instead.

Not sure that I agree. Where is the evidence that this is covered by fuzzing?

I think the tests may be *more* valuable than code changes that by making things more consistent *might* make things better.