summaryrefslogtreecommitdiffstats
path: root/dom/serializers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /dom/serializers
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/serializers')
-rw-r--r--dom/serializers/nsDocumentEncoder.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/dom/serializers/nsDocumentEncoder.cpp b/dom/serializers/nsDocumentEncoder.cpp
index 14120bae64..46ea15fecc 100644
--- a/dom/serializers/nsDocumentEncoder.cpp
+++ b/dom/serializers/nsDocumentEncoder.cpp
@@ -1270,8 +1270,14 @@ nsresult nsDocumentEncoder::RangeSerializer::SerializeRangeToString(
const nsRange* aRange) {
if (!aRange || aRange->Collapsed()) return NS_OK;
+ // Consider a case where the boundary of the selection is ShadowRoot (ie, the
+ // first child of ShadowRoot is selected, so ShadowRoot is the container hence
+ // the boundary), allowing GetClosestCommonInclusiveAncestor to cross the
+ // boundary can return the host element as the container.
+ // SerializeRangeContextStart doesn't support this case.
mClosestCommonInclusiveAncestorOfRange =
- aRange->GetClosestCommonInclusiveAncestor();
+ aRange->GetClosestCommonInclusiveAncestor(
+ AllowRangeCrossShadowBoundary::No);
if (!mClosestCommonInclusiveAncestorOfRange) {
return NS_OK;