RESOLVED FIXED 226731
Factor MarkedText collection out of LegacyInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=226731
Summary Factor MarkedText collection out of LegacyInlineTextBox
Antti Koivisto
Reported 2021-06-07 09:00:11 PDT
less legacy
Attachments
patch (35.03 KB, patch)
2021-06-07 09:07 PDT, Antti Koivisto
no flags
Patch for landing (1.10 KB, patch)
2021-06-08 12:46 PDT, Michael Catanzaro
no flags
Antti Koivisto
Comment 1 2021-06-07 09:07:42 PDT
Sam Weinig
Comment 2 2021-06-08 07:40:24 PDT
Comment on attachment 430753 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=430753&action=review > Source/WebCore/rendering/LegacyInlineTextBox.cpp:498 > + Vector<MarkedText> markedTexts; > + markedTexts.appendVector(MarkedText::collectForDocumentMarkers(renderer(), selectableRange, MarkedText::PaintPhase::Background)); > + markedTexts.appendVector(MarkedText::collectForHighlights(renderer(), parent()->renderer(), selectableRange, MarkedText::PaintPhase::Background)); This would be slightly more efficient if you did this as: auto markedTexts = MarkedText::collectForDocumentMarkers(renderer(), selectableRange, MarkedText::PaintPhase::Background); markedTexts.appendVector(MarkedText::collectForHighlights(renderer(), parent()->renderer(), selectableRange, MarkedText::PaintPhase::Background)); though I do like the symmetry in your version. > Source/WebCore/rendering/LegacyInlineTextBox.cpp:671 > + auto markedTexts = MarkedText::collectForDocumentMarkers(renderer(), selectableRange(), MarkedText::PaintPhase::Decoration); > + for (auto& markedText : MarkedText::subdivide(markedTexts, MarkedText::OverlapStrategy::Frontmost)) I wonder if it would make sense at some point to make collectForDocumentMarkers take a functor that does the subdivide rather than allocating the vector then subdividing.
Antti Koivisto
Comment 3 2021-06-08 07:48:59 PDT
> This would be slightly more efficient if you did this as: > > auto markedTexts = MarkedText::collectForDocumentMarkers(renderer(), > selectableRange, MarkedText::PaintPhase::Background); > markedTexts.appendVector(MarkedText::collectForHighlights(renderer(), > parent()->renderer(), selectableRange, MarkedText::PaintPhase::Background)); > > though I do like the symmetry in your version. Is there a meaningful efficiency difference? Moving into an empty vector is just setting a pointer? But yeah, I went for symmetry here. > I wonder if it would make sense at some point to make > collectForDocumentMarkers take a functor that does the subdivide rather than > allocating the vector then subdividing. There is lots of cleanup potential here but I'll try to stay focused on getting stuff out from legacy lines for now. Should be easier to see what to do when everything has been moved out.
EWS
Comment 4 2021-06-08 11:02:26 PDT
Committed r278621 (238606@main): <https://commits.webkit.org/238606@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 430753 [details].
Radar WebKit Bug Importer
Comment 5 2021-06-08 11:03:22 PDT
Michael Catanzaro
Comment 6 2021-06-08 12:46:09 PDT
Reopening to attach new patch.
Michael Catanzaro
Comment 7 2021-06-08 12:46:12 PDT
Created attachment 430878 [details] Patch for landing
EWS
Comment 8 2021-06-08 13:44:20 PDT
Committed r278627 (238611@main): <https://commits.webkit.org/238611@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 430878 [details].
Note You need to log in before you can comment on or make changes to this bug.