[webkit-reviews] review granted: [Bug 226731] Factor MarkedText collection out of LegacyInlineTextBox : [Attachment 430753] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 8 07:40:24 PDT 2021


Sam Weinig <sam at webkit.org> has granted Antti Koivisto <koivisto at iki.fi>'s
request for review:
Bug 226731: Factor MarkedText collection out of LegacyInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=226731

Attachment 430753: patch

https://bugs.webkit.org/attachment.cgi?id=430753&action=review




--- Comment #2 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 430753
  --> https://bugs.webkit.org/attachment.cgi?id=430753
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.


More information about the webkit-reviews mailing list