[Editing] Preserve inserted content's original style when inserted into an empty block

https://crrev.com/2072093002 introduced a behavior that, when content
is inserted into a block, the content's original style is removed to
match the block's style.

This results in a regression that the content's style is lost when the
block is empty and has nothing to match. Therefore, this patch preserves
the content's original style when the block is empty.

This also ensures style preservation when the insertion is an internal
operation of a higher level formatting command, e.g. outdent.

Note: this patch introduces a minor regression that, 'text-indent' CSS
property appears in a wrapper span after outdent command. This seems
harmless, though, as 'text-indent' applies only to block elements, so
the wrapper span doesn't have any effect in this case. This will be
cleaned up in a followup patch.

Bug: 818888
Change-Id: I2a6302cd5aa033339a8b857e3183dc5a2a261b4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1531683
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644200}
4 files changed