Change the HarfBuzzShaper text itemizer logic

Change the logic for breaking text into runs based on script and for
resolving the scripts to allow adjacent runs to be combined.
Correctly itemizing text into runs with the same same bidirectional
level, unicode script, and text language is required for HarfBuzz to
produce the optimal results.

The logic for breaking text into runs has not change but instead of
immediately creating HarfBuzzRuns it now populates an intermediate list
of candidate runs. The resolveCandidateRuns method then takes this list
and sets the script of adjacent nodes based on ScriptExtensions,
preferring to match the preceding (in logical order) run, falling back
on the following. Failing that USCRIPT_COMMON will be resolved to the
preceding or following (again, in logical order) run.

Finally HarfBuzzRuns are created from the candidate list, merging
adjacent runs with the same script and fontData.

While this change does incur a performance penalty it should be
negligible in the common case where the text uses a single script.
Furthermore even though it does do more work during run creation it
results in fewer HarfBuzzRuns being created.

If performance is a concern we could likely merge the last two passes
(resolve and merge/create) into one without sacrificing too much clarity.

R=behdad@chromium.org, dglazkov@chromium.org
BUG=311372
TEST=fast/text/international/alef-connected.html

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

git-svn-id: svn://svn.chromium.org/blink/trunk@166267 bbb929c8-8fbe-4397-9dbb-9b2b20218538