Bug 218544

Summary: Remove more functions that implicitly use composed tree
Product: WebKit Reporter: Darin Adler <darin>
Component: DOMAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: ajuma, cdumez, changseok, esprehn+autocc, ews-watchlist, glenn, kangil.han, kondapallykalyan, mifenton, pdr, rniwa, sam, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 218424    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch rniwa: review+

Description Darin Adler 2020-11-03 16:21:39 PST
Remove more functions that implicitly use composed tree
Comment 1 Darin Adler 2020-11-03 16:41:02 PST
Created attachment 413121 [details]
Patch
Comment 2 Darin Adler 2020-11-03 16:45:26 PST
Created attachment 413124 [details]
Patch
Comment 3 Darin Adler 2020-11-03 17:26:58 PST
Comment on attachment 413124 [details]
Patch

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

> Source/WebCore/editing/VisiblePosition.cpp:828
> +    auto midpoint = checkedSum<uint64_t>(characterRange.location, characterRange.length / 2);
> +    if (midpoint.hasOverflowed())
> +        return { };

Since these are actual computed sizes of a document already in memory, I don’t see any way we’d actually need checked arithmetic, so this should probably be changed to normal arithmetic.
Comment 4 Darin Adler 2020-11-04 11:37:32 PST
(In reply to Darin Adler from comment #3)
> Since these are actual computed sizes of a document already in memory, I
> don’t see any way we’d actually need checked arithmetic, so this should
> probably be changed to normal arithmetic.

Or I can write a separate midpoint function that takes a CharacterRange, and clamps end to the maximum value of uint64_t rather than treating it as an error. Should be safe/practical for our uses.
Comment 5 Darin Adler 2020-11-05 09:36:37 PST
Committed r269442: <https://trac.webkit.org/changeset/269442>
Comment 6 Radar WebKit Bug Importer 2020-11-05 09:37:38 PST
<rdar://problem/71081440>
Comment 7 Ryosuke Niwa 2021-04-07 19:27:28 PDT
*** Bug 217313 has been marked as a duplicate of this bug. ***