DescriptionSimplify (and optimize) SVGTextQuery::characterNumberAtPositionCallback
This method needs to iterate the glyphs within a fragment and check if the
queried point is contained within any of them.
Currently a fragment offset is converted to a offset that's suitable for
passing to mapStartEndPositionsIntoFragmentCoordinates - which then in
turn maps it into a text box-relative offset and then runs (the costly)
modifyStartEndPositionsRespectingLigatures to check if the current range
happen to fall within a "multicharacter glyph" (ligatures etc.), and then
expand the range appropriately.
This is a lot of work, that is better performed by finding the index within
the text metrics list for the corresponding RenderSVGInlineText object,
and then step through the fragment using the lengths of the individual
glyphs.
The impact on performance will vary with the length of fragments and the
length of the text content.
For a case like:
<text ...>(AAAAAAAAAA ){99}AAAAAAAAAA</text>
(100 groups of ten A's separated by a single whitespace)
with a negative query, the speed-up is ~1.2x. With 'word-spacing' added
(to get more fragments) the speed-up becomes ~8.7x.
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177089
Patch Set 1 #
Messages
Total messages: 6 (0 generated)
|