summaryrefslogtreecommitdiffstats
path: root/dom/serializers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /dom/serializers
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/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;