Apply style logic is only consumed in one location. Extra wrapping
functions added in StyleHelper and Formatting are unnecessary, and
should not have been called from outside an operation. Pushing this
logic into the operation prevents accidental misuse.
The names of the test functions are now passed separately from the function in
a structure. The reason for this is that Closure Compiler does not allow adding
additional fields to functions.
If the text node being considered was the 3rd child node (or later)
and the 1st node in the container was an unstyled text node, the
domUtils.rangeContainsNode check could incorrectly report the
parent container as suitable for re-use.
Usually the limits for a selection reference the first or last
text nodes. When the first text node is migrated to a new styled span,
the range limits will suddenly not include the following siblings that
should also be migrated. This causes moveToNewSpan to produce more
spans than necessary.
Applying a direct style to a range will result in new
automatic styles being created for each unique style
block with the desired text properties.
Formatted text is contained within a span element just
above each text node that is within an ODF container
element.
TODO
* Styles should be validated before being applied
* Empty spans should be removed when modifying styles