Add per-fragment early-out for getCharNumAtPosition

Since this is a spatial query, and a SVGTextFragment already contain an
approximation of it's own bounds, we can use those to perform a reasonably
efficient early-rejection test.
As an example: A TC using the textPath-data from issue 267504 [1] and a
mouse-move handler that uses getCharNumAtPosition to check which
"character" (glyph) is under the pointer consumes 0.005-0.2ms, compared to
0.2-0.5ms without this patch (before the CL in [2], this was 5-10ms!).
The TC mentioned in [2] now also weighs in at a few thousand us at worst.

[1] http://jsbin.com/imajow/1/quiet
[2] https://codereview.chromium.org/353003002

Review URL: https://codereview.chromium.org/355173002

git-svn-id: svn://svn.chromium.org/blink/trunk@177230 bbb929c8-8fbe-4397-9dbb-9b2b20218538
1 file changed
tree: 3f7d5dcaee145935f32a916e8d820480a6998b60
  1. third_party/