Make wavy underlines go all the way to the end of the inline.
Make wavy underlines go all the way to the end of the inline.

Previously, the wavy underline code only knew how to draw a complete
period.

This change adds the ability to draw a partial period of the wave.

Previously, the code tried, but failed, for reasons I cannot
determine, to fit the width of the inline by extending the period to
be an integral factor of the width.

This is bad because as you type text, the underline wave of earlier
characters would jiggle.

This fixes that by not changing the period of the wave when the length changes.

It's interesting to compare this to the previous code. Here's a test
that shows this in Safari/Chrome:

   http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=3543

Notice how as you type "i"s, the underline changes how far it extends
(obviously a bug) but also what the period of the wave is (which looks
especially ugly when typing).

Firefox, on the other hand, renders something that isn't actually a
wave; it's a saw-tooth pattern with straight lines between each
direction change. This works for small font sizes at low densities,
but is not great on modern screens.

This CL addresses this issue by computing the bezier curve control
points for the curve that consists of just the remaining fraction of
the period. To do this, however, it allocates an object and solves a
bezier for x (which includes a numerical integration), which is
certainly a performance concern. Apps that try to wavy-underline an
entire UI are going to maybe suffer. Since this is typically going to
be used for spelling checkers, it means people who spell better will
have better performance.

(I haven't tested this to see what the perf impact actually is. If
it's actually bad, we can probably cache the results of the
integration pretty trivially.)

R=eseidel@chromium.org

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

afandria/mojo,chinmaygarde/mojo,jianglu/mojo,chinmaygarde/mojo,afandria/mojo,jianglu/mojo,jianglu/mojo,chinmaygarde/mojo,chinmaygarde/mojo,afandria/mojo,jianglu/mojo,afandria/mojo,afandria/mojo,chinmaygarde/mojo,jianglu/mojo,chinmaygarde/mojo,afandria/mojo,jianglu/mojo,jianglu/mojo,afandria/mojo,chinmaygarde/mojo,afandria/mojo,jianglu/mojo,chinmaygarde/mojo,chinmaygarde/mojo