Bug 210369 - Move more from live range to SimpleRange: callers of absoluteTextRects
Summary: Move more from live range to SimpleRange: callers of absoluteTextRects
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-10 19:43 PDT by Darin Adler
Modified: 2020-04-11 12:37 PDT (History)
11 users (show)

See Also:


Attachments
Patch (36.58 KB, patch)
2020-04-11 08:39 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (36.81 KB, patch)
2020-04-11 10:44 PDT, Darin Adler
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2020-04-10 19:43:08 PDT
Move more from live range to SimpleRange: callers of absoluteTextRects
Comment 1 Darin Adler 2020-04-11 08:39:35 PDT
Created attachment 396164 [details]
Patch
Comment 2 Anders Carlsson 2020-04-11 08:48:52 PDT
Comment on attachment 396164 [details]
Patch

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

> Source/WebCore/dom/Range.cpp:-1183
> -void Range::absoluteTextRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFixedPosition* inFixed, OptionSet<BoundingRectBehavior> rectOptions) const

I would change this to return the rects instead of using an out parameter.

> Source/WebCore/html/HTMLTextFormControlElement.cpp:463
> +        return { { { *innerText, 0 }, { *innerText, 0 } } };

Maybe specify SimpleRange here to cut down on some of the curly braces.

> Source/WebCore/html/HTMLTextFormControlElement.cpp:488
> +    return { { { *startNode, start }, { *endNode, end } } };

Maybe specify SimpleRange here to cut down on some of the curly braces.

> Source/WebCore/rendering/RenderObject.cpp:1904
> +        else if (is<RenderText>(renderer)) {

I assume is<RenderText> will return false here if renderer is null?

> Source/WebKitLegacy/mac/WebView/WebFrame.mm:1114
> +    return range ? [range textRects] : @[];

range.textRects?
Comment 3 Darin Adler 2020-04-11 10:01:26 PDT
Comment on attachment 396164 [details]
Patch

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

Looks like build failures are because WebFrame.mm needs to include DOM.h.

>> Source/WebCore/dom/Range.cpp:-1183
>> -void Range::absoluteTextRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFixedPosition* inFixed, OptionSet<BoundingRectBehavior> rectOptions) const
> 
> I would change this to return the rects instead of using an out parameter.

Yes, agreed. I would do that if I was planning to keep this. But I am planning to delete it. I only removed the argument as a prelude to removing the entire function soon.

>> Source/WebCore/html/HTMLTextFormControlElement.cpp:463
>> +        return { { { *innerText, 0 }, { *innerText, 0 } } };
> 
> Maybe specify SimpleRange here to cut down on some of the curly braces.

I’d be willing to do that. Not sure it’s better. If you are sure, I will do it. It allows me to remove the outer set.

>> Source/WebCore/html/HTMLTextFormControlElement.cpp:488
>> +    return { { { *startNode, start }, { *endNode, end } } };
> 
> Maybe specify SimpleRange here to cut down on some of the curly braces.

Ditto.

>> Source/WebCore/rendering/RenderObject.cpp:1904
>> +        else if (is<RenderText>(renderer)) {
> 
> I assume is<RenderText> will return false here if renderer is null?

Yes.

>> Source/WebKitLegacy/mac/WebView/WebFrame.mm:1114
>> +    return range ? [range textRects] : @[];
> 
> range.textRects?

Will do.
Comment 4 Darin Adler 2020-04-11 10:44:38 PDT
Created attachment 396174 [details]
Patch
Comment 5 Darin Adler 2020-04-11 10:44:54 PDT
Anders, you didn’t set review+. Did you mean to?
Comment 6 Anders Carlsson 2020-04-11 12:12:23 PDT
(In reply to Darin Adler from comment #5)
> Anders, you didn’t set review+. Did you mean to?

I wanted to wait until everything was green!
Comment 7 Darin Adler 2020-04-11 12:36:50 PDT
Committed r259933: <https://trac.webkit.org/changeset/259933>
Comment 8 Radar WebKit Bug Importer 2020-04-11 12:37:16 PDT
<rdar://problem/61644860>