summaryrefslogtreecommitdiff
path: root/layout/generic/nsSelection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/generic/nsSelection.cpp')
-rw-r--r--layout/generic/nsSelection.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp
index f8a231b00c..b9ee20d1fc 100644
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -3679,10 +3679,11 @@ CompareToRangeStart(nsINode* aCompareNode, int32_t aCompareOffset,
{
nsINode* start = aRange->GetStartParent();
NS_ENSURE_STATE(aCompareNode && start);
- // If the nodes that we're comparing are not in the same document,
- // assume that aCompareNode will fall at the end of the ranges.
+ // If the nodes that we're comparing are not in the same document or in the
+ // same subtree, assume that aCompareNode will fall at the end of the ranges.
if (aCompareNode->GetComposedDoc() != start->GetComposedDoc() ||
- !start->GetComposedDoc()) {
+ !start->GetComposedDoc() ||
+ aCompareNode->SubtreeRoot() != start->SubtreeRoot()) {
*aCmp = 1;
} else {
*aCmp = nsContentUtils::ComparePoints(aCompareNode, aCompareOffset,
@@ -3697,10 +3698,11 @@ CompareToRangeEnd(nsINode* aCompareNode, int32_t aCompareOffset,
{
nsINode* end = aRange->GetEndParent();
NS_ENSURE_STATE(aCompareNode && end);
- // If the nodes that we're comparing are not in the same document,
- // assume that aCompareNode will fall at the end of the ranges.
+ // If the nodes that we're comparing are not in the same document or in the
+ // same subtree, assume that aCompareNode will fall at the end of the ranges.
if (aCompareNode->GetComposedDoc() != end->GetComposedDoc() ||
- !end->GetComposedDoc()) {
+ !end->GetComposedDoc() ||
+ aCompareNode->SubtreeRoot() != end->SubtreeRoot()) {
*aCmp = 1;
} else {
*aCmp = nsContentUtils::ComparePoints(aCompareNode, aCompareOffset,