Refactor DocumentMarkerController::Add*Marker() methods

Currently there's a lot of duplicated code in all the MarkerType-specific
DocumentMarkerController::Add*Marker() methods. This CL factors out the common
logic into an AddMarkerInternal() method, and renames the existing (private)
AddMarker() method to AddMarkerToNode().

This CL also adds some filtering to avoid constructing DocumentMarkers with
start/end offsets that are the same (the current version of the code constructs
these DocumentMarkers, then filters them out before actually adding them), or
when the range returned by TextIterator is not a text node (we don't currently
do this filtering).

BUG=707867

Review-Url: https://codereview.chromium.org/2916463002
Cr-Commit-Position: refs/heads/master@{#475840}
2 files changed