RESOLVED FIXED 235692
Add support for decorating and scrolling to ranges in WebFoundTextRangeController
https://bugs.webkit.org/show_bug.cgi?id=235692
Summary Add support for decorating and scrolling to ranges in WebFoundTextRangeContro...
Aditya Keerthi
Reported 2022-01-26 23:39:27 PST
...
Attachments
Patch (14.49 KB, patch)
2022-01-27 11:57 PST, Aditya Keerthi
no flags
Patch (14.49 KB, patch)
2022-01-27 23:42 PST, Aditya Keerthi
no flags
Patch (16.25 KB, patch)
2022-01-28 10:28 PST, Aditya Keerthi
wenson_hsieh: review+
ews-feeder: commit-queue-
Patch for landing (16.08 KB, patch)
2022-01-28 11:50 PST, Aditya Keerthi
no flags
Aditya Keerthi
Comment 1 2022-01-26 23:39:44 PST
Aditya Keerthi
Comment 2 2022-01-27 11:57:07 PST
Aditya Keerthi
Comment 3 2022-01-27 23:42:06 PST
Aditya Keerthi
Comment 4 2022-01-28 10:28:38 PST
Wenson Hsieh
Comment 5 2022-01-28 11:11:35 PST
Comment on attachment 450251 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450251&action=review > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:109 > + if (style == FindDecorationStyle::Normal) { > + simpleRange->start.document().markers().removeMarkers(*simpleRange, WebCore::DocumentMarker::TextMatch); > + } else if (style == FindDecorationStyle::Found) { > + simpleRange->start.document().markers().addMarker(*simpleRange, WebCore::DocumentMarker::TextMatch); > + } else if (style == FindDecorationStyle::Highlighted) { I think the { } here around single-line if statements should be omitted (unless that rule has changed recently?) > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:136 > + OptionSet<WebCore::TemporarySelectionOption> temporarySelectionOptions { WebCore::TemporarySelectionOption::DelegateMainFrameScroll, WebCore::TemporarySelectionOption::RevealSelectionBounds }; Nit - can you replace "OptionSet<WebCore::TemporarySelectionOption>" with just OptionSet? (I think that type deduction should be sufficient to infer the type here) > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:259 > + auto* mainFrameView = m_webPage->corePage()->mainFrame().view(); I think we should be protecting these with RefPtr (especially since the logic below involves more than just simple getters) > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:288 > + for (auto* frame = m_webPage->corePage()->mainFrame().document()->topDocument().frame(); frame; frame = frame->tree().traverseNext()) { > + if (frame->tree().uniqueName() == range.frameIdentifier) > + return frame->document(); > + } Can we simplify this logic a bit using `FrameTree::find()`?
Aditya Keerthi
Comment 6 2022-01-28 11:50:16 PST
Created attachment 450263 [details] Patch for landing
Aditya Keerthi
Comment 7 2022-01-28 11:52:30 PST
(In reply to Wenson Hsieh from comment #5) > Comment on attachment 450251 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=450251&action=review Thanks for the review! > > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:109 > > + if (style == FindDecorationStyle::Normal) { > > + simpleRange->start.document().markers().removeMarkers(*simpleRange, WebCore::DocumentMarker::TextMatch); > > + } else if (style == FindDecorationStyle::Found) { > > + simpleRange->start.document().markers().addMarker(*simpleRange, WebCore::DocumentMarker::TextMatch); > > + } else if (style == FindDecorationStyle::Highlighted) { > > I think the { } here around single-line if statements should be omitted > (unless that rule has changed recently?) Removed { }. > > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:136 > > + OptionSet<WebCore::TemporarySelectionOption> temporarySelectionOptions { WebCore::TemporarySelectionOption::DelegateMainFrameScroll, WebCore::TemporarySelectionOption::RevealSelectionBounds }; > > Nit - can you replace "OptionSet<WebCore::TemporarySelectionOption>" with > just OptionSet? (I think that type deduction should be sufficient to infer > the type here) Type deduction worked. Updated another OptionSet in this patch too. > > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:259 > > + auto* mainFrameView = m_webPage->corePage()->mainFrame().view(); > > I think we should be protecting these with RefPtr (especially since the > logic below involves more than just simple getters) Done! > > Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:288 > > + for (auto* frame = m_webPage->corePage()->mainFrame().document()->topDocument().frame(); frame; frame = frame->tree().traverseNext()) { > > + if (frame->tree().uniqueName() == range.frameIdentifier) > > + return frame->document(); > > + } > > Can we simplify this logic a bit using `FrameTree::find()`? Replaced this logic with `FrameTree::find()`.
EWS
Comment 8 2022-01-28 13:47:39 PST
Committed r288760 (246548@main): <https://commits.webkit.org/246548@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 450263 [details].
Note You need to log in before you can comment on or make changes to this bug.