mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
f51c82302b
--HG-- rename : content/xslt/src/base/moz.build => dom/xslt/base/moz.build rename : content/xslt/src/base/txCore.h => dom/xslt/base/txCore.h rename : content/xslt/src/base/txDouble.cpp => dom/xslt/base/txDouble.cpp rename : content/xslt/src/base/txErrorObserver.h => dom/xslt/base/txErrorObserver.h rename : content/xslt/src/base/txExpandedNameMap.cpp => dom/xslt/base/txExpandedNameMap.cpp rename : content/xslt/src/base/txExpandedNameMap.h => dom/xslt/base/txExpandedNameMap.h rename : content/xslt/src/base/txList.cpp => dom/xslt/base/txList.cpp rename : content/xslt/src/base/txList.h => dom/xslt/base/txList.h rename : content/xslt/src/base/txLog.h => dom/xslt/base/txLog.h rename : content/xslt/src/base/txNamespaceMap.cpp => dom/xslt/base/txNamespaceMap.cpp rename : content/xslt/src/base/txNamespaceMap.h => dom/xslt/base/txNamespaceMap.h rename : content/xslt/src/base/txOwningArray.h => dom/xslt/base/txOwningArray.h rename : content/xslt/src/base/txStack.h => dom/xslt/base/txStack.h rename : content/xslt/src/base/txStringUtils.h => dom/xslt/base/txStringUtils.h rename : content/xslt/src/base/txURIUtils.cpp => dom/xslt/base/txURIUtils.cpp rename : content/xslt/src/base/txURIUtils.h => dom/xslt/base/txURIUtils.h rename : content/xslt/crashtests/111994.xml => dom/xslt/crashtests/111994.xml rename : content/xslt/crashtests/111994.xsl => dom/xslt/crashtests/111994.xsl rename : content/xslt/crashtests/182460-select.xml => dom/xslt/crashtests/182460-select.xml rename : content/xslt/crashtests/182460-selects.xsl => dom/xslt/crashtests/182460-selects.xsl rename : content/xslt/crashtests/182460-table.xhtml => dom/xslt/crashtests/182460-table.xhtml rename : content/xslt/crashtests/226425.xml => dom/xslt/crashtests/226425.xml rename : content/xslt/crashtests/226425.xsl => dom/xslt/crashtests/226425.xsl rename : content/xslt/crashtests/406106-1.html => dom/xslt/crashtests/406106-1.html rename : content/xslt/crashtests/483444.xml => dom/xslt/crashtests/483444.xml rename : content/xslt/crashtests/485217.xml => dom/xslt/crashtests/485217.xml rename : content/xslt/crashtests/485217.xsl => dom/xslt/crashtests/485217.xsl rename : content/xslt/crashtests/485286.xml => dom/xslt/crashtests/485286.xml rename : content/xslt/crashtests/528300.xml => dom/xslt/crashtests/528300.xml rename : content/xslt/crashtests/528488.xml => dom/xslt/crashtests/528488.xml rename : content/xslt/crashtests/528963.xml => dom/xslt/crashtests/528963.xml rename : content/xslt/crashtests/545927.html => dom/xslt/crashtests/545927.html rename : content/xslt/crashtests/601543.html => dom/xslt/crashtests/601543.html rename : content/xslt/crashtests/602115.html => dom/xslt/crashtests/602115.html rename : content/xslt/crashtests/603844.html => dom/xslt/crashtests/603844.html rename : content/xslt/crashtests/667315.xml => dom/xslt/crashtests/667315.xml rename : content/xslt/crashtests/91332.xml => dom/xslt/crashtests/91332.xml rename : content/xslt/crashtests/91332.xsl => dom/xslt/crashtests/91332.xsl rename : content/xslt/crashtests/crashtests.list => dom/xslt/crashtests/crashtests.list rename : content/xslt/public/moz.build => dom/xslt/moz.build rename : content/xslt/public/nsIDocumentTransformer.h => dom/xslt/nsIDocumentTransformer.h rename : content/xslt/public/nsIXSLTException.idl => dom/xslt/nsIXSLTException.idl rename : content/xslt/public/nsIXSLTProcessor.idl => dom/xslt/nsIXSLTProcessor.idl rename : content/xslt/public/nsIXSLTProcessorPrivate.idl => dom/xslt/nsIXSLTProcessorPrivate.idl rename : content/xslt/tests/XSLTMark/XSLTMark-static.js => dom/xslt/tests/XSLTMark/XSLTMark-static.js rename : content/xslt/tests/XSLTMark/XSLTMark-test.js => dom/xslt/tests/XSLTMark/XSLTMark-test.js rename : content/xslt/tests/XSLTMark/XSLTMark-view.js => dom/xslt/tests/XSLTMark/XSLTMark-view.js rename : content/xslt/tests/XSLTMark/XSLTMark.css => dom/xslt/tests/XSLTMark/XSLTMark.css rename : content/xslt/tests/XSLTMark/XSLTMark.xul => dom/xslt/tests/XSLTMark/XSLTMark.xul rename : content/xslt/tests/buster/DiffDOM.js => dom/xslt/tests/buster/DiffDOM.js rename : content/xslt/tests/buster/DumpDOM.js => dom/xslt/tests/buster/DumpDOM.js rename : content/xslt/tests/buster/ReadMe => dom/xslt/tests/buster/ReadMe rename : content/xslt/tests/buster/buster-files.js => dom/xslt/tests/buster/buster-files.js rename : content/xslt/tests/buster/buster-handlers.js => dom/xslt/tests/buster/buster-handlers.js rename : content/xslt/tests/buster/buster-statics.js => dom/xslt/tests/buster/buster-statics.js rename : content/xslt/tests/buster/buster-test.js => dom/xslt/tests/buster/buster-test.js rename : content/xslt/tests/buster/buster-view.js => dom/xslt/tests/buster/buster-view.js rename : content/xslt/tests/buster/buster.css => dom/xslt/tests/buster/buster.css rename : content/xslt/tests/buster/buster.xul => dom/xslt/tests/buster/buster.xul rename : content/xslt/tests/buster/helper/generate-rdf.pl => dom/xslt/tests/buster/helper/generate-rdf.pl rename : content/xslt/tests/buster/install.js => dom/xslt/tests/buster/install.js rename : content/xslt/tests/buster/jar.mn => dom/xslt/tests/buster/jar.mn rename : content/xslt/tests/buster/moz.build => dom/xslt/tests/buster/moz.build rename : content/xslt/tests/buster/result-inspector.xul => dom/xslt/tests/buster/result-inspector.xul rename : content/xslt/tests/buster/result-view.css => dom/xslt/tests/buster/result-view.css rename : content/xslt/tests/buster/result-view.js => dom/xslt/tests/buster/result-view.js rename : content/xslt/tests/buster/result-view.xul => dom/xslt/tests/buster/result-view.xul rename : content/xslt/tests/buster/xslt-qa-overlay.js => dom/xslt/tests/buster/xslt-qa-overlay.js rename : content/xslt/tests/buster/xslt-qa-overlay.xul => dom/xslt/tests/buster/xslt-qa-overlay.xul rename : content/xslt/tests/mochitest/mochitest.ini => dom/xslt/tests/mochitest/mochitest.ini rename : content/xslt/tests/mochitest/moz.build => dom/xslt/tests/mochitest/moz.build rename : content/xslt/tests/mochitest/test_bug319374.xhtml => dom/xslt/tests/mochitest/test_bug319374.xhtml rename : content/xslt/tests/mochitest/test_bug427060.html => dom/xslt/tests/mochitest/test_bug427060.html rename : content/xslt/tests/mochitest/test_bug440974.html => dom/xslt/tests/mochitest/test_bug440974.html rename : content/xslt/tests/mochitest/test_bug453441.html => dom/xslt/tests/mochitest/test_bug453441.html rename : content/xslt/tests/mochitest/test_bug468208.html => dom/xslt/tests/mochitest/test_bug468208.html rename : content/xslt/tests/mochitest/test_bug511487.html => dom/xslt/tests/mochitest/test_bug511487.html rename : content/xslt/tests/mochitest/test_bug551412.html => dom/xslt/tests/mochitest/test_bug551412.html rename : content/xslt/tests/mochitest/test_bug551654.html => dom/xslt/tests/mochitest/test_bug551654.html rename : content/xslt/tests/mochitest/test_bug566629.html => dom/xslt/tests/mochitest/test_bug566629.html rename : content/xslt/tests/mochitest/test_bug566629.xhtml => dom/xslt/tests/mochitest/test_bug566629.xhtml rename : content/xslt/tests/mochitest/test_bug603159.html => dom/xslt/tests/mochitest/test_bug603159.html rename : content/xslt/tests/mochitest/test_bug616774.html => dom/xslt/tests/mochitest/test_bug616774.html rename : content/xslt/tests/mochitest/test_bug667315.html => dom/xslt/tests/mochitest/test_bug667315.html rename : content/xslt/tests/mochitest/test_exslt_regex.html => dom/xslt/tests/mochitest/test_exslt_regex.html rename : content/xslt/public/txIEXSLTRegExFunctions.idl => dom/xslt/txIEXSLTRegExFunctions.idl rename : content/xslt/public/txIFunctionEvaluationContext.idl => dom/xslt/txIFunctionEvaluationContext.idl rename : content/xslt/public/txINodeSet.idl => dom/xslt/txINodeSet.idl rename : content/xslt/public/txIXPathObject.idl => dom/xslt/txIXPathObject.idl rename : content/xslt/src/xml/moz.build => dom/xslt/xml/moz.build rename : content/xslt/src/xml/txXMLParser.cpp => dom/xslt/xml/txXMLParser.cpp rename : content/xslt/src/xml/txXMLParser.h => dom/xslt/xml/txXMLParser.h rename : content/xslt/src/xml/txXMLUtils.cpp => dom/xslt/xml/txXMLUtils.cpp rename : content/xslt/src/xml/txXMLUtils.h => dom/xslt/xml/txXMLUtils.h rename : content/xslt/src/xpath/XPathEvaluator.cpp => dom/xslt/xpath/XPathEvaluator.cpp rename : content/xslt/src/xpath/XPathEvaluator.h => dom/xslt/xpath/XPathEvaluator.h rename : content/xslt/src/xpath/moz.build => dom/xslt/xpath/moz.build rename : content/xslt/src/xpath/nsXPathExpression.cpp => dom/xslt/xpath/nsXPathExpression.cpp rename : content/xslt/src/xpath/nsXPathExpression.h => dom/xslt/xpath/nsXPathExpression.h rename : content/xslt/src/xpath/nsXPathNSResolver.cpp => dom/xslt/xpath/nsXPathNSResolver.cpp rename : content/xslt/src/xpath/nsXPathNSResolver.h => dom/xslt/xpath/nsXPathNSResolver.h rename : content/xslt/src/xpath/nsXPathResult.cpp => dom/xslt/xpath/nsXPathResult.cpp rename : content/xslt/src/xpath/nsXPathResult.h => dom/xslt/xpath/nsXPathResult.h rename : content/xslt/src/xpath/txBooleanExpr.cpp => dom/xslt/xpath/txBooleanExpr.cpp rename : content/xslt/src/xpath/txBooleanResult.cpp => dom/xslt/xpath/txBooleanResult.cpp rename : content/xslt/src/xpath/txCoreFunctionCall.cpp => dom/xslt/xpath/txCoreFunctionCall.cpp rename : content/xslt/src/xpath/txErrorExpr.cpp => dom/xslt/xpath/txErrorExpr.cpp rename : content/xslt/src/xpath/txExpr.cpp => dom/xslt/xpath/txExpr.cpp rename : content/xslt/src/xpath/txExpr.h => dom/xslt/xpath/txExpr.h rename : content/xslt/src/xpath/txExprLexer.cpp => dom/xslt/xpath/txExprLexer.cpp rename : content/xslt/src/xpath/txExprLexer.h => dom/xslt/xpath/txExprLexer.h rename : content/xslt/src/xpath/txExprParser.cpp => dom/xslt/xpath/txExprParser.cpp rename : content/xslt/src/xpath/txExprParser.h => dom/xslt/xpath/txExprParser.h rename : content/xslt/src/xpath/txExprResult.h => dom/xslt/xpath/txExprResult.h rename : content/xslt/src/xpath/txFilterExpr.cpp => dom/xslt/xpath/txFilterExpr.cpp rename : content/xslt/src/xpath/txForwardContext.cpp => dom/xslt/xpath/txForwardContext.cpp rename : content/xslt/src/xpath/txForwardContext.h => dom/xslt/xpath/txForwardContext.h rename : content/xslt/src/xpath/txFunctionCall.cpp => dom/xslt/xpath/txFunctionCall.cpp rename : content/xslt/src/xpath/txIXPathContext.h => dom/xslt/xpath/txIXPathContext.h rename : content/xslt/src/xpath/txLiteralExpr.cpp => dom/xslt/xpath/txLiteralExpr.cpp rename : content/xslt/src/xpath/txLocationStep.cpp => dom/xslt/xpath/txLocationStep.cpp rename : content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp => dom/xslt/xpath/txMozillaXPathTreeWalker.cpp rename : content/xslt/src/xpath/txNameTest.cpp => dom/xslt/xpath/txNameTest.cpp rename : content/xslt/src/xpath/txNamedAttributeStep.cpp => dom/xslt/xpath/txNamedAttributeStep.cpp rename : content/xslt/src/xpath/txNodeSet.cpp => dom/xslt/xpath/txNodeSet.cpp rename : content/xslt/src/xpath/txNodeSet.h => dom/xslt/xpath/txNodeSet.h rename : content/xslt/src/xpath/txNodeSetAdaptor.cpp => dom/xslt/xpath/txNodeSetAdaptor.cpp rename : content/xslt/src/xpath/txNodeSetAdaptor.h => dom/xslt/xpath/txNodeSetAdaptor.h rename : content/xslt/src/xpath/txNodeSetContext.cpp => dom/xslt/xpath/txNodeSetContext.cpp rename : content/xslt/src/xpath/txNodeSetContext.h => dom/xslt/xpath/txNodeSetContext.h rename : content/xslt/src/xpath/txNodeTypeTest.cpp => dom/xslt/xpath/txNodeTypeTest.cpp rename : content/xslt/src/xpath/txNumberExpr.cpp => dom/xslt/xpath/txNumberExpr.cpp rename : content/xslt/src/xpath/txNumberResult.cpp => dom/xslt/xpath/txNumberResult.cpp rename : content/xslt/src/xpath/txPathExpr.cpp => dom/xslt/xpath/txPathExpr.cpp rename : content/xslt/src/xpath/txPredicateList.cpp => dom/xslt/xpath/txPredicateList.cpp rename : content/xslt/src/xpath/txPredicatedNodeTest.cpp => dom/xslt/xpath/txPredicatedNodeTest.cpp rename : content/xslt/src/xpath/txRelationalExpr.cpp => dom/xslt/xpath/txRelationalExpr.cpp rename : content/xslt/src/xpath/txResultRecycler.cpp => dom/xslt/xpath/txResultRecycler.cpp rename : content/xslt/src/xpath/txResultRecycler.h => dom/xslt/xpath/txResultRecycler.h rename : content/xslt/src/xpath/txRootExpr.cpp => dom/xslt/xpath/txRootExpr.cpp rename : content/xslt/src/xpath/txSingleNodeContext.h => dom/xslt/xpath/txSingleNodeContext.h rename : content/xslt/src/xpath/txStringResult.cpp => dom/xslt/xpath/txStringResult.cpp rename : content/xslt/src/xpath/txUnaryExpr.cpp => dom/xslt/xpath/txUnaryExpr.cpp rename : content/xslt/src/xpath/txUnionExpr.cpp => dom/xslt/xpath/txUnionExpr.cpp rename : content/xslt/src/xpath/txUnionNodeTest.cpp => dom/xslt/xpath/txUnionNodeTest.cpp rename : content/xslt/src/xpath/txVariableRefExpr.cpp => dom/xslt/xpath/txVariableRefExpr.cpp rename : content/xslt/src/xpath/txXPCOMExtensionFunction.cpp => dom/xslt/xpath/txXPCOMExtensionFunction.cpp rename : content/xslt/src/xpath/txXPathNode.h => dom/xslt/xpath/txXPathNode.h rename : content/xslt/src/xpath/txXPathObjectAdaptor.h => dom/xslt/xpath/txXPathObjectAdaptor.h rename : content/xslt/src/xpath/txXPathOptimizer.cpp => dom/xslt/xpath/txXPathOptimizer.cpp rename : content/xslt/src/xpath/txXPathOptimizer.h => dom/xslt/xpath/txXPathOptimizer.h rename : content/xslt/src/xpath/txXPathTreeWalker.h => dom/xslt/xpath/txXPathTreeWalker.h rename : content/xslt/src/xslt/moz.build => dom/xslt/xslt/moz.build rename : content/xslt/src/xslt/txBufferingHandler.cpp => dom/xslt/xslt/txBufferingHandler.cpp rename : content/xslt/src/xslt/txBufferingHandler.h => dom/xslt/xslt/txBufferingHandler.h rename : content/xslt/src/xslt/txCurrentFunctionCall.cpp => dom/xslt/xslt/txCurrentFunctionCall.cpp rename : content/xslt/src/xslt/txDocumentFunctionCall.cpp => dom/xslt/xslt/txDocumentFunctionCall.cpp rename : content/xslt/src/xslt/txEXSLTFunctions.cpp => dom/xslt/xslt/txEXSLTFunctions.cpp rename : content/xslt/src/xslt/txEXSLTRegExFunctions.js => dom/xslt/xslt/txEXSLTRegExFunctions.js rename : content/xslt/src/xslt/txEXSLTRegExFunctions.manifest => dom/xslt/xslt/txEXSLTRegExFunctions.manifest rename : content/xslt/src/xslt/txExecutionState.cpp => dom/xslt/xslt/txExecutionState.cpp rename : content/xslt/src/xslt/txExecutionState.h => dom/xslt/xslt/txExecutionState.h rename : content/xslt/src/xslt/txFormatNumberFunctionCall.cpp => dom/xslt/xslt/txFormatNumberFunctionCall.cpp rename : content/xslt/src/xslt/txGenerateIdFunctionCall.cpp => dom/xslt/xslt/txGenerateIdFunctionCall.cpp rename : content/xslt/src/xslt/txInstructions.cpp => dom/xslt/xslt/txInstructions.cpp rename : content/xslt/src/xslt/txInstructions.h => dom/xslt/xslt/txInstructions.h rename : content/xslt/src/xslt/txKey.h => dom/xslt/xslt/txKey.h rename : content/xslt/src/xslt/txKeyFunctionCall.cpp => dom/xslt/xslt/txKeyFunctionCall.cpp rename : content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp => dom/xslt/xslt/txMozillaStylesheetCompiler.cpp rename : content/xslt/src/xslt/txMozillaTextOutput.cpp => dom/xslt/xslt/txMozillaTextOutput.cpp rename : content/xslt/src/xslt/txMozillaTextOutput.h => dom/xslt/xslt/txMozillaTextOutput.h rename : content/xslt/src/xslt/txMozillaXMLOutput.cpp => dom/xslt/xslt/txMozillaXMLOutput.cpp rename : content/xslt/src/xslt/txMozillaXMLOutput.h => dom/xslt/xslt/txMozillaXMLOutput.h rename : content/xslt/src/xslt/txMozillaXSLTProcessor.cpp => dom/xslt/xslt/txMozillaXSLTProcessor.cpp rename : content/xslt/src/xslt/txMozillaXSLTProcessor.h => dom/xslt/xslt/txMozillaXSLTProcessor.h rename : content/xslt/src/xslt/txNodeSorter.cpp => dom/xslt/xslt/txNodeSorter.cpp rename : content/xslt/src/xslt/txNodeSorter.h => dom/xslt/xslt/txNodeSorter.h rename : content/xslt/src/xslt/txOutputFormat.cpp => dom/xslt/xslt/txOutputFormat.cpp rename : content/xslt/src/xslt/txOutputFormat.h => dom/xslt/xslt/txOutputFormat.h rename : content/xslt/src/xslt/txPatternOptimizer.cpp => dom/xslt/xslt/txPatternOptimizer.cpp rename : content/xslt/src/xslt/txPatternOptimizer.h => dom/xslt/xslt/txPatternOptimizer.h rename : content/xslt/src/xslt/txPatternParser.cpp => dom/xslt/xslt/txPatternParser.cpp rename : content/xslt/src/xslt/txPatternParser.h => dom/xslt/xslt/txPatternParser.h rename : content/xslt/src/xslt/txRtfHandler.cpp => dom/xslt/xslt/txRtfHandler.cpp rename : content/xslt/src/xslt/txRtfHandler.h => dom/xslt/xslt/txRtfHandler.h rename : content/xslt/src/xslt/txStylesheet.cpp => dom/xslt/xslt/txStylesheet.cpp rename : content/xslt/src/xslt/txStylesheet.h => dom/xslt/xslt/txStylesheet.h rename : content/xslt/src/xslt/txStylesheetCompileHandlers.cpp => dom/xslt/xslt/txStylesheetCompileHandlers.cpp rename : content/xslt/src/xslt/txStylesheetCompileHandlers.h => dom/xslt/xslt/txStylesheetCompileHandlers.h rename : content/xslt/src/xslt/txStylesheetCompiler.cpp => dom/xslt/xslt/txStylesheetCompiler.cpp rename : content/xslt/src/xslt/txStylesheetCompiler.h => dom/xslt/xslt/txStylesheetCompiler.h rename : content/xslt/src/xslt/txTextHandler.cpp => dom/xslt/xslt/txTextHandler.cpp rename : content/xslt/src/xslt/txTextHandler.h => dom/xslt/xslt/txTextHandler.h rename : content/xslt/src/xslt/txToplevelItems.cpp => dom/xslt/xslt/txToplevelItems.cpp rename : content/xslt/src/xslt/txToplevelItems.h => dom/xslt/xslt/txToplevelItems.h rename : content/xslt/src/xslt/txUnknownHandler.cpp => dom/xslt/xslt/txUnknownHandler.cpp rename : content/xslt/src/xslt/txUnknownHandler.h => dom/xslt/xslt/txUnknownHandler.h rename : content/xslt/src/xslt/txVariableMap.h => dom/xslt/xslt/txVariableMap.h rename : content/xslt/src/xslt/txXMLEventHandler.h => dom/xslt/xslt/txXMLEventHandler.h rename : content/xslt/src/xslt/txXPathResultComparator.cpp => dom/xslt/xslt/txXPathResultComparator.cpp rename : content/xslt/src/xslt/txXPathResultComparator.h => dom/xslt/xslt/txXPathResultComparator.h rename : content/xslt/src/xslt/txXSLTEnvironmentFunctionCall.cpp => dom/xslt/xslt/txXSLTEnvironmentFunctionCall.cpp rename : content/xslt/src/xslt/txXSLTFunctions.h => dom/xslt/xslt/txXSLTFunctions.h rename : content/xslt/src/xslt/txXSLTNumber.cpp => dom/xslt/xslt/txXSLTNumber.cpp rename : content/xslt/src/xslt/txXSLTNumber.h => dom/xslt/xslt/txXSLTNumber.h rename : content/xslt/src/xslt/txXSLTNumberCounters.cpp => dom/xslt/xslt/txXSLTNumberCounters.cpp rename : content/xslt/src/xslt/txXSLTPatterns.cpp => dom/xslt/xslt/txXSLTPatterns.cpp rename : content/xslt/src/xslt/txXSLTPatterns.h => dom/xslt/xslt/txXSLTPatterns.h rename : content/xslt/src/xslt/txXSLTProcessor.cpp => dom/xslt/xslt/txXSLTProcessor.cpp rename : content/xslt/src/xslt/txXSLTProcessor.h => dom/xslt/xslt/txXSLTProcessor.h extra : rebase_source : 2ffae4527252a6937dd1ee2053d2c9d4fbe268fb
743 lines
23 KiB
C++
743 lines
23 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/ArrayUtils.h"
|
|
#include "mozilla/FloatingPoint.h"
|
|
|
|
#include "txExpr.h"
|
|
#include "nsAutoPtr.h"
|
|
#include "txNodeSet.h"
|
|
#include "nsGkAtoms.h"
|
|
#include "txIXPathContext.h"
|
|
#include "nsWhitespaceTokenizer.h"
|
|
#include "txXPathTreeWalker.h"
|
|
#include <math.h>
|
|
#include "txStringUtils.h"
|
|
#include "txXMLUtils.h"
|
|
|
|
using namespace mozilla;
|
|
|
|
struct txCoreFunctionDescriptor
|
|
{
|
|
int8_t mMinParams;
|
|
int8_t mMaxParams;
|
|
Expr::ResultType mReturnType;
|
|
nsIAtom** mName;
|
|
};
|
|
|
|
// This must be ordered in the same order as txCoreFunctionCall::eType.
|
|
// If you change one, change the other.
|
|
static const txCoreFunctionDescriptor descriptTable[] =
|
|
{
|
|
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::count }, // COUNT
|
|
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::id }, // ID
|
|
{ 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::last }, // LAST
|
|
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::localName }, // LOCAL_NAME
|
|
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::namespaceUri }, // NAMESPACE_URI
|
|
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::name }, // NAME
|
|
{ 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::position }, // POSITION
|
|
|
|
{ 2, -1, Expr::STRING_RESULT, &nsGkAtoms::concat }, // CONCAT
|
|
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::contains }, // CONTAINS
|
|
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::normalizeSpace }, // NORMALIZE_SPACE
|
|
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::startsWith }, // STARTS_WITH
|
|
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::string }, // STRING
|
|
{ 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::stringLength }, // STRING_LENGTH
|
|
{ 2, 3, Expr::STRING_RESULT, &nsGkAtoms::substring }, // SUBSTRING
|
|
{ 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringAfter }, // SUBSTRING_AFTER
|
|
{ 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringBefore }, // SUBSTRING_BEFORE
|
|
{ 3, 3, Expr::STRING_RESULT, &nsGkAtoms::translate }, // TRANSLATE
|
|
|
|
{ 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::number }, // NUMBER
|
|
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::round }, // ROUND
|
|
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::floor }, // FLOOR
|
|
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::ceiling }, // CEILING
|
|
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::sum }, // SUM
|
|
|
|
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::boolean }, // BOOLEAN
|
|
{ 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_false }, // _FALSE
|
|
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::lang }, // LANG
|
|
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::_not }, // _NOT
|
|
{ 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_true } // _TRUE
|
|
};
|
|
|
|
|
|
/*
|
|
* Evaluates this Expr based on the given context node and processor state
|
|
* @param context the context node for evaluation of this Expr
|
|
* @param ps the ContextState containing the stack information needed
|
|
* for evaluation
|
|
* @return the result of the evaluation
|
|
*/
|
|
nsresult
|
|
txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|
{
|
|
*aResult = nullptr;
|
|
|
|
if (!requireParams(descriptTable[mType].mMinParams,
|
|
descriptTable[mType].mMaxParams,
|
|
aContext)) {
|
|
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
|
}
|
|
|
|
nsresult rv = NS_OK;
|
|
switch (mType) {
|
|
case COUNT:
|
|
{
|
|
nsRefPtr<txNodeSet> nodes;
|
|
rv = evaluateToNodeSet(mParams[0], aContext,
|
|
getter_AddRefs(nodes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
return aContext->recycler()->getNumberResult(nodes->size(),
|
|
aResult);
|
|
}
|
|
case ID:
|
|
{
|
|
nsRefPtr<txAExprResult> exprResult;
|
|
rv = mParams[0]->evaluate(aContext, getter_AddRefs(exprResult));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
nsRefPtr<txNodeSet> resultSet;
|
|
rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
txXPathTreeWalker walker(aContext->getContextNode());
|
|
|
|
if (exprResult->getResultType() == txAExprResult::NODESET) {
|
|
txNodeSet* nodes = static_cast<txNodeSet*>
|
|
(static_cast<txAExprResult*>
|
|
(exprResult));
|
|
int32_t i;
|
|
for (i = 0; i < nodes->size(); ++i) {
|
|
nsAutoString idList;
|
|
txXPathNodeUtils::appendNodeValue(nodes->get(i), idList);
|
|
nsWhitespaceTokenizer tokenizer(idList);
|
|
while (tokenizer.hasMoreTokens()) {
|
|
if (walker.moveToElementById(tokenizer.nextToken())) {
|
|
resultSet->add(walker.getCurrentPosition());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
nsAutoString idList;
|
|
exprResult->stringValue(idList);
|
|
nsWhitespaceTokenizer tokenizer(idList);
|
|
while (tokenizer.hasMoreTokens()) {
|
|
if (walker.moveToElementById(tokenizer.nextToken())) {
|
|
resultSet->add(walker.getCurrentPosition());
|
|
}
|
|
}
|
|
}
|
|
|
|
*aResult = resultSet;
|
|
NS_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case LAST:
|
|
{
|
|
return aContext->recycler()->getNumberResult(aContext->size(),
|
|
aResult);
|
|
}
|
|
case LOCAL_NAME:
|
|
case NAME:
|
|
case NAMESPACE_URI:
|
|
{
|
|
// Check for optional arg
|
|
nsRefPtr<txNodeSet> nodes;
|
|
if (!mParams.IsEmpty()) {
|
|
rv = evaluateToNodeSet(mParams[0], aContext,
|
|
getter_AddRefs(nodes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (nodes->isEmpty()) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
}
|
|
|
|
const txXPathNode& node = nodes ? nodes->get(0) :
|
|
aContext->getContextNode();
|
|
switch (mType) {
|
|
case LOCAL_NAME:
|
|
{
|
|
StringResult* strRes = nullptr;
|
|
rv = aContext->recycler()->getStringResult(&strRes);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
*aResult = strRes;
|
|
txXPathNodeUtils::getLocalName(node, strRes->mValue);
|
|
|
|
return NS_OK;
|
|
}
|
|
case NAMESPACE_URI:
|
|
{
|
|
StringResult* strRes = nullptr;
|
|
rv = aContext->recycler()->getStringResult(&strRes);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
*aResult = strRes;
|
|
txXPathNodeUtils::getNamespaceURI(node, strRes->mValue);
|
|
|
|
return NS_OK;
|
|
}
|
|
case NAME:
|
|
{
|
|
// XXX Namespace: namespaces have a name
|
|
if (txXPathNodeUtils::isAttribute(node) ||
|
|
txXPathNodeUtils::isElement(node) ||
|
|
txXPathNodeUtils::isProcessingInstruction(node)) {
|
|
StringResult* strRes = nullptr;
|
|
rv = aContext->recycler()->getStringResult(&strRes);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
*aResult = strRes;
|
|
txXPathNodeUtils::getNodeName(node, strRes->mValue);
|
|
}
|
|
else {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
default:
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
case POSITION:
|
|
{
|
|
return aContext->recycler()->getNumberResult(aContext->position(),
|
|
aResult);
|
|
}
|
|
|
|
// String functions
|
|
|
|
case CONCAT:
|
|
{
|
|
nsRefPtr<StringResult> strRes;
|
|
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
uint32_t i, len = mParams.Length();
|
|
for (i = 0; i < len; ++i) {
|
|
rv = mParams[i]->evaluateToString(aContext, strRes->mValue);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
|
|
NS_ADDREF(*aResult = strRes);
|
|
|
|
return NS_OK;
|
|
}
|
|
case CONTAINS:
|
|
{
|
|
nsAutoString arg2;
|
|
rv = mParams[1]->evaluateToString(aContext, arg2);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (arg2.IsEmpty()) {
|
|
aContext->recycler()->getBoolResult(true, aResult);
|
|
}
|
|
else {
|
|
nsAutoString arg1;
|
|
rv = mParams[0]->evaluateToString(aContext, arg1);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
aContext->recycler()->getBoolResult(FindInReadable(arg2, arg1),
|
|
aResult);
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
case NORMALIZE_SPACE:
|
|
{
|
|
nsAutoString resultStr;
|
|
if (!mParams.IsEmpty()) {
|
|
rv = mParams[0]->evaluateToString(aContext, resultStr);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
else {
|
|
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
|
resultStr);
|
|
}
|
|
|
|
nsRefPtr<StringResult> strRes;
|
|
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
bool addSpace = false;
|
|
bool first = true;
|
|
strRes->mValue.SetCapacity(resultStr.Length());
|
|
char16_t c;
|
|
uint32_t src;
|
|
for (src = 0; src < resultStr.Length(); src++) {
|
|
c = resultStr.CharAt(src);
|
|
if (XMLUtils::isWhitespace(c)) {
|
|
addSpace = true;
|
|
}
|
|
else {
|
|
if (addSpace && !first)
|
|
strRes->mValue.Append(char16_t(' '));
|
|
|
|
strRes->mValue.Append(c);
|
|
addSpace = false;
|
|
first = false;
|
|
}
|
|
}
|
|
*aResult = strRes;
|
|
NS_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case STARTS_WITH:
|
|
{
|
|
nsAutoString arg2;
|
|
rv = mParams[1]->evaluateToString(aContext, arg2);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
bool result = false;
|
|
if (arg2.IsEmpty()) {
|
|
result = true;
|
|
}
|
|
else {
|
|
nsAutoString arg1;
|
|
rv = mParams[0]->evaluateToString(aContext, arg1);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
result = StringBeginsWith(arg1, arg2);
|
|
}
|
|
|
|
aContext->recycler()->getBoolResult(result, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case STRING:
|
|
{
|
|
nsRefPtr<StringResult> strRes;
|
|
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (!mParams.IsEmpty()) {
|
|
rv = mParams[0]->evaluateToString(aContext, strRes->mValue);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
else {
|
|
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
|
strRes->mValue);
|
|
}
|
|
|
|
NS_ADDREF(*aResult = strRes);
|
|
|
|
return NS_OK;
|
|
}
|
|
case STRING_LENGTH:
|
|
{
|
|
nsAutoString resultStr;
|
|
if (!mParams.IsEmpty()) {
|
|
rv = mParams[0]->evaluateToString(aContext, resultStr);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
else {
|
|
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
|
resultStr);
|
|
}
|
|
rv = aContext->recycler()->getNumberResult(resultStr.Length(),
|
|
aResult);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
return NS_OK;
|
|
}
|
|
case SUBSTRING:
|
|
{
|
|
nsAutoString src;
|
|
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 (mozilla::IsNaN(start) ||
|
|
mozilla::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 (mozilla::IsNaN(end) || end < 0) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
if (end > src.Length())
|
|
end = src.Length();
|
|
else
|
|
end = floor(end + 0.5);
|
|
}
|
|
else {
|
|
end = src.Length();
|
|
}
|
|
|
|
if (start < 0)
|
|
start = 0;
|
|
|
|
if (start > end) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
return aContext->recycler()->getStringResult(
|
|
Substring(src, (uint32_t)start, (uint32_t)(end - start)),
|
|
aResult);
|
|
}
|
|
case SUBSTRING_AFTER:
|
|
{
|
|
nsAutoString arg1;
|
|
rv = mParams[0]->evaluateToString(aContext, arg1);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
nsAutoString arg2;
|
|
rv = mParams[1]->evaluateToString(aContext, arg2);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (arg2.IsEmpty()) {
|
|
return aContext->recycler()->getStringResult(arg1, aResult);
|
|
}
|
|
|
|
int32_t idx = arg1.Find(arg2);
|
|
if (idx == kNotFound) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
const nsSubstring& result = Substring(arg1, idx + arg2.Length());
|
|
return aContext->recycler()->getStringResult(result, aResult);
|
|
}
|
|
case SUBSTRING_BEFORE:
|
|
{
|
|
nsAutoString arg2;
|
|
rv = mParams[1]->evaluateToString(aContext, arg2);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (arg2.IsEmpty()) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsAutoString arg1;
|
|
rv = mParams[0]->evaluateToString(aContext, arg1);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
int32_t idx = arg1.Find(arg2);
|
|
if (idx == kNotFound) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
return aContext->recycler()->getStringResult(StringHead(arg1, idx),
|
|
aResult);
|
|
}
|
|
case TRANSLATE:
|
|
{
|
|
nsAutoString src;
|
|
rv = mParams[0]->evaluateToString(aContext, src);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (src.IsEmpty()) {
|
|
aContext->recycler()->getEmptyStringResult(aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsRefPtr<StringResult> strRes;
|
|
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
strRes->mValue.SetCapacity(src.Length());
|
|
|
|
nsAutoString oldChars, newChars;
|
|
rv = mParams[1]->evaluateToString(aContext, oldChars);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = mParams[2]->evaluateToString(aContext, newChars);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
uint32_t i;
|
|
int32_t newCharsLength = (int32_t)newChars.Length();
|
|
for (i = 0; i < src.Length(); i++) {
|
|
int32_t idx = oldChars.FindChar(src.CharAt(i));
|
|
if (idx != kNotFound) {
|
|
if (idx < newCharsLength)
|
|
strRes->mValue.Append(newChars.CharAt((uint32_t)idx));
|
|
}
|
|
else {
|
|
strRes->mValue.Append(src.CharAt(i));
|
|
}
|
|
}
|
|
|
|
NS_ADDREF(*aResult = strRes);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
// Number functions
|
|
|
|
case NUMBER:
|
|
{
|
|
double res;
|
|
if (!mParams.IsEmpty()) {
|
|
rv = evaluateToNumber(mParams[0], aContext, &res);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
else {
|
|
nsAutoString resultStr;
|
|
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
|
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 (mozilla::IsFinite(dbl)) {
|
|
if (mozilla::IsNegative(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 (mozilla::IsFinite(dbl) && !mozilla::IsNegativeZero(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 (mozilla::IsFinite(dbl)) {
|
|
if (mozilla::IsNegative(dbl) && dbl > -1)
|
|
dbl *= 0;
|
|
else
|
|
dbl = ceil(dbl);
|
|
}
|
|
|
|
return aContext->recycler()->getNumberResult(dbl, aResult);
|
|
}
|
|
case SUM:
|
|
{
|
|
nsRefPtr<txNodeSet> nodes;
|
|
nsresult rv = evaluateToNodeSet(mParams[0], aContext,
|
|
getter_AddRefs(nodes));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
double res = 0;
|
|
int32_t i;
|
|
for (i = 0; i < nodes->size(); ++i) {
|
|
nsAutoString resultStr;
|
|
txXPathNodeUtils::appendNodeValue(nodes->get(i), resultStr);
|
|
res += txDouble::toDouble(resultStr);
|
|
}
|
|
return aContext->recycler()->getNumberResult(res, aResult);
|
|
}
|
|
|
|
// Boolean functions
|
|
|
|
case BOOLEAN:
|
|
{
|
|
bool result;
|
|
nsresult rv = mParams[0]->evaluateToBool(aContext, result);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
aContext->recycler()->getBoolResult(result, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case _FALSE:
|
|
{
|
|
aContext->recycler()->getBoolResult(false, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case LANG:
|
|
{
|
|
txXPathTreeWalker walker(aContext->getContextNode());
|
|
|
|
nsAutoString lang;
|
|
bool found;
|
|
do {
|
|
found = walker.getAttr(nsGkAtoms::lang, kNameSpaceID_XML,
|
|
lang);
|
|
} while (!found && walker.moveToParent());
|
|
|
|
if (!found) {
|
|
aContext->recycler()->getBoolResult(false, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsAutoString arg;
|
|
rv = mParams[0]->evaluateToString(aContext, arg);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
bool result =
|
|
StringBeginsWith(lang, arg,
|
|
txCaseInsensitiveStringComparator()) &&
|
|
(lang.Length() == arg.Length() ||
|
|
lang.CharAt(arg.Length()) == '-');
|
|
|
|
aContext->recycler()->getBoolResult(result, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case _NOT:
|
|
{
|
|
bool result;
|
|
rv = mParams[0]->evaluateToBool(aContext, result);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
aContext->recycler()->getBoolResult(!result, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
case _TRUE:
|
|
{
|
|
aContext->recycler()->getBoolResult(true, aResult);
|
|
|
|
return NS_OK;
|
|
}
|
|
}
|
|
|
|
aContext->receiveError(NS_LITERAL_STRING("Internal error"),
|
|
NS_ERROR_UNEXPECTED);
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
Expr::ResultType
|
|
txCoreFunctionCall::getReturnType()
|
|
{
|
|
return descriptTable[mType].mReturnType;
|
|
}
|
|
|
|
bool
|
|
txCoreFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|
{
|
|
switch (mType) {
|
|
case COUNT:
|
|
case CONCAT:
|
|
case CONTAINS:
|
|
case STARTS_WITH:
|
|
case SUBSTRING:
|
|
case SUBSTRING_AFTER:
|
|
case SUBSTRING_BEFORE:
|
|
case TRANSLATE:
|
|
case ROUND:
|
|
case FLOOR:
|
|
case CEILING:
|
|
case SUM:
|
|
case BOOLEAN:
|
|
case _NOT:
|
|
case _FALSE:
|
|
case _TRUE:
|
|
{
|
|
return argsSensitiveTo(aContext);
|
|
}
|
|
case ID:
|
|
{
|
|
return (aContext & NODE_CONTEXT) ||
|
|
argsSensitiveTo(aContext);
|
|
}
|
|
case LAST:
|
|
{
|
|
return !!(aContext & SIZE_CONTEXT);
|
|
}
|
|
case LOCAL_NAME:
|
|
case NAME:
|
|
case NAMESPACE_URI:
|
|
case NORMALIZE_SPACE:
|
|
case STRING:
|
|
case STRING_LENGTH:
|
|
case NUMBER:
|
|
{
|
|
if (mParams.IsEmpty()) {
|
|
return !!(aContext & NODE_CONTEXT);
|
|
}
|
|
return argsSensitiveTo(aContext);
|
|
}
|
|
case POSITION:
|
|
{
|
|
return !!(aContext & POSITION_CONTEXT);
|
|
}
|
|
case LANG:
|
|
{
|
|
return (aContext & NODE_CONTEXT) ||
|
|
argsSensitiveTo(aContext);
|
|
}
|
|
}
|
|
|
|
NS_NOTREACHED("how'd we get here?");
|
|
return true;
|
|
}
|
|
|
|
// static
|
|
bool
|
|
txCoreFunctionCall::getTypeFromAtom(nsIAtom* aName, eType& aType)
|
|
{
|
|
uint32_t i;
|
|
for (i = 0; i < ArrayLength(descriptTable); ++i) {
|
|
if (aName == *descriptTable[i].mName) {
|
|
aType = static_cast<eType>(i);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
#ifdef TX_TO_STRING
|
|
nsresult
|
|
txCoreFunctionCall::getNameAtom(nsIAtom** aAtom)
|
|
{
|
|
NS_ADDREF(*aAtom = *descriptTable[mType].mName);
|
|
return NS_OK;
|
|
}
|
|
#endif
|