зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1433073: part 3) Mimic old behavior of computing `mCommonInclusiveAncestors`. r=hsivonen
This reverts a previously introduced regression. See the Bugzilla comments of this bug. The key consequence of this is change is that copy-pasting multiple click-selected table rows now works again for some applications (and shouldn't be broken for others). That's because the clipboard flavor "text/_moz_htmlcontext" doesn't contain a superfluous "<tr>" anymore. The fix could presumably be more elegant, but it would be hard to ensure no other applications relying on the old behavior break. Differential Revision: https://phabricator.services.mozilla.com/D71982
This commit is contained in:
Родитель
44c5a47ea5
Коммит
fc91f37b49
|
@ -464,6 +464,13 @@ nsresult nsDocumentEncoder::SerializeSelection() {
|
|||
} else if (prevNode) {
|
||||
// Went from a <tr> to a non-<tr>
|
||||
mDisableContextSerialize = false;
|
||||
|
||||
// `mCommonInclusiveAncestors` is used in `EncodeToStringWithContext`
|
||||
// too. Update it here to mimic the old behavior.
|
||||
mCommonInclusiveAncestors.Clear();
|
||||
nsContentUtils::GetInclusiveAncestors(prevNode->GetParentNode(),
|
||||
mCommonInclusiveAncestors);
|
||||
|
||||
rv = SerializeRangeContextEnd();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
prevNode = nullptr;
|
||||
|
@ -482,6 +489,13 @@ nsresult nsDocumentEncoder::SerializeSelection() {
|
|||
rv = SerializeNodeEnd(*prevNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mDisableContextSerialize = false;
|
||||
|
||||
// `mCommonInclusiveAncestors` is used in `EncodeToStringWithContext`
|
||||
// too. Update it here to mimic the old behavior.
|
||||
mCommonInclusiveAncestors.Clear();
|
||||
nsContentUtils::GetInclusiveAncestors(prevNode->GetParentNode(),
|
||||
mCommonInclusiveAncestors);
|
||||
|
||||
rv = SerializeRangeContextEnd();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -984,7 +998,6 @@ nsresult nsDocumentEncoder::SerializeRangeContextStart(
|
|||
|
||||
while (i > 0) {
|
||||
nsINode* node = aAncestorArray.ElementAt(--i);
|
||||
|
||||
if (!node) break;
|
||||
|
||||
// Either a general inclusion or as immediate context
|
||||
|
|
Загрузка…
Ссылка в новой задаче