Bug 701666 - Removing TxObject define and Double typedef from xslt. r=Ms2ger
authorAtul Aggarwal <atulagrwl@gmail.com>
Sun, 20 Nov 2011 11:18:26 +0000
changeset 80521 7bbdb62430337ed8815a2c1383b6c9053d33db23
parent 80520 9a1341595afb31b424375b59436c58983d13079e
child 80522 3a55d64f56ef69374fbf11d5f57f381aa183418c
push idunknown
push userunknown
push dateunknown
reviewersMs2ger
bugs701666
milestone11.0a1
Bug 701666 - Removing TxObject define and Double typedef from xslt. r=Ms2ger
content/xslt/src/base/txCore.h
content/xslt/src/base/txDouble.cpp
content/xslt/src/base/txList.h
content/xslt/src/xml/txDOM.h
content/xslt/src/xpath/txCoreFunctionCall.cpp
content/xslt/src/xpath/txExprParser.cpp
content/xslt/src/xpath/txLiteralExpr.cpp
content/xslt/src/xpath/txNodeSet.cpp
content/xslt/src/xpath/txNodeSetAdaptor.cpp
content/xslt/src/xpath/txNumberExpr.cpp
content/xslt/src/xpath/txNumberResult.cpp
content/xslt/src/xpath/txStringResult.cpp
content/xslt/src/xpath/txUnionNodeTest.cpp
content/xslt/src/xslt/txEXSLTFunctions.cpp
content/xslt/src/xslt/txFormatNumberFunctionCall.cpp
content/xslt/src/xslt/txInstructions.h
content/xslt/src/xslt/txNodeSorter.cpp
content/xslt/src/xslt/txNodeSorter.h
content/xslt/src/xslt/txRtfHandler.cpp
content/xslt/src/xslt/txStylesheet.cpp
content/xslt/src/xslt/txStylesheet.h
content/xslt/src/xslt/txStylesheetCompileHandlers.cpp
content/xslt/src/xslt/txStylesheetCompiler.cpp
content/xslt/src/xslt/txStylesheetCompiler.h
content/xslt/src/xslt/txXPathResultComparator.cpp
content/xslt/src/xslt/txXPathResultComparator.h
content/xslt/src/xslt/txXSLTNumber.cpp
content/xslt/src/xslt/txXSLTPatterns.cpp
--- a/content/xslt/src/base/txCore.h
+++ b/content/xslt/src/base/txCore.h
@@ -101,15 +101,9 @@ public:
 
     /**
      * Converts the given String to a double, if the string value does not
      * represent a double, NaN will be returned.
      */
     static double toDouble(const nsAString& aStr);
 };
 
-// XXX These should go away eventually.
-#define TxObject txObject
-typedef txDouble Double;
-
-// XXX
-
 #endif
--- a/content/xslt/src/base/txDouble.cpp
+++ b/content/xslt/src/base/txDouble.cpp
@@ -45,47 +45,47 @@
 #endif
 #include "prdtoa.h"
 
 /*
  * Utility class for doubles
  */
 
 //-- Initialize Double related constants
-const dpun Double::NaN = DOUBLE_NaN;
+const dpun txDouble::NaN = DOUBLE_NaN;
 #ifdef IS_BIG_ENDIAN
-const dpun Double::POSITIVE_INFINITY = {{DOUBLE_HI32_EXPMASK, 0}};
-const dpun Double::NEGATIVE_INFINITY = {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT, 0}};
+const dpun txDouble::POSITIVE_INFINITY = {{DOUBLE_HI32_EXPMASK, 0}};
+const dpun txDouble::NEGATIVE_INFINITY = {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT, 0}};
 #else
-const dpun Double::POSITIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK}};
-const dpun Double::NEGATIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT}};
+const dpun txDouble::POSITIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK}};
+const dpun txDouble::NEGATIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT}};
 #endif
 
 /*
  * Determines whether the given double represents positive or negative
  * inifinity
  */
-bool Double::isInfinite(double aDbl)
+bool txDouble::isInfinite(double aDbl)
 {
     return ((DOUBLE_HI32(aDbl) & ~DOUBLE_HI32_SIGNBIT) == DOUBLE_HI32_EXPMASK &&
             !DOUBLE_LO32(aDbl));
 }
 
 /*
  * Determines whether the given double is NaN
  */
-bool Double::isNaN(double aDbl)
+bool txDouble::isNaN(double aDbl)
 {
     return DOUBLE_IS_NaN(aDbl);
 }
 
 /*
  * Determines whether the given double is negative
  */
-bool Double::isNeg(double aDbl)
+bool txDouble::isNeg(double aDbl)
 {
     return (DOUBLE_HI32(aDbl) & DOUBLE_HI32_SIGNBIT) != 0;
 }
 
 /*
  * Converts the given String to a double, if the String value does not
  * represent a double, NaN will be returned
  */
@@ -165,17 +165,17 @@ public:
         }
     }
 
     double
     getDouble()
     {
         if (mState == eIllegal || mBuffer.IsEmpty() ||
             (mBuffer.Length() == 1 && mBuffer[0] == '.')) {
-            return Double::NaN;
+            return txDouble::NaN;
         }
         return mSign*PR_strtod(mBuffer.get(), 0);
     }
 private:
     nsCAutoString mBuffer;
     enum {
         eWhitestart,
         eDecimal,
@@ -184,30 +184,30 @@ private:
         eIllegal
     } mState;
     enum {
         eNegative = -1,
         ePositive = 1
     } mSign;
 };
 
-double Double::toDouble(const nsAString& aSrc)
+double txDouble::toDouble(const nsAString& aSrc)
 {
     txStringToDouble sink;
     nsAString::const_iterator fromBegin, fromEnd;
     copy_string(aSrc.BeginReading(fromBegin), aSrc.EndReading(fromEnd), sink);
     return sink.getDouble();
 }
 
 /*
  * Converts the value of the given double to a String, and places
  * The result into the destination String.
  * @return the given dest string
  */
-void Double::toString(double aValue, nsAString& aDest)
+void txDouble::toString(double aValue, nsAString& aDest)
 {
 
     // check for special cases
 
     if (isNaN(aValue)) {
         aDest.AppendLiteral("NaN");
         return;
     }
--- a/content/xslt/src/base/txList.h
+++ b/content/xslt/src/base/txList.h
@@ -41,17 +41,17 @@
 
 #include "txCore.h"
 
 class txListIterator;
 
 /**
  * Represents an ordered list of Object pointers. Modeled after a Java 2 List.
 **/
-class txList : public TxObject {
+class txList : public txObject {
 
 friend class txListIterator;
 
 public:
 
     /**
     * Creates an empty txList
     **/
--- a/content/xslt/src/xml/txDOM.h
+++ b/content/xslt/src/xml/txDOM.h
@@ -77,17 +77,17 @@ class ProcessingInstruction;
 #define kNameSpaceID_XML      2
 // kNameSpaceID_XSLT is 6 for module, see nsINameSpaceManager.h
 #define kNameSpaceID_XSLT     3
 
 //
 // Abstract Class defining the interface for a Node.  See NodeDefinition below
 // for the actual implementation of the WC3 node.
 //
-class Node : public TxObject
+class Node : public txObject
 {
   public:
     //Node type constants
     //-- LF - changed to enum
     enum NodeType {
         ELEMENT_NODE = 1,
         ATTRIBUTE_NODE,
         TEXT_NODE,
--- a/content/xslt/src/xpath/txCoreFunctionCall.cpp
+++ b/content/xslt/src/xpath/txCoreFunctionCall.cpp
@@ -391,33 +391,33 @@ txCoreFunctionCall::evaluate(txIEvalCont
             rv = mParams[0]->evaluateToString(aContext, src);
             NS_ENSURE_SUCCESS(rv, rv);
 
             double start;
             rv = evaluateToNumber(mParams[1], aContext, &start);
             NS_ENSURE_SUCCESS(rv, rv);
 
             // check for NaN or +/-Inf
-            if (Double::isNaN(start) ||
-                Double::isInfinite(start) ||
+            if (txDouble::isNaN(start) ||
+                txDouble::isInfinite(start) ||
                 start >= src.Length() + 0.5) {
                 aContext->recycler()->getEmptyStringResult(aResult);
 
                 return NS_OK;
             }
 
             start = floor(start + 0.5) - 1;
 
             double end;
             if (mParams.Length() == 3) {
                 rv = evaluateToNumber(mParams[2], aContext, &end);
                 NS_ENSURE_SUCCESS(rv, rv);
 
                 end += start;
-                if (Double::isNaN(end) || end < 0) {
+                if (txDouble::isNaN(end) || end < 0) {
                     aContext->recycler()->getEmptyStringResult(aResult);
 
                     return NS_OK;
                 }
                 
                 if (end > src.Length())
                     end = src.Length();
                 else
@@ -541,59 +541,59 @@ txCoreFunctionCall::evaluate(txIEvalCont
             if (!mParams.IsEmpty()) {
                 rv = evaluateToNumber(mParams[0], aContext, &res);
                 NS_ENSURE_SUCCESS(rv, rv);
             }
             else {
                 nsAutoString resultStr;
                 txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
                                                   resultStr);
-                res = Double::toDouble(resultStr);
+                res = txDouble::toDouble(resultStr);
             }
             return aContext->recycler()->getNumberResult(res, aResult);
         }
         case ROUND:
         {
             double dbl;
             rv = evaluateToNumber(mParams[0], aContext, &dbl);
             NS_ENSURE_SUCCESS(rv, rv);
 
-            if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
-                if (Double::isNeg(dbl) && dbl >= -0.5) {
+            if (!txDouble::isNaN(dbl) && !txDouble::isInfinite(dbl)) {
+                if (txDouble::isNeg(dbl) && dbl >= -0.5) {
                     dbl *= 0;
                 }
                 else {
                     dbl = floor(dbl + 0.5);
                 }
             }
 
             return aContext->recycler()->getNumberResult(dbl, aResult);
         }
         case FLOOR:
         {
             double dbl;
             rv = evaluateToNumber(mParams[0], aContext, &dbl);
             NS_ENSURE_SUCCESS(rv, rv);
 
-            if (!Double::isNaN(dbl) &&
-                !Double::isInfinite(dbl) &&
-                !(dbl == 0 && Double::isNeg(dbl))) {
+            if (!txDouble::isNaN(dbl) &&
+                !txDouble::isInfinite(dbl) &&
+                !(dbl == 0 && txDouble::isNeg(dbl))) {
                 dbl = floor(dbl);
             }
 
             return aContext->recycler()->getNumberResult(dbl, aResult);
         }
         case CEILING:
         {
             double dbl;
             rv = evaluateToNumber(mParams[0], aContext, &dbl);
             NS_ENSURE_SUCCESS(rv, rv);
 
-            if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
-                if (Double::isNeg(dbl) && dbl > -1) {
+            if (!txDouble::isNaN(dbl) && !txDouble::isInfinite(dbl)) {
+                if (txDouble::isNeg(dbl) && dbl > -1) {
                     dbl *= 0;
                 }
                 else {
                     dbl = ceil(dbl);
                 }
             }
 
             return aContext->recycler()->getNumberResult(dbl, aResult);
@@ -605,17 +605,17 @@ txCoreFunctionCall::evaluate(txIEvalCont
                                             getter_AddRefs(nodes));
             NS_ENSURE_SUCCESS(rv, rv);
 
             double res = 0;
             PRInt32 i;
             for (i = 0; i < nodes->size(); ++i) {
                 nsAutoString resultStr;
                 txXPathNodeUtils::appendNodeValue(nodes->get(i), resultStr);
-                res += Double::toDouble(resultStr);
+                res += txDouble::toDouble(resultStr);
             }
             return aContext->recycler()->getNumberResult(res, aResult);
         }
         
         // Boolean functions
         
         case BOOLEAN:
         {
--- a/content/xslt/src/xpath/txExprParser.cpp
+++ b/content/xslt/src/xpath/txExprParser.cpp
@@ -414,17 +414,17 @@ txExprParser::createFilterOrStep(txExprL
                 return NS_ERROR_XPATH_PAREN_EXPECTED;
             }
             break;
         case Token::LITERAL :
             expr = new txLiteralExpr(tok->Value());
             break;
         case Token::NUMBER:
         {
-            expr = new txLiteralExpr(Double::toDouble(tok->Value()));
+            expr = new txLiteralExpr(txDouble::toDouble(tok->Value()));
             break;
         }
         default:
             lexer.pushBack();
             return createLocationStep(lexer, aContext, aResult);
     }
 
     if (lexer.peek()->mType == Token::L_BRACKET) {
--- a/content/xslt/src/xpath/txLiteralExpr.cpp
+++ b/content/xslt/src/xpath/txLiteralExpr.cpp
@@ -98,17 +98,17 @@ txLiteralExpr::toString(nsAString& aStr)
             }
             else {
               aStr.AppendLiteral("false()");
             }
             return;
         }
         case txAExprResult::NUMBER:
         {
-            Double::toString(mValue->numberValue(), aStr);
+            txDouble::toString(mValue->numberValue(), aStr);
             return;
         }
         case txAExprResult::STRING:
         {
             StringResult* strRes =
                 static_cast<StringResult*>(static_cast<txAExprResult*>
                                        (mValue));
             PRUnichar ch = '\'';
--- a/content/xslt/src/xpath/txNodeSet.cpp
+++ b/content/xslt/src/xpath/txNodeSet.cpp
@@ -496,17 +496,17 @@ txNodeSet::booleanValue()
     return !isEmpty();
 }
 double
 txNodeSet::numberValue()
 {
     nsAutoString str;
     stringValue(str);
 
-    return Double::toDouble(str);
+    return txDouble::toDouble(str);
 }
 
 void
 txNodeSet::stringValue(nsString& aStr)
 {
     NS_ASSERTION(mDirection == kForward,
                  "only append(aNode) is supported on reversed nodesets");
     if (isEmpty()) {
--- a/content/xslt/src/xpath/txNodeSetAdaptor.cpp
+++ b/content/xslt/src/xpath/txNodeSetAdaptor.cpp
@@ -81,17 +81,17 @@ txNodeSetAdaptor::ItemAsNumber(PRUint32 
 {
     if (aIndex > (PRUint32)NodeSet()->size()) {
         return NS_ERROR_ILLEGAL_VALUE;
     }
 
     nsAutoString result;
     txXPathNodeUtils::appendNodeValue(NodeSet()->get(aIndex), result);
 
-    *aResult = Double::toDouble(result);
+    *aResult = txDouble::toDouble(result);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 txNodeSetAdaptor::ItemAsString(PRUint32 aIndex, nsAString &aResult)
 {
     if (aIndex > (PRUint32)NodeSet()->size()) {
--- a/content/xslt/src/xpath/txNumberExpr.cpp
+++ b/content/xslt/src/xpath/txNumberExpr.cpp
@@ -65,39 +65,39 @@ txNumberExpr::evaluate(txIEvalContext* a
         case SUBTRACT:
             result = leftDbl - rightDbl;
             break;
 
         case DIVIDE:
             if (rightDbl == 0) {
 #if defined(XP_WIN)
                 /* XXX MSVC miscompiles such that (NaN == 0) */
-                if (Double::isNaN(rightDbl))
-                    result = Double::NaN;
+                if (txDouble::isNaN(rightDbl))
+                    result = txDouble::NaN;
                 else
 #endif
-                if (leftDbl == 0 || Double::isNaN(leftDbl))
-                    result = Double::NaN;
-                else if (Double::isNeg(leftDbl) ^ Double::isNeg(rightDbl))
-                    result = Double::NEGATIVE_INFINITY;
+                if (leftDbl == 0 || txDouble::isNaN(leftDbl))
+                    result = txDouble::NaN;
+                else if (txDouble::isNeg(leftDbl) ^ txDouble::isNeg(rightDbl))
+                    result = txDouble::NEGATIVE_INFINITY;
                 else
-                    result = Double::POSITIVE_INFINITY;
+                    result = txDouble::POSITIVE_INFINITY;
             }
             else
                 result = leftDbl / rightDbl;
             break;
 
         case MODULUS:
             if (rightDbl == 0) {
-                result = Double::NaN;
+                result = txDouble::NaN;
             }
             else {
 #if defined(XP_WIN)
                 /* Workaround MS fmod bug where 42 % (1/0) => NaN, not 42. */
-                if (!Double::isInfinite(leftDbl) && Double::isInfinite(rightDbl))
+                if (!txDouble::isInfinite(leftDbl) && txDouble::isInfinite(rightDbl))
                     result = leftDbl;
                 else
 #endif
                 result = fmod(leftDbl, rightDbl);
             }
             break;
 
         case MULTIPLY:
--- a/content/xslt/src/xpath/txNumberResult.cpp
+++ b/content/xslt/src/xpath/txNumberResult.cpp
@@ -62,29 +62,29 @@ NumberResult::NumberResult(double aValue
 
 short NumberResult::getResultType() {
     return txAExprResult::NUMBER;
 } //-- getResultType
 
 void
 NumberResult::stringValue(nsString& aResult)
 {
-    Double::toString(value, aResult);
+    txDouble::toString(value, aResult);
 }
 
 const nsString*
 NumberResult::stringValuePointer()
 {
     return nsnull;
 }
 
 bool NumberResult::booleanValue() {
   // OG+
   // As per the XPath spec, the boolean value of a number is true if and only if
   // it is neither positive 0 nor negative 0 nor NaN
-  return (bool)(value != 0.0 && !Double::isNaN(value));
+  return (bool)(value != 0.0 && !txDouble::isNaN(value));
   // OG-
 } //-- booleanValue
 
 double NumberResult::numberValue() {
     return this->value;
 } //-- numberValue
 
--- a/content/xslt/src/xpath/txStringResult.cpp
+++ b/content/xslt/src/xpath/txStringResult.cpp
@@ -79,11 +79,11 @@ StringResult::stringValuePointer()
     return &mValue;
 }
 
 bool StringResult::booleanValue() {
    return !mValue.IsEmpty();
 } //-- booleanValue
 
 double StringResult::numberValue() {
-    return Double::toDouble(mValue);
+    return txDouble::toDouble(mValue);
 } //-- numberValue
 
--- a/content/xslt/src/xpath/txUnionNodeTest.cpp
+++ b/content/xslt/src/xpath/txUnionNodeTest.cpp
@@ -53,17 +53,17 @@ txUnionNodeTest::matches(const txXPathNo
 
     return false;
 }
 
 double
 txUnionNodeTest::getDefaultPriority()
 {
     NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
-    return Double::NaN;
+    return txDouble::NaN;
 }
 
 bool
 txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext)
 {
     PRUint32 i, len = mNodeTests.Length();
     for (i = 0; i < len; ++i) {
         if (mNodeTests[i]->isSensitiveTo(aContext)) {
--- a/content/xslt/src/xslt/txEXSLTFunctions.cpp
+++ b/content/xslt/src/xslt/txEXSLTFunctions.cpp
@@ -606,30 +606,30 @@ txEXSLTFunctionCall::evaluate(txIEvalCon
         {
             nsRefPtr<txNodeSet> nodes;
             rv = evaluateToNodeSet(mParams[0], aContext,
                                    getter_AddRefs(nodes));
             NS_ENSURE_SUCCESS(rv, rv);
 
             if (nodes->isEmpty()) {
                 return aContext->recycler()->
-                    getNumberResult(Double::NaN, aResult);
+                    getNumberResult(txDouble::NaN, aResult);
             }
 
             bool findMax = mType == MAX;
 
             double res = findMax ? txDouble::NEGATIVE_INFINITY :
                                    txDouble::POSITIVE_INFINITY;
             PRInt32 i, len = nodes->size();
             for (i = 0; i < len; ++i) {
                 nsAutoString str;
                 txXPathNodeUtils::appendNodeValue(nodes->get(i), str);
-                double val = Double::toDouble(str);
-                if (Double::isNaN(val)) {
-                    res = Double::NaN;
+                double val = txDouble::toDouble(str);
+                if (txDouble::isNaN(val)) {
+                    res = txDouble::NaN;
                     break;
                 }
 
                 if (findMax ? (val > res) : (val < res)) {
                     res = val;
                 }
             }
 
@@ -656,18 +656,18 @@ txEXSLTFunctionCall::evaluate(txIEvalCon
             bool findMax = mType == HIGHEST;
             double res = findMax ? txDouble::NEGATIVE_INFINITY :
                                    txDouble::POSITIVE_INFINITY;
             PRInt32 i, len = nodes->size();
             for (i = 0; i < len; ++i) {
                 nsAutoString str;
                 const txXPathNode& node = nodes->get(i);
                 txXPathNodeUtils::appendNodeValue(node, str);
-                double val = Double::toDouble(str);
-                if (Double::isNaN(val)) {
+                double val = txDouble::toDouble(str);
+                if (txDouble::isNaN(val)) {
                     resultSet->clear();
                     break;
                 }
                 if (findMax ? (val > res) : (val < res)) {
                     resultSet->clear();
                     res = val;
                 }
 
--- a/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp
+++ b/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp
@@ -107,26 +107,26 @@ txFormatNumberFunctionCall::evaluate(txI
         err.AppendLiteral(" for: ");
         toString(err);
 #endif
         aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG);
         return NS_ERROR_XPATH_INVALID_ARG;
     }
 
     // Special cases
-    if (Double::isNaN(value)) {
+    if (txDouble::isNaN(value)) {
         return aContext->recycler()->getStringResult(format->mNaN, aResult);
     }
 
-    if (value == Double::POSITIVE_INFINITY) {
+    if (value == txDouble::POSITIVE_INFINITY) {
         return aContext->recycler()->getStringResult(format->mInfinity,
                                                      aResult);
     }
 
-    if (value == Double::NEGATIVE_INFINITY) {
+    if (value == txDouble::NEGATIVE_INFINITY) {
         nsAutoString res;
         res.Append(format->mMinusSign);
         res.Append(format->mInfinity);
         return aContext->recycler()->getStringResult(res, aResult);
     }
     
     // Value is a normal finite number
     nsAutoString prefix;
@@ -138,17 +138,17 @@ txFormatNumberFunctionCall::evaluate(txI
     int groupSize=-1;
 
     PRUint32 pos = 0;
     PRUint32 formatLen = formatStr.Length();
     bool inQuote;
 
     // Get right subexpression
     inQuote = false;
-    if (Double::isNeg(value)) {
+    if (txDouble::isNeg(value)) {
         while (pos < formatLen &&
                (inQuote ||
                 formatStr.CharAt(pos) != format->mPatternSeparator)) {
             if (formatStr.CharAt(pos) == FORMAT_QUOTE)
                 inQuote = !inQuote;
             pos++;
         }
 
--- a/content/xslt/src/xslt/txInstructions.h
+++ b/content/xslt/src/xslt/txInstructions.h
@@ -46,17 +46,17 @@
 #include "txNamespaceMap.h"
 #include "nsAutoPtr.h"
 #include "txXSLTNumber.h"
 #include "nsTArray.h"
 
 class nsIAtom;
 class txExecutionState;
 
-class txInstruction : public TxObject
+class txInstruction : public txObject
 {
 public:
     txInstruction()
     {
         MOZ_COUNT_CTOR(txInstruction);
     }
 
     virtual ~txInstruction()
--- a/content/xslt/src/xslt/txNodeSorter.cpp
+++ b/content/xslt/src/xslt/txNodeSorter.cpp
@@ -175,33 +175,33 @@ txNodeSorter::sortNodeSet(txNodeSet* aNo
 
     rv = aEs->pushEvalContext(evalContext);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Create and set up memoryblock for sort-values and indexarray
     PRUint32 len = static_cast<PRUint32>(aNodes->size());
 
     // Limit resource use to something sane.
-    PRUint32 itemSize = sizeof(PRUint32) + mNKeys * sizeof(TxObject*);
-    if (mNKeys > (PR_UINT32_MAX - sizeof(PRUint32)) / sizeof(TxObject*) ||
+    PRUint32 itemSize = sizeof(PRUint32) + mNKeys * sizeof(txObject*);
+    if (mNKeys > (PR_UINT32_MAX - sizeof(PRUint32)) / sizeof(txObject*) ||
         len >= PR_UINT32_MAX / itemSize) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     void* mem = PR_Malloc(len * itemSize);
     NS_ENSURE_TRUE(mem, NS_ERROR_OUT_OF_MEMORY);
 
     PRUint32* indexes = static_cast<PRUint32*>(mem);
-    TxObject** sortValues = reinterpret_cast<TxObject**>(indexes + len);
+    txObject** sortValues = reinterpret_cast<txObject**>(indexes + len);
 
     PRUint32 i;
     for (i = 0; i < len; ++i) {
         indexes[i] = i;
     }
-    memset(sortValues, 0, len * mNKeys * sizeof(TxObject*));
+    memset(sortValues, 0, len * mNKeys * sizeof(txObject*));
 
     // Sort the indexarray
     SortData sortData;
     sortData.mNodeSorter = this;
     sortData.mContext = evalContext;
     sortData.mSortValues = sortValues;
     sortData.mRv = NS_OK;
     NS_QuickSort(indexes, len, sizeof(PRUint32), compareNodes, &sortData);
@@ -243,19 +243,19 @@ txNodeSorter::compareNodes(const void* a
                            void* aSortData)
 {
     SortData* sortData = static_cast<SortData*>(aSortData);
     NS_ENSURE_SUCCESS(sortData->mRv, -1);
 
     txListIterator iter(&sortData->mNodeSorter->mSortKeys);
     PRUint32 indexA = *static_cast<const PRUint32*>(aIndexA);
     PRUint32 indexB = *static_cast<const PRUint32*>(aIndexB);
-    TxObject** sortValuesA = sortData->mSortValues +
+    txObject** sortValuesA = sortData->mSortValues +
                              indexA * sortData->mNodeSorter->mNKeys;
-    TxObject** sortValuesB = sortData->mSortValues +
+    txObject** sortValuesB = sortData->mSortValues +
                              indexB * sortData->mNodeSorter->mNKeys;
 
     unsigned int i;
     // Step through each key until a difference is found
     for (i = 0; i < sortData->mNodeSorter->mNKeys; ++i) {
         SortKey* key = (SortKey*)iter.next();
         // Lazy create sort values
         if (!sortValuesA[i] &&
@@ -275,17 +275,17 @@ txNodeSorter::compareNodes(const void* a
     }
     // All keys have the same value for these nodes
 
     return indexA - indexB;
 }
 
 //static
 bool
-txNodeSorter::calcSortValue(TxObject*& aSortValue, SortKey* aKey,
+txNodeSorter::calcSortValue(txObject*& aSortValue, SortKey* aKey,
                             SortData* aSortData, PRUint32 aNodeIndex)
 {
     aSortData->mContext->setPosition(aNodeIndex + 1); // position is 1-based
 
     nsresult rv = aKey->mComparator->createSortableValue(aKey->mExpr,
                                                          aSortData->mContext,
                                                          aSortValue);
     if (NS_FAILED(rv)) {
--- a/content/xslt/src/xslt/txNodeSorter.h
+++ b/content/xslt/src/xslt/txNodeSorter.h
@@ -41,17 +41,17 @@
 #define TRANSFRMX_NODESORTER_H
 
 #include "txCore.h"
 #include "txList.h"
 
 class Expr;
 class txExecutionState;
 class txNodeSet;
-class TxObject;
+class txObject;
 class txXPathResultComparator;
 class txIEvalContext;
 class txNodeSetContext;
 
 /*
  * Sorts Nodes as specified by the W3C XSLT 1.0 Recommendation
  */
 
@@ -67,26 +67,26 @@ public:
     nsresult sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs,
                          txNodeSet** aResult);
 
 private:
     struct SortData
     {
         txNodeSorter* mNodeSorter;
         txNodeSetContext* mContext;
-        TxObject** mSortValues;
+        txObject** mSortValues;
         nsresult mRv;
     };
     struct SortKey
     {
         Expr* mExpr;
         txXPathResultComparator* mComparator;
     };
 
     static int compareNodes(const void* aIndexA, const void* aIndexB,
                             void* aSortData);
-    static bool calcSortValue(TxObject*& aSortValue, SortKey* aKey,
-                                SortData* aSortData, PRUint32 aNodeIndex);
+    static bool calcSortValue(txObject*& aSortValue, SortKey* aKey,
+                              SortData* aSortData, PRUint32 aNodeIndex);
     txList mSortKeys;
     unsigned int mNKeys;
 };
 
 #endif
--- a/content/xslt/src/xslt/txRtfHandler.cpp
+++ b/content/xslt/src/xslt/txRtfHandler.cpp
@@ -72,17 +72,17 @@ bool txResultTreeFragment::booleanValue(
 }
 
 double txResultTreeFragment::numberValue()
 {
     if (!mBuffer) {
         return 0;
     }
 
-    return Double::toDouble(mBuffer->mStringValue);
+    return txDouble::toDouble(mBuffer->mStringValue);
 }
 
 nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler* aHandler)
 {
     if (!mBuffer) {
         return NS_ERROR_FAILURE;
     }
 
--- a/content/xslt/src/xslt/txStylesheet.cpp
+++ b/content/xslt/src/xslt/txStylesheet.cpp
@@ -437,19 +437,19 @@ txStylesheet::addTemplate(txTemplateItem
         unionPattern = simple;
         simple = unionPattern->getSubPatternAt(0);
         unionPattern->setSubPatternAt(0, nsnull);
     }
 
     PRUint32 unionPos = 1; // only used when unionPattern is set
     while (simple) {
         double priority = aTemplate->mPrio;
-        if (Double::isNaN(priority)) {
+        if (txDouble::isNaN(priority)) {
             priority = simple->getDefaultPriority();
-            NS_ASSERTION(!Double::isNaN(priority),
+            NS_ASSERTION(!txDouble::isNaN(priority),
                          "simple pattern without default priority");
         }
 
         PRUint32 i, len = templates->Length();
         for (i = 0; i < len; ++i) {
             if (priority > (*templates)[i].mPriority) {
                 break;
             }
--- a/content/xslt/src/xslt/txStylesheet.h
+++ b/content/xslt/src/xslt/txStylesheet.h
@@ -123,17 +123,17 @@ public:
 
         // Map of template modes
         txOwningExpandedNameMap< nsTArray<MatchableTemplate> > mMatchableTemplates;
 
         // ImportFrame which is the first one *not* imported by this frame
         ImportFrame* mFirstNotImported;
     };
 
-    class GlobalVariable : public TxObject {
+    class GlobalVariable : public txObject {
     public:
         GlobalVariable(nsAutoPtr<Expr> aExpr,
                        nsAutoPtr<txInstruction> aFirstInstruction,
                        bool aIsParam);
 
         nsAutoPtr<Expr> mExpr;
         nsAutoPtr<txInstruction> mFirstInstruction;
         bool mIsParam;
--- a/content/xslt/src/xslt/txStylesheetCompileHandlers.cpp
+++ b/content/xslt/src/xslt/txStylesheetCompileHandlers.cpp
@@ -298,26 +298,26 @@ getPatternAttr(txStylesheetAttr* aAttrib
 static nsresult
 getNumberAttr(txStylesheetAttr* aAttributes,
               PRInt32 aAttrCount,
               nsIAtom* aName,
               bool aRequired,
               txStylesheetCompilerState& aState,
               double& aNumber)
 {
-    aNumber = Double::NaN;
+    aNumber = txDouble::NaN;
     txStylesheetAttr* attr = nsnull;
     nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
                                aName, aRequired, &attr);
     if (!attr) {
         return rv;
     }
 
-    aNumber = Double::toDouble(attr->mValue);
-    if (Double::isNaN(aNumber) && (aRequired || !aState.fcp())) {
+    aNumber = txDouble::toDouble(attr->mValue);
+    if (txDouble::isNaN(aNumber) && (aRequired || !aState.fcp())) {
         // XXX ErrorReport: number parse failure
         return NS_ERROR_XSLT_PARSE_FAILURE;
     }
 
     return NS_OK;
 }
 
 static nsresult
@@ -547,17 +547,17 @@ txFnStartLREStylesheet(PRInt32 aNamespac
                        txStylesheetCompilerState& aState)
 {
     txStylesheetAttr* attr;
     nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_XSLT,
                                nsGkAtoms::version, true, &attr);
     NS_ENSURE_SUCCESS(rv, rv);
 
     txExpandedName nullExpr;
-    double prio = Double::NaN;
+    double prio = txDouble::NaN;
 
     nsAutoPtr<txPattern> match(new txRootPattern());
     NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY);
 
     nsAutoPtr<txTemplateItem> templ(new txTemplateItem(match, nullExpr,
                                                        nullExpr, prio));
     NS_ENSURE_TRUE(templ, NS_ERROR_OUT_OF_MEMORY);
 
@@ -1140,17 +1140,17 @@ txFnStartTemplate(PRInt32 aNamespaceID,
                       aState, name);
     NS_ENSURE_SUCCESS(rv, rv);
 
     txExpandedName mode;
     rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::mode, false,
                       aState, mode);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    double prio = Double::NaN;
+    double prio = txDouble::NaN;
     rv = getNumberAttr(aAttributes, aAttrCount, nsGkAtoms::priority,
                        false, aState, prio);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoPtr<txPattern> match;
     rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match,
                         name.isNull(), aState, match);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/content/xslt/src/xslt/txStylesheetCompiler.cpp
+++ b/content/xslt/src/xslt/txStylesheetCompiler.cpp
@@ -683,25 +683,25 @@ txStylesheetCompilerState::pushChooseGot
 void
 txStylesheetCompilerState::popChooseGotoList()
 {
     // this will delete the old value
     mChooseGotoList = static_cast<txList*>(popObject());
 }
 
 nsresult
-txStylesheetCompilerState::pushObject(TxObject* aObject)
+txStylesheetCompilerState::pushObject(txObject* aObject)
 {
     return mObjectStack.push(aObject);
 }
 
-TxObject*
+txObject*
 txStylesheetCompilerState::popObject()
 {
-    return static_cast<TxObject*>(mObjectStack.pop());
+    return static_cast<txObject*>(mObjectStack.pop());
 }
 
 nsresult
 txStylesheetCompilerState::pushPtr(void* aPtr)
 {
 #ifdef TX_DEBUG_STACK
     PR_LOG(txLog::xslt, PR_LOG_DEBUG, ("pushPtr: %d\n", aPtr));
 #endif
--- a/content/xslt/src/xslt/txStylesheetCompiler.h
+++ b/content/xslt/src/xslt/txStylesheetCompiler.h
@@ -55,17 +55,17 @@ class txElementContext;
 class txInstructionContainer;
 class txInstruction;
 class txNamespaceMap;
 class txToplevelItem;
 class txPushNewContext;
 class txStylesheetCompiler;
 class txInScopeVariable;
 
-class txElementContext : public TxObject
+class txElementContext : public txObject
 {
 public:
     txElementContext(const nsAString& aBaseURI);
     txElementContext(const txElementContext& aOther);
 
     bool mPreserveWhitespace;
     bool mForwardsCompatibleParsing;
     nsString mBaseURI;
@@ -117,18 +117,18 @@ public:
 
     // Stack functions
     nsresult pushHandlerTable(txHandlerTable* aTable);
     void popHandlerTable();
     nsresult pushSorter(txPushNewContext* aSorter);
     void popSorter();
     nsresult pushChooseGotoList();
     void popChooseGotoList();
-    nsresult pushObject(TxObject* aObject);
-    TxObject* popObject();
+    nsresult pushObject(txObject* aObject);
+    txObject* popObject();
     nsresult pushPtr(void* aPtr);
     void* popPtr();
 
     // stylesheet functions
     nsresult addToplevelItem(txToplevelItem* aItem);
     nsresult openInstructionContainer(txInstructionContainer* aContainer);
     void closeInstructionContainer();
     nsresult addInstruction(nsAutoPtr<txInstruction> aInstruction);
--- a/content/xslt/src/xslt/txXPathResultComparator.cpp
+++ b/content/xslt/src/xslt/txXPathResultComparator.cpp
@@ -124,17 +124,17 @@ txResultStringComparator::createSortable
                                         nsCaseKey, &val->mKey, &val->mLength);
     NS_ENSURE_SUCCESS(rv, rv);
 
     aResult = val.forget();
 
     return NS_OK;
 }
 
-int txResultStringComparator::compareValues(TxObject* aVal1, TxObject* aVal2)
+int txResultStringComparator::compareValues(txObject* aVal1, txObject* aVal2)
 {
     StringValue* strval1 = (StringValue*)aVal1;
     StringValue* strval2 = (StringValue*)aVal2;
 
     if (!mCollation)
         return -1;
 
     if (strval1->mLength == 0) {
@@ -218,17 +218,17 @@ txResultStringComparator::StringValue::~
 txResultNumberComparator::txResultNumberComparator(bool aAscending)
 {
     mAscending = aAscending ? 1 : -1;
 }
 
 nsresult
 txResultNumberComparator::createSortableValue(Expr *aExpr,
                                               txIEvalContext *aContext,
-                                              TxObject *&aResult)
+                                              txObject *&aResult)
 {
     nsAutoPtr<NumberValue> numval(new NumberValue);
     if (!numval) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     nsRefPtr<txAExprResult> exprRes;
     nsresult rv = aExpr->evaluate(aContext, getter_AddRefs(exprRes));
@@ -236,24 +236,24 @@ txResultNumberComparator::createSortable
 
     numval->mVal = exprRes->numberValue();
 
     aResult = numval.forget();
 
     return NS_OK;
 }
 
-int txResultNumberComparator::compareValues(TxObject* aVal1, TxObject* aVal2)
+int txResultNumberComparator::compareValues(txObject* aVal1, txObject* aVal2)
 {
     double dval1 = ((NumberValue*)aVal1)->mVal;
     double dval2 = ((NumberValue*)aVal2)->mVal;
 
-    if (Double::isNaN(dval1))
-        return Double::isNaN(dval2) ? 0 : -mAscending;
+    if (txDouble::isNaN(dval1))
+        return txDouble::isNaN(dval2) ? 0 : -mAscending;
 
-    if (Double::isNaN(dval2))
+    if (txDouble::isNaN(dval2))
         return mAscending;
 
     if (dval1 == dval2)
         return 0;
     
     return (dval1 < dval2) ? -mAscending : mAscending;
 }
--- a/content/xslt/src/xslt/txXPathResultComparator.h
+++ b/content/xslt/src/xslt/txXPathResultComparator.h
@@ -57,47 +57,47 @@ public:
     virtual ~txXPathResultComparator()
     {
     }
 
     /*
      * Compares two XPath results. Returns -1 if val1 < val2,
      * 1 if val1 > val2 and 0 if val1 == val2.
      */
-    virtual int compareValues(TxObject* val1, TxObject* val2) = 0;
+    virtual int compareValues(txObject* val1, txObject* val2) = 0;
     
     /*
      * Create a sortable value.
      */
     virtual nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
-                                         TxObject *&aResult) = 0;
+                                         txObject *&aResult) = 0;
 };
 
 /*
  * Compare results as stings (data-type="text")
  */
 class txResultStringComparator : public txXPathResultComparator
 {
 public:
     txResultStringComparator(bool aAscending, bool aUpperFirst,
                              const nsAFlatString& aLanguage);
 
-    int compareValues(TxObject* aVal1, TxObject* aVal2);
+    int compareValues(txObject* aVal1, txObject* aVal2);
     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
-                                 TxObject *&aResult);
+                                 txObject *&aResult);
 private:
     nsCOMPtr<nsICollation> mCollation;
     nsresult init(const nsAFlatString& aLanguage);
     nsresult createRawSortKey(const PRInt32 aStrength,
                               const nsString& aString,
                               PRUint8** aKey,
                               PRUint32* aLength);
     int mSorting;
 
-    class StringValue : public TxObject
+    class StringValue : public txObject
     {
     public:
         StringValue();
         ~StringValue();
 
         PRUint8* mKey;
         void* mCaseKey;
         PRUint32 mLength, mCaseLength;
@@ -107,23 +107,23 @@ private:
 /*
  * Compare results as numbers (data-type="number")
  */
 class txResultNumberComparator : public txXPathResultComparator
 {
 public:
     txResultNumberComparator(bool aAscending);
 
-    int compareValues(TxObject* aVal1, TxObject* aVal2);
+    int compareValues(txObject* aVal1, txObject* aVal2);
     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
-                                 TxObject *&aResult);
+                                 txObject *&aResult);
 
 private:
     int mAscending;
 
-    class NumberValue : public TxObject
+    class NumberValue : public txObject
     {
     public:
         double mVal;
     };
 };
 
 #endif
--- a/content/xslt/src/xslt/txXSLTNumber.cpp
+++ b/content/xslt/src/xslt/txXSLTNumber.cpp
@@ -117,19 +117,19 @@ txXSLTNumber::getValueList(Expr* aValueE
     // If the value attribute exists then use that
     if (aValueExpr) {
         nsRefPtr<txAExprResult> result;
         rv = aValueExpr->evaluate(aContext, getter_AddRefs(result));
         NS_ENSURE_SUCCESS(rv, rv);
 
         double value = result->numberValue();
 
-        if (Double::isInfinite(value) || Double::isNaN(value) ||
+        if (txDouble::isInfinite(value) || txDouble::isNaN(value) ||
             value < 0.5) {
-            Double::toString(value, aValueString);
+            txDouble::toString(value, aValueString);
             return NS_OK;
         }
         
         aValues.add(NS_INT32_TO_PTR((PRInt32)floor(value + 0.5)));
         return NS_OK;
     }
 
 
@@ -313,17 +313,17 @@ txXSLTNumber::getCounters(Expr* aGroupSi
 
     nsAutoString groupSeparator;
     PRInt32 groupSize = 0;
     if (aGroupSize && aGroupSeparator) {
         nsAutoString sizeStr;
         rv = aGroupSize->evaluateToString(aContext, sizeStr);
         NS_ENSURE_SUCCESS(rv, rv);
 
-        double size = Double::toDouble(sizeStr);
+        double size = txDouble::toDouble(sizeStr);
         groupSize = (PRInt32)size;
         if ((double)groupSize != size) {
             groupSize = 0;
         }
 
         rv = aGroupSeparator->evaluateToString(aContext, groupSeparator);
         NS_ENSURE_SUCCESS(rv, rv);
     }
--- a/content/xslt/src/xslt/txXSLTPatterns.cpp
+++ b/content/xslt/src/xslt/txXSLTPatterns.cpp
@@ -49,17 +49,17 @@
 /*
  * Returns the default priority of this Pattern.
  * UnionPatterns don't like this.
  * This should be called on the simple patterns.
  */
 double txUnionPattern::getDefaultPriority()
 {
     NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
-    return Double::NaN;
+    return txDouble::NaN;
 }
 
 /*
  * Determines whether this Pattern matches the given node within
  * the given context
  * This should be called on the simple patterns for xsl:template,
  * but is fine for xsl:key and xsl:number
  */