Bug 1119126 - Send updateposition after reflow when selection is collapsed. r=roc

This commit is contained in:
Morris Tseng 2015-02-02 22:10:00 -05:00
Родитель d975c07099
Коммит 58963742cf
2 изменённых файлов: 15 добавлений и 0 удалений

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

@ -638,6 +638,8 @@ BrowserElementChild.prototype = {
// We clear selectionStateChangedTarget if selection carets are invisible.
if (e.visible && !isCollapsed) {
this._selectionStateChangedTarget = e.target;
} else if (canPaste && isCollapsed) {
this._selectionStateChangedTarget = e.target;
} else {
this._selectionStateChangedTarget = null;
}
@ -1144,6 +1146,7 @@ BrowserElementChild.prototype = {
_recvDoCommand: function(data) {
if (this._isCommandEnabled(data.json.command)) {
this._selectionStateChangedTarget = null;
docShell.doCommand(COMMAND_MAP[data.json.command]);
}
},

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

@ -1220,6 +1220,12 @@ SelectionCarets::ScrollPositionChanged()
SelectionState::Updateposition);
}
}
} else {
nsRefPtr<dom::Selection> selection = GetSelection();
if (selection && selection->RangeCount() && selection->IsCollapsed()) {
DispatchSelectionStateChangedEvent(selection,
SelectionState::Updateposition);
}
}
}
@ -1317,6 +1323,12 @@ SelectionCarets::Reflow(DOMHighResTimeStamp aStart, DOMHighResTimeStamp aEnd)
DispatchSelectionStateChangedEvent(GetSelection(),
SelectionState::Updateposition);
}
} else {
nsRefPtr<dom::Selection> selection = GetSelection();
if (selection && selection->RangeCount() && selection->IsCollapsed()) {
DispatchSelectionStateChangedEvent(selection,
SelectionState::Updateposition);
}
}
return NS_OK;
}