* restore.
*/
public void saveSelection() {
if (editingConcerns != null && savedSelectionDepth == 0) {
needToRestoreSelection = false;
SelectionHelper helper = editingConcerns.getSelectionHelper();
// Sometimes the document is not in an editing context, in which
// case there is no selection helper.
if (helper != null) {
FocusedPointRange<Node> htmlSelection = NativeSelectionUtil.get();
if (htmlSelection != null) {
savedSelectionAnchor = htmlSelection.getAnchor();
if (savedSelectionAnchor.isInTextNode()) {
savedSelectionAnchorTextNodelet = savedSelectionAnchor.getContainer().cast();
savedSelectionAnchorOffset = savedSelectionAnchor.getTextOffset();
}
savedSelectionFocus = htmlSelection.getFocus();
if (savedSelectionFocus.isInTextNode()) {
savedSelectionFocusTextNodelet = savedSelectionFocus.getContainer().cast();
savedSelectionFocusOffset = savedSelectionFocus.getTextOffset();
}
savedSelection = helper.getSelectionRange();
}
}
}
savedSelectionDepth++;