From 9b2f861866b7924dcd67dae924e37e906ee5de7f Mon Sep 17 00:00:00 2001 From: "cvshook%sicking.cc" Date: Mon, 24 Jan 2005 10:43:14 +0000 Subject: [PATCH] Bug 266406: nsAttrValue has too big default boundries when parsing integers. r+sr=jst git-svn-id: svn://10.0.0.236/trunk@168231 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsAttrValue.h | 2 +- mozilla/content/base/src/nsGenericElement.cpp | 14 ++++++++------ mozilla/content/base/src/nsGenericElement.h | 7 +++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mozilla/content/base/src/nsAttrValue.h b/mozilla/content/base/src/nsAttrValue.h index 408fcfa4cec..642290e4af3 100644 --- a/mozilla/content/base/src/nsAttrValue.h +++ b/mozilla/content/base/src/nsAttrValue.h @@ -59,7 +59,7 @@ class nsISVGValue; #define NS_ATTRVALUE_INTEGERTYPE_BITS 5 #define NS_ATTRVALUE_INTEGERTYPE_MASK (PtrBits((1 << NS_ATTRVALUE_INTEGERTYPE_BITS) - 1)) #define NS_ATTRVALUE_INTEGERTYPE_MULTIPLIER (1 << NS_ATTRVALUE_INTEGERTYPE_BITS) -#define NS_ATTRVALUE_INTEGERTYPE_MAXVALUE ((1 << (32 - NS_ATTRVALUE_INTEGERTYPE_BITS)) - 1) +#define NS_ATTRVALUE_INTEGERTYPE_MAXVALUE ((1 << (31 - NS_ATTRVALUE_INTEGERTYPE_BITS)) - 1) #define NS_ATTRVALUE_INTEGERTYPE_MINVALUE (-NS_ATTRVALUE_INTEGERTYPE_MAXVALUE - 1) class nsAttrValue { diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 70ae079f26f..f157dbf1f4b 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -2649,27 +2649,29 @@ nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify) * aChild is one of aNode's ancestors. -- jst@citec.fi */ -static PRBool -isSelfOrAncestor(nsIContent *aNode, nsIContent *aChild) +/* static */ +PRBool +nsGenericElement::isSelfOrAncestor(nsIContent *aNode, + nsIContent *aPossibleAncestor) { NS_PRECONDITION(aNode, "Must have a node"); - if (aNode == aChild) + if (aNode == aPossibleAncestor) return PR_TRUE; /* * If aChild doesn't have children it can't be our ancestor */ - if (aChild->GetChildCount() == 0) { + if (aPossibleAncestor->GetChildCount() == 0) { return PR_FALSE; } for (nsIContent* ancestor = aNode->GetParent(); ancestor; ancestor = ancestor->GetParent()) { - if (ancestor == aChild) { + if (ancestor == aPossibleAncestor) { /* - * We found aChild as one of our ancestors + * We found aPossibleAncestor as one of our ancestors */ return PR_TRUE; } diff --git a/mozilla/content/base/src/nsGenericElement.h b/mozilla/content/base/src/nsGenericElement.h index ee8378dddd1..51dca716dc9 100644 --- a/mozilla/content/base/src/nsGenericElement.h +++ b/mozilla/content/base/src/nsGenericElement.h @@ -619,6 +619,13 @@ public: static PRBool ShouldFocus(nsIContent *aContent); + /** + * Checks if a node is the ancestor of another. + */ + static PRBool isSelfOrAncestor(nsIContent *aNode, + nsIContent *aPossibleAncestor); + + static nsresult InitHashes(); static PLDHashTable sEventListenerManagersHash;