summaryrefslogtreecommitdiffstats
path: root/dom/base/nsINode.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /dom/base/nsINode.cpp
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/nsINode.cpp')
-rw-r--r--dom/base/nsINode.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
index 3a9fe23899..d5455e5596 100644
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -16,6 +16,7 @@
#include "js/JSON.h" // JS_ParseJSON
#include "mozAutoDocUpdate.h"
#include "mozilla/AsyncEventDispatcher.h"
+#include "mozilla/ClearOnShutdown.h"
#include "mozilla/CORSMode.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
@@ -304,7 +305,7 @@ class IsItemInRangeComparator {
// @param aStartOffset has to be less or equal to aEndOffset.
IsItemInRangeComparator(const nsINode& aNode, const uint32_t aStartOffset,
const uint32_t aEndOffset,
- nsContentUtils::ComparePointsCache* aCache)
+ nsContentUtils::NodeIndexCache* aCache)
: mNode(aNode),
mStartOffset(aStartOffset),
mEndOffset(aEndOffset),
@@ -332,7 +333,7 @@ class IsItemInRangeComparator {
const nsINode& mNode;
const uint32_t mStartOffset;
const uint32_t mEndOffset;
- nsContentUtils::ComparePointsCache* mCache;
+ nsContentUtils::NodeIndexCache* mCache;
};
bool nsINode::IsSelected(const uint32_t aStartOffset,
@@ -367,7 +368,7 @@ bool nsINode::IsSelected(const uint32_t aStartOffset,
}
}
- nsContentUtils::ComparePointsCache cache;
+ nsContentUtils::NodeIndexCache cache;
IsItemInRangeComparator comparator{*this, aStartOffset, aEndOffset, &cache};
for (Selection* selection : ancestorSelections) {
// Binary search the sorted ranges in this selection.
@@ -1810,6 +1811,10 @@ Maybe<uint32_t> nsINode::ComputeIndexOf(const nsINode* aPossibleChild) const {
return Nothing();
}
+ if (aPossibleChild == GetFirstChild()) {
+ return Some(0);
+ }
+
if (aPossibleChild == GetLastChild()) {
MOZ_ASSERT(GetChildCount());
return Some(GetChildCount() - 1);
@@ -3672,15 +3677,13 @@ already_AddRefed<nsINode> nsINode::CloneAndAdopt(
}
newShadowRoot->SetIsDeclarative(originalShadowRoot->IsDeclarative());
- if (aDeep) {
- for (nsIContent* origChild = originalShadowRoot->GetFirstChild();
- origChild; origChild = origChild->GetNextSibling()) {
- nsCOMPtr<nsINode> child =
- CloneAndAdopt(origChild, aClone, aDeep, nodeInfoManager,
- aReparentScope, newShadowRoot, aError);
- if (NS_WARN_IF(aError.Failed())) {
- return nullptr;
- }
+ for (nsIContent* origChild = originalShadowRoot->GetFirstChild();
+ origChild; origChild = origChild->GetNextSibling()) {
+ nsCOMPtr<nsINode> child =
+ CloneAndAdopt(origChild, aClone, true, nodeInfoManager,
+ aReparentScope, newShadowRoot, aError);
+ if (NS_WARN_IF(aError.Failed())) {
+ return nullptr;
}
}
}