(The log message below was given for revision 583, but I committed the wrong file. This commit is the actual one that fixes the bug).
(The log message below was given for revision 583, but I committed the wrong file. This
commit is the actual one that fixes the bug).

An alternate workaround for the caretRangeFromPoint bug initially addressed in revision
581. Previously, we first checked if the point was in the elements bounding rect, but
this meant that it wasn't possible to place the cursor at the nearest node, if the click
location was not exactly on a node.

Now we instead check to see if the result of elementFromPoint is the same as the parent
node of the text node returned by caretRangeFromPoint. If it isn't, then we assume that
the latter result is incorrect, and return null.

In the circumstances where this bug was observed, the last text node in the document was
being returned from caretRangeFromPoint in some cases. In the typical case, this is going
to be inside a paragraph node, but elementNodeFromPoint was returning the body element.
The check we do now comparing the results of the two functions fixes this case, but won't
work as intended if the document's last text node is a direct child of the body (as it may
be in some HTML documents that users open).

corinthia/corinthia-editorlib,corinthia/corinthia-editorlib,corinthia/corinthia-editorlib,corinthia/corinthia-editor,corinthia/corinthia-editorlib,corinthia/corinthia-editor,corinthia/corinthia-editor,corinthia/corinthia-editor,corinthia/corinthia-editor,corinthia/corinthia-editorlib