Summary: | Add support for decorating and scrolling to ranges in WebFoundTextRangeController | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Aditya Keerthi <akeerthi> | ||||||||||
Component: | New Bugs | Assignee: | Aditya Keerthi <akeerthi> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | hi, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh | ||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||
Version: | Other | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Bug Depends on: | 235691 | ||||||||||||
Bug Blocks: | 235830 | ||||||||||||
Attachments: |
|
Description
Aditya Keerthi
2022-01-26 23:39:27 PST
Created attachment 450163 [details]
Patch
Created attachment 450209 [details]
Patch
Created attachment 450251 [details]
Patch
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()`? Created attachment 450263 [details]
Patch for landing
(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()`. 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]. |