зеркало из https://github.com/mozilla/gecko-dev.git
Back out changes that were part of a different patch.
This commit is contained in:
Родитель
f3a3af9cca
Коммит
974b52ca30
|
@ -138,7 +138,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||||
#include "nsIDOMUserDataHandler.h"
|
#include "nsIDOMUserDataHandler.h"
|
||||||
#include "nsIFragmentContentSink.h"
|
#include "nsIFragmentContentSink.h"
|
||||||
#include "nsContentCreatorFunctions.h"
|
#include "nsContentCreatorFunctions.h"
|
||||||
#include "nsTPtrArray.h"
|
|
||||||
|
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
#include "nsIBidiKeyboard.h"
|
#include "nsIBidiKeyboard.h"
|
||||||
|
@ -1229,7 +1228,7 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the chain of parents
|
// Build the chain of parents
|
||||||
nsAutoTPtrArray<nsINode, 30> parents1, parents2;
|
nsAutoVoidArray parents1, parents2;
|
||||||
do {
|
do {
|
||||||
parents1.AppendElement(aNode1);
|
parents1.AppendElement(aNode1);
|
||||||
aNode1 = aNode1->GetNodeParent();
|
aNode1 = aNode1->GetNodeParent();
|
||||||
|
@ -1240,13 +1239,13 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1,
|
||||||
} while (aNode2);
|
} while (aNode2);
|
||||||
|
|
||||||
// Find where the parent chain differs
|
// Find where the parent chain differs
|
||||||
PRUint32 pos1 = parents1.Length();
|
PRUint32 pos1 = parents1.Count();
|
||||||
PRUint32 pos2 = parents2.Length();
|
PRUint32 pos2 = parents2.Count();
|
||||||
nsINode* parent = nsnull;
|
nsINode* parent = nsnull;
|
||||||
PRUint32 len;
|
PRUint32 len;
|
||||||
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
|
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
|
||||||
nsINode* child1 = parents1.ElementAt(--pos1);
|
nsINode* child1 = NS_STATIC_CAST(nsINode*, parents1.FastElementAt(--pos1));
|
||||||
nsINode* child2 = parents2.ElementAt(--pos2);
|
nsINode* child2 = NS_STATIC_CAST(nsINode*, parents2.FastElementAt(--pos2));
|
||||||
if (child1 != child2) {
|
if (child1 != child2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1266,7 +1265,7 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoTPtrArray<nsINode, 30> parents1, parents2;
|
nsAutoVoidArray parents1, parents2;
|
||||||
|
|
||||||
// Check if either node is an attribute
|
// Check if either node is an attribute
|
||||||
nsIAttribute* attr1 = nsnull;
|
nsIAttribute* attr1 = nsnull;
|
||||||
|
@ -1277,7 +1276,7 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
|
||||||
// to the chain and walk up to the element
|
// to the chain and walk up to the element
|
||||||
if (elem) {
|
if (elem) {
|
||||||
aNode1 = elem;
|
aNode1 = elem;
|
||||||
parents1.AppendElement(NS_STATIC_CAST(nsINode*, attr1));
|
parents1.AppendElement(attr1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aNode2->IsNodeOfType(nsINode::eATTRIBUTE)) {
|
if (aNode2->IsNodeOfType(nsINode::eATTRIBUTE)) {
|
||||||
|
@ -1307,7 +1306,7 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
|
||||||
|
|
||||||
if (elem) {
|
if (elem) {
|
||||||
aNode2 = elem;
|
aNode2 = elem;
|
||||||
parents2.AppendElement(NS_STATIC_CAST(nsINode*, attr2));
|
parents2.AppendElement(attr2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1327,10 +1326,10 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
|
||||||
} while (aNode2);
|
} while (aNode2);
|
||||||
|
|
||||||
// Check if the nodes are disconnected.
|
// Check if the nodes are disconnected.
|
||||||
PRUint32 pos1 = parents1.Length();
|
PRUint32 pos1 = parents1.Count();
|
||||||
PRUint32 pos2 = parents2.Length();
|
PRUint32 pos2 = parents2.Count();
|
||||||
nsINode* top1 = parents1.ElementAt(--pos1);
|
nsINode* top1 = NS_STATIC_CAST(nsINode*, parents1.FastElementAt(--pos1));
|
||||||
nsINode* top2 = parents2.ElementAt(--pos2);
|
nsINode* top2 = NS_STATIC_CAST(nsINode*, parents2.FastElementAt(--pos2));
|
||||||
if (top1 != top2) {
|
if (top1 != top2) {
|
||||||
return top1 < top2 ?
|
return top1 < top2 ?
|
||||||
(nsIDOM3Node::DOCUMENT_POSITION_PRECEDING |
|
(nsIDOM3Node::DOCUMENT_POSITION_PRECEDING |
|
||||||
|
@ -1345,8 +1344,8 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
|
||||||
nsINode* parent = top1;
|
nsINode* parent = top1;
|
||||||
PRUint32 len;
|
PRUint32 len;
|
||||||
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
|
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
|
||||||
nsINode* child1 = parents1.ElementAt(--pos1);
|
nsINode* child1 = NS_STATIC_CAST(nsINode*, parents1.FastElementAt(--pos1));
|
||||||
nsINode* child2 = parents2.ElementAt(--pos2);
|
nsINode* child2 = NS_STATIC_CAST(nsINode*, parents2.FastElementAt(--pos2));
|
||||||
if (child1 != child2) {
|
if (child1 != child2) {
|
||||||
// child1 or child2 can be an attribute here. This will work fine since
|
// child1 or child2 can be an attribute here. This will work fine since
|
||||||
// IndexOf will return -1 for the attribute making the attribute be
|
// IndexOf will return -1 for the attribute making the attribute be
|
||||||
|
|
Загрузка…
Ссылка в новой задаче