Bug 1932800 - Add a check to SelfIsSelectable to preserve editor drag and drop behavior. r=masayuki

We were relying on editable text frames not being empty. We fixed that
on the previous patches but this caused editor d&d to break.

For now this preserves the selection behavior. In the future we should
look into removing the IsEmpty() condition or so, probably, or make it
more subtle.

Differential Revision: https://phabricator.services.mozilla.com/D229996
This commit is contained in:
Emilio Cobos Álvarez
2024-11-23 08:58:14 +00:00
parent 298696a753
commit 4647f93559

View File

@@ -5499,7 +5499,12 @@ static bool SelfIsSelectable(nsIFrame* aFrame, nsIFrame* aParentFrame,
if (aFrame->Style()->UserSelect() == StyleUserSelect::None) {
return false;
}
if (aFrame->IsEmpty()) {
if (aFrame->IsEmpty() &&
(!aFrame->IsTextFrame() || !aFrame->ContentIsEditable())) {
// FIXME(emilio): Historically we haven't treated empty frames as
// selectable, but also we had special-cases so that editable empty text
// frames returned false from IsEmpty(). Sort this out (probably by
// removing the IsEmpty() condition altogether).
return false;
}
return true;