WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
211058
Replace more uses of live ranges with SimpleRange
https://bugs.webkit.org/show_bug.cgi?id=211058
Summary
Replace more uses of live ranges with SimpleRange
Darin Adler
Reported
2020-04-26 17:37:15 PDT
Replace more uses of live ranges with SimpleRange
Attachments
Patch
(115.46 KB, patch)
2020-04-26 17:57 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(115.42 KB, patch)
2020-04-26 17:59 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(118.10 KB, patch)
2020-04-26 22:02 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(117.53 KB, patch)
2020-04-26 22:35 PDT
,
Darin Adler
koivisto
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2020-04-26 17:57:24 PDT
Comment hidden (obsolete)
Created
attachment 397639
[details]
Patch
Darin Adler
Comment 2
2020-04-26 17:59:39 PDT
Comment hidden (obsolete)
Created
attachment 397640
[details]
Patch
Darin Adler
Comment 3
2020-04-26 22:02:00 PDT
Comment hidden (obsolete)
Created
attachment 397644
[details]
Patch
Darin Adler
Comment 4
2020-04-26 22:35:41 PDT
Created
attachment 397645
[details]
Patch
Darin Adler
Comment 5
2020-04-26 22:37:57 PDT
Reducing live ranges is going to take a while, it seems. Might decide to set a breakpoint and prioritize paths that are called during normal webpage loads next. For this patch I just searched for instances of Range::create and then followed up with whatever changes were needed to make them go away.
Antti Koivisto
Comment 6
2020-04-27 00:11:23 PDT
Comment on
attachment 397645
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=397645&action=review
> Source/WebCore/dom/Node.cpp:2624 > +RefPtr<Node> commonInclusiveAncestor(Node& a, Node& b) > +{ > + for (auto ancestorA = &a; ancestorA; ancestorA = ancestorA->parentNode()) { > + for (auto ancestorB = &b; ancestorB; ancestorB = ancestorB->parentNode()) { > + if (ancestorA == ancestorB) > + return ancestorA; > + } > + } > + return nullptr; > +}
This is a pretty inefficient implementation (I know it is not new in this patch).
> Source/WebCore/editing/VisibleSelection.cpp:210 > + if (!scope) > + return WTF::nullopt;
I would just return { };
> Source/WebCore/editing/cocoa/DataDetection.h:52 > +enum class DataDetectorTypes : uint32_t { > + None = 0, > + PhoneNumber = 1 << 0, > + Link = 1 << 1, > + Address = 1 << 2, > + CalendarEvent = 1 << 3, > + TrackingNumber = 1 << 4, > + FlightNumber = 1 << 5, > + LookupSuggestion = 1 << 6, > +};
Simon would tell you to line these up.
Darin Adler
Comment 7
2020-04-27 07:21:05 PDT
Comment on
attachment 397645
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=397645&action=review
>> Source/WebCore/dom/Node.cpp:2624 >> +} > > This is a pretty inefficient implementation (I know it is not new in this patch).
Yes definitely. I noticed that, too. Do you have ideas for a better one? I didn’t immediately think of one.
>> Source/WebCore/editing/VisibleSelection.cpp:210 >> + return WTF::nullopt; > > I would just return { };
That does seem appealing. Although I have checked in a lot of “return nullopt” in patches recently.
Darin Adler
Comment 8
2020-04-27 07:25:06 PDT
Comment on
attachment 397645
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=397645&action=review
>>> Source/WebCore/dom/Node.cpp:2624 >>> +} >> >> This is a pretty inefficient implementation (I know it is not new in this patch). > > Yes definitely. I noticed that, too. Do you have ideas for a better one? I didn’t immediately think of one.
I looked at
https://en.wikipedia.org/wiki/Lowest_common_ancestor
and did not immediately find something useful.
Darin Adler
Comment 9
2020-04-27 07:31:29 PDT
Maybe one trip each to find the roots and distance to the root, return null if the roots are different, then walk up both at the same time, keeping distance from root constant.
Darin Adler
Comment 10
2020-04-27 07:53:54 PDT
Comment on
attachment 397645
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=397645&action=review
>>>> Source/WebCore/dom/Node.cpp:2624 >>>> +} >>> >>> This is a pretty inefficient implementation (I know it is not new in this patch). >> >> Yes definitely. I noticed that, too. Do you have ideas for a better one? I didn’t immediately think of one. > > I looked at
https://en.wikipedia.org/wiki/Lowest_common_ancestor
and did not immediately find something useful.
I’m going to fix this in a follow-up patch now that I figured out how.
>>> Source/WebCore/editing/VisibleSelection.cpp:210 >>> + return WTF::nullopt; >> >> I would just return { }; > > That does seem appealing. Although I have checked in a lot of “return nullopt” in patches recently.
Will do this before landing.
>> Source/WebCore/editing/cocoa/DataDetection.h:52 >> +}; > > Simon would tell you to line these up.
Not sure how to resolve this minor code style disagreement.
Darin Adler
Comment 11
2020-04-27 08:05:13 PDT
Committed
r260753
: <
https://trac.webkit.org/changeset/260753
>
Radar WebKit Bug Importer
Comment 12
2020-04-27 08:06:15 PDT
<
rdar://problem/62452499
>
Darin Adler
Comment 13
2020-04-27 08:25:27 PDT
Comment on
attachment 397645
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=397645&action=review
>>>>> Source/WebCore/dom/Node.cpp:2624 >>>>> +} >>>> >>>> This is a pretty inefficient implementation (I know it is not new in this patch). >>> >>> Yes definitely. I noticed that, too. Do you have ideas for a better one? I didn’t immediately think of one. >> >> I looked at
https://en.wikipedia.org/wiki/Lowest_common_ancestor
and did not immediately find something useful. > > I’m going to fix this in a follow-up patch now that I figured out how.
Bug 211078
.
Antti Koivisto
Comment 14
2020-04-27 09:14:23 PDT
> That does seem appealing. Although I have checked in a lot of “return > nullopt” in patches recently.
I know and think both approaches are fine.
Darin Adler
Comment 15
2020-05-06 11:56:13 PDT
Comment on
attachment 397645
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=397645&action=review
> Source/WebCore/page/TextIndicator.cpp:200 > - auto* node = iterator.node(); > - if (!is<Text>(node) || !is<RenderText>(node->renderer())) > - continue; > - > - colors.add(node->renderer()->style().color()); > + auto renderer = iterator.node()->renderer(); > + if (is<RenderText>(renderer)) > + colors.add(renderer->style().color());
This change accidentally removed the null check done by is<Text>(node). We don’t need and is<Text> check, but we do need a null check.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug