Bug 1118791 - Long press on white space selects closest vertical element, r=margaret

This commit is contained in:
Mark Capella 2015-01-20 00:40:41 -05:00
Родитель aa5ccc9006
Коммит 35def50721
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -102,7 +102,7 @@ function testSelectDivAtPoint() {
selection.collapseToStart();
return Promise.all([
ok(selection.getRangeAt(0).collapsed, "Selection should be collapsed"),
ok(selection.collapsed, "Selection should be collapsed"),
ok(!sh.isSelectionActive(), "Selection should not be active"),
]);
});

Просмотреть файл

@ -1024,9 +1024,15 @@ var SelectionHandler = {
if (selection) {
// Remove our listener before we clear the selection
selection.QueryInterface(Ci.nsISelectionPrivate).removeSelectionListener(this);
// Clear selection without clearing the anchorNode or focusNode
// Remove the selection. For editables, we clear selection without losing
// element focus. For non-editables, just clear all.
if (selection.rangeCount != 0) {
selection.collapseToStart();
if (this.isElementEditableText(this._targetElement)) {
selection.collapseToStart();
} else {
selection.removeAllRanges();
}
}
}
},