WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 219769
Infrastructure to store and restore AppHighlights
https://bugs.webkit.org/show_bug.cgi?id=219769
Summary
Infrastructure to store and restore AppHighlights
Megan Gardner
Reported
2020-12-10 23:07:44 PST
Infrustructure to store and restore AppHighlights
Attachments
Patch
(37.15 KB, patch)
2020-12-10 23:17 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(36.81 KB, patch)
2020-12-11 17:00 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch for landing
(36.81 KB, patch)
2020-12-11 18:22 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Megan Gardner
Comment 1
2020-12-10 23:17:27 PST
Created
attachment 415971
[details]
Patch
Tim Horton
Comment 2
2020-12-11 15:34:32 PST
Comment on
attachment 415971
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=415971&action=review
> Source/WebCore/Modules/highlight/AppHighlightStorageController.cpp:172 > + if (m_document) {
Early return instead?
> Source/WebCore/Modules/highlight/AppHighlightStorageController.cpp:190 > +
Weird double newline. Also, the early return thing. Also, maybe you want to strong-ify document in each of these before checking it? Is it possible any of the things you do cause the last ref to drop? It vaguely looks like "probably not" but the set of things happening under these might be wider than it first appears.
> Source/WebCore/dom/Document.h:97 > +class AppHighlightStorageController;
This name is kind of wordy. Do we need "controller" at all, really?
Wenson Hsieh
Comment 3
2020-12-11 15:45:12 PST
Comment on
attachment 415971
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=415971&action=review
> Source/WebCore/Modules/highlight/AppHighlightStorageController.h:49 > +
Nit - extra newline here.
Wenson Hsieh
Comment 4
2020-12-11 15:50:33 PST
Comment on
attachment 415971
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=415971&action=review
>> Source/WebCore/Modules/highlight/AppHighlightStorageController.cpp:190 >> + > > Weird double newline. Also, the early return thing. > Also, maybe you want to strong-ify document in each of these before checking it? Is it possible any of the things you do cause the last ref to drop? It vaguely looks like "probably not" but the set of things happening under these might be wider than it first appears.
Good catch — findRangeBySearchingText() is going to do TextIterator-y (and VisiblePosition-y) things which can trigger layout, so we need to be careful here.
Wenson Hsieh
Comment 5
2020-12-11 15:51:20 PST
Comment on
attachment 415971
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=415971&action=review
> Source/WebCore/Modules/highlight/AppHighlightListData.h:107 > +
(Nit - extra newline here as well)
Devin Rousso
Comment 6
2020-12-11 16:14:42 PST
Comment on
attachment 415971
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=415971&action=review
> Source/WebCore/Modules/highlight/AppHighlightListData.cpp:56 > + is<Element>(node) ? downcast<Element>(node).getIdAttribute().string() : String { },
`nullString()`?
> Source/WebCore/Modules/highlight/AppHighlightStorageController.cpp:134 > + for (auto iterator = range.endContainer().rbegin(), end = range.endContainer().rend(); iterator != end; ++iterator) {
Should one of these be `startContainer()`? If not, maybe worth a comment as to why?
> Source/WebCore/Modules/highlight/AppHighlightStorageController.cpp:188 > + Vector<AppHighlightRangeData> restoredRanges;
Is this variable needed? All you ever seem to do is append to it.
> Source/WebCore/Modules/highlight/AppHighlightStorageController.h:40 > + WTF_MAKE_FAST_ALLOCATED;
NIT: `WTF_MAKE_NONCOPYABLE` too? In my experience if one is added usually the other is too (especially for `RefCounted`).
> Source/WebCore/dom/Document.h:1585 > + AppHighlightStorageController* appHighlightStorageControllerIfExists() const { return m_appHighlightStorageController.get(); };
NIT: This is never used. I realize the style guide suggests to create an `*IfExists` method, but I don't think it meant that as "you must create an `*IfExists` if there is another function without it".
Megan Gardner
Comment 7
2020-12-11 17:00:03 PST
Created
attachment 416072
[details]
Patch
Megan Gardner
Comment 8
2020-12-11 18:22:18 PST
Created
attachment 416082
[details]
Patch for landing
EWS
Comment 9
2020-12-11 19:20:07 PST
Committed
r270729
: <
https://trac.webkit.org/changeset/270729
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 416082
[details]
.
Radar WebKit Bug Importer
Comment 10
2020-12-11 19:21:19 PST
<
rdar://problem/72248110
>
Wenson Hsieh
Comment 11
2020-12-12 08:19:54 PST
Comment on
attachment 415971
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=415971&action=review
>> Source/WebCore/Modules/highlight/AppHighlightStorageController.cpp:134 >> + for (auto iterator = range.endContainer().rbegin(), end = range.endContainer().rend(); iterator != end; ++iterator) { > > Should one of these be `startContainer()`? If not, maybe worth a comment as to why?
Both of these should be endContainer(). This code is trying to find the deepest common ancestor in the XPath that has an ID attribute, so we iterate backwards through the end container's XPath here and bail when we find the first match. I think a comment might be good, or perhaps `foundElement` should be named something more descriptive, like `deepestCommonIdentifiableAncestor`
Don Olmstead
Comment 12
2020-12-13 08:56:23 PST
Follow up to fix non-unified builds after this patch is at
https://bugs.webkit.org/show_bug.cgi?id=219834
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