Add a "logical query mode" to SVGTextQuery

This CL adds an additional query "mode" to use for some of the query
functions. This new methods searches "logically" - using the layout
objects rather than the line boxes to guide the search. The existing
method is renamed to spatialQuery, leaving us with:

  spatialQuery() - for point -> something
  logicalQuery() - for character (code unit) -> something

This new search-order is needed to handle bi-directionality correctly.
Previously the direction of the text would influence the search, since
the line boxes would be processed in their spatial-ordering and the
search position would be adjusted based on that ordering. (As an
example, this would mean that given:

  <text direction="rtl">ltrRTL</text>

and a query range [2, 4], the third character of the RTL run and the
first character of the ltr run would be included rather than the other
way around. See also new test in bidi-getsubstringlength.html)

The value returned by getCharNumAtPosition() is adjusted such that the
layout object of the intersected glyph is used to determine the
character index based on the query root (the element on which the
method is called.) This means that the value returned is in the same
query space as that handled by logicalQuery().

BUG=471205,470326

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

git-svn-id: svn://svn.chromium.org/blink/trunk@193944 bbb929c8-8fbe-4397-9dbb-9b2b20218538
9 files changed
tree: 2fa15a76fc1210653431ecfef4b8e80b522e5cf5
  1. third_party/