зеркало из 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();
|
droppedAt = rangeAtDropPoint->StartRef();
|
||||||
MOZ_ASSERT(droppedAt.IsSetAndValid());
|
MOZ_ASSERT(droppedAt.IsSetAndValid());
|
||||||
}
|
|
||||||
|
|
||||||
// If focus is changed to different element and we're handling drop in
|
// If focus is changed to different element and we're handling drop in
|
||||||
// contenteditable, we cannot handle it without focus. So, we should give
|
// contenteditable, we cannot handle it without focus. So, we should give
|
||||||
// it up.
|
// it up.
|
||||||
if (NS_WARN_IF(newFocusedElement !=
|
if (AsHTMLEditor() && !AsHTMLEditor()->IsInDesignMode() &&
|
||||||
nsFocusManager::GetFocusManager()->GetFocusedElement() &&
|
NS_WARN_IF(newFocusedElement !=
|
||||||
AsHTMLEditor() && !AsHTMLEditor()->IsInDesignMode())) {
|
AsHTMLEditor()->GetActiveEditingHost())) {
|
||||||
editActionData.Abort();
|
editActionData.Abort();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AsHTMLEditor()) {
|
if (!AsHTMLEditor()) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче