зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616539 - Make `TextEditor::OnDrop()` compare newly focused element with active editing host r=m_kato
Currently, it checks whether proper element gets focus as expected with `nsFocusManager::GetFocusedElement()`, but it returns globally focused element. I.e., it may return different document's element or `nullptr` if application itself is inactive. The purpose of the focus check is, `HTMLEditor` can modify contents only in active editing host. Therefore, comparing with `HTMLEditor::GetActiveEditingHost()` is better and simpler for here. Differential Revision: https://phabricator.services.mozilla.com/D63581 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5437a922a7
Коммит
5f656bfdd1
|
@ -402,16 +402,16 @@ nsresult TextEditor::OnDrop(DragEvent* aDropEvent) {
|
|||
}
|
||||
droppedAt = rangeAtDropPoint->StartRef();
|
||||
MOZ_ASSERT(droppedAt.IsSetAndValid());
|
||||
}
|
||||
|
||||
// If focus is changed to different element and we're handling drop in
|
||||
// contenteditable, we cannot handle it without focus. So, we should give
|
||||
// it up.
|
||||
if (NS_WARN_IF(newFocusedElement !=
|
||||
nsFocusManager::GetFocusManager()->GetFocusedElement() &&
|
||||
AsHTMLEditor() && !AsHTMLEditor()->IsInDesignMode())) {
|
||||
editActionData.Abort();
|
||||
return NS_OK;
|
||||
// If focus is changed to different element and we're handling drop in
|
||||
// contenteditable, we cannot handle it without focus. So, we should give
|
||||
// it up.
|
||||
if (AsHTMLEditor() && !AsHTMLEditor()->IsInDesignMode() &&
|
||||
NS_WARN_IF(newFocusedElement !=
|
||||
AsHTMLEditor()->GetActiveEditingHost())) {
|
||||
editActionData.Abort();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AsHTMLEditor()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче