зеркало из https://github.com/mozilla/pjs.git
Convert CR-LF line endings to LF to fix bustage.
This commit is contained in:
Родитель
8be0445811
Коммит
be93ce6812
|
@ -35,56 +35,56 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIXFormsUtilityService_h
|
||||
#define nsIXFormsUtilityService_h
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/* For IDL files that don't want to include root IDL files. */
|
||||
#ifndef NS_NO_VTABLE
|
||||
#define NS_NO_VTABLE
|
||||
#endif
|
||||
class nsIDOMNode; /* forward declaration */
|
||||
|
||||
class nsIXFormsModelElement; /* forward declaration */
|
||||
|
||||
|
||||
/* starting interface: nsIXFormsUtilityService */
|
||||
#define NS_IXFORMSUTILITYSERVICE_IID_STR "4a744a59-8771-4065-959d-b8de3dad81da"
|
||||
|
||||
#define NS_IXFORMSUTILITYSERVICE_IID \
|
||||
{0x4a744a59, 0x8771, 0x4065, \
|
||||
{ 0x95, 0x9d, 0xb8, 0xde, 0x3d, 0xad, 0x81, 0xda }}
|
||||
|
||||
#define NS_XFORMS_UTILITY_CONTRACTID "@mozilla.org/xforms-utility-service;1"
|
||||
|
||||
/* Use this macro when declaring classes that implement this interface. */
|
||||
#define NS_DECL_NSIXFORMSUTILITYSERVICE \
|
||||
NS_IMETHOD GetModelFromNode(nsIDOMNode *node, nsIDOMNode **_retval); \
|
||||
NS_IMETHOD IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel, PRBool *_retval); \
|
||||
NS_IMETHOD GetInstanceDocumentRoot(const nsAString & aID, nsIDOMNode *aModelNode, nsIDOMNode **_retval); \
|
||||
NS_IMETHOD ValidateString(const nsAString & aValue, const nsAString & aType, const nsAString & aNamespace, PRBool *_retval);
|
||||
|
||||
/**
|
||||
* Private interface implemented by the nsXFormsUtilityService in XForms extension.
|
||||
* Defining it here to prevent XPath requiring XForms extension.
|
||||
*/
|
||||
class NS_NO_VTABLE nsIXFormsUtilityService : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXFORMSUTILITYSERVICE_IID)
|
||||
|
||||
/**
|
||||
* Function to get the corresponding model element from a xforms node or
|
||||
* a xforms instance data node.
|
||||
*/
|
||||
/* nsIDOMNode getModelFromNode (in nsIDOMNode node); */
|
||||
NS_IMETHOD GetModelFromNode(nsIDOMNode *node, nsIDOMNode **_retval) = 0;
|
||||
|
||||
/**
|
||||
* Function to see if the given node is associated with the given model.
|
||||
#ifndef nsIXFormsUtilityService_h
|
||||
#define nsIXFormsUtilityService_h
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/* For IDL files that don't want to include root IDL files. */
|
||||
#ifndef NS_NO_VTABLE
|
||||
#define NS_NO_VTABLE
|
||||
#endif
|
||||
class nsIDOMNode; /* forward declaration */
|
||||
|
||||
class nsIXFormsModelElement; /* forward declaration */
|
||||
|
||||
|
||||
/* starting interface: nsIXFormsUtilityService */
|
||||
#define NS_IXFORMSUTILITYSERVICE_IID_STR "4a744a59-8771-4065-959d-b8de3dad81da"
|
||||
|
||||
#define NS_IXFORMSUTILITYSERVICE_IID \
|
||||
{0x4a744a59, 0x8771, 0x4065, \
|
||||
{ 0x95, 0x9d, 0xb8, 0xde, 0x3d, 0xad, 0x81, 0xda }}
|
||||
|
||||
#define NS_XFORMS_UTILITY_CONTRACTID "@mozilla.org/xforms-utility-service;1"
|
||||
|
||||
/* Use this macro when declaring classes that implement this interface. */
|
||||
#define NS_DECL_NSIXFORMSUTILITYSERVICE \
|
||||
NS_IMETHOD GetModelFromNode(nsIDOMNode *node, nsIDOMNode **_retval); \
|
||||
NS_IMETHOD IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel, PRBool *_retval); \
|
||||
NS_IMETHOD GetInstanceDocumentRoot(const nsAString & aID, nsIDOMNode *aModelNode, nsIDOMNode **_retval); \
|
||||
NS_IMETHOD ValidateString(const nsAString & aValue, const nsAString & aType, const nsAString & aNamespace, PRBool *_retval);
|
||||
|
||||
/**
|
||||
* Private interface implemented by the nsXFormsUtilityService in XForms extension.
|
||||
* Defining it here to prevent XPath requiring XForms extension.
|
||||
*/
|
||||
class NS_NO_VTABLE nsIXFormsUtilityService : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXFORMSUTILITYSERVICE_IID)
|
||||
|
||||
/**
|
||||
* Function to get the corresponding model element from a xforms node or
|
||||
* a xforms instance data node.
|
||||
*/
|
||||
/* nsIDOMNode getModelFromNode (in nsIDOMNode node); */
|
||||
NS_IMETHOD GetModelFromNode(nsIDOMNode *node, nsIDOMNode **_retval) = 0;
|
||||
|
||||
/**
|
||||
* Function to see if the given node is associated with the given model.
|
||||
* Right now this function is only called by XPath in the case of the
|
||||
* instance() function.
|
||||
* The provided node can be an instance node from an instance
|
||||
|
@ -95,30 +95,30 @@ class NS_NO_VTABLE nsIXFormsUtilityService : public nsISupports {
|
|||
* Form controls are associated with model elements either explicitly through
|
||||
* single-node binding or implicitly (if model cannot by calculated, it
|
||||
* will use the first model element encountered in the document). The model
|
||||
* can also be inherited from a containing element like xforms:group or
|
||||
* xforms:repeat.
|
||||
*/
|
||||
/* PRBool isNodeAssocWithModel (in nsIDOMNode aNode, in nsIDOMNode aModel); */
|
||||
NS_IMETHOD IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel, PRBool *_retval) = 0;
|
||||
|
||||
/**
|
||||
* Function to get the instance document root for the instance element with
|
||||
* the given id. The instance element must be associated with the given
|
||||
* model.
|
||||
*/
|
||||
/* nsIDOMNode getInstanceDocumentRoot (in DOMString aID, in nsIDOMNode aModelNode); */
|
||||
NS_IMETHOD GetInstanceDocumentRoot(const nsAString & aID, nsIDOMNode *aModelNode, nsIDOMNode **_retval) = 0;
|
||||
|
||||
/**
|
||||
* Function to ensure that aValue is of the schema type aType. Will basically
|
||||
* be a forwarder to the nsISchemaValidator function of the same name.
|
||||
*/
|
||||
/* boolean validateString (in AString aValue, in AString aType, in AString aNamespace); */
|
||||
NS_IMETHOD ValidateString(const nsAString & aValue, const nsAString & aType, const nsAString & aNamespace, PRBool *_retval) = 0;
|
||||
|
||||
};
|
||||
* can also be inherited from a containing element like xforms:group or
|
||||
* xforms:repeat.
|
||||
*/
|
||||
/* PRBool isNodeAssocWithModel (in nsIDOMNode aNode, in nsIDOMNode aModel); */
|
||||
NS_IMETHOD IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel, PRBool *_retval) = 0;
|
||||
|
||||
#define NS_ERROR_XFORMS_CALCUATION_EXCEPTION \
|
||||
/**
|
||||
* Function to get the instance document root for the instance element with
|
||||
* the given id. The instance element must be associated with the given
|
||||
* model.
|
||||
*/
|
||||
/* nsIDOMNode getInstanceDocumentRoot (in DOMString aID, in nsIDOMNode aModelNode); */
|
||||
NS_IMETHOD GetInstanceDocumentRoot(const nsAString & aID, nsIDOMNode *aModelNode, nsIDOMNode **_retval) = 0;
|
||||
|
||||
/**
|
||||
* Function to ensure that aValue is of the schema type aType. Will basically
|
||||
* be a forwarder to the nsISchemaValidator function of the same name.
|
||||
*/
|
||||
/* boolean validateString (in AString aValue, in AString aType, in AString aNamespace); */
|
||||
NS_IMETHOD ValidateString(const nsAString & aValue, const nsAString & aType, const nsAString & aNamespace, PRBool *_retval) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ERROR_XFORMS_CALCUATION_EXCEPTION \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GENERAL, 3001)
|
||||
|
||||
#endif /* nsIXFormsUtilityService_h */
|
||||
#endif /* nsIXFormsUtilityService_h */
|
||||
|
|
|
@ -35,21 +35,21 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIXFormsXPathEvaluator_h
|
||||
#define nsIXFormsXPathEvaluator_h
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/* For IDL files that don't want to include root IDL files. */
|
||||
#ifndef NS_NO_VTABLE
|
||||
#define NS_NO_VTABLE
|
||||
#endif
|
||||
class nsIDOMNode; /* forward declaration */
|
||||
class nsIDOMXPathExpression; /* forward declaration */
|
||||
|
||||
/* starting interface: nsIXFormsXPathEvaluator */
|
||||
|
||||
#ifndef nsIXFormsXPathEvaluator_h
|
||||
#define nsIXFormsXPathEvaluator_h
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/* For IDL files that don't want to include root IDL files. */
|
||||
#ifndef NS_NO_VTABLE
|
||||
#define NS_NO_VTABLE
|
||||
#endif
|
||||
class nsIDOMNode; /* forward declaration */
|
||||
class nsIDOMXPathExpression; /* forward declaration */
|
||||
|
||||
/* starting interface: nsIXFormsXPathEvaluator */
|
||||
#define NS_XFORMS_XPATH_EVALUATOR_CONTRACTID "@mozilla.org/dom/xforms-xpath-evaluator;1"
|
||||
/* a7e127c6-31ff-40b4-8780-15d6938b33d3 */
|
||||
#define TRANSFORMIIX_XFORMS_XPATH_EVALUATOR_CID \
|
||||
|
@ -58,40 +58,40 @@ class nsIDOMXPathExpression; /* forward declaration */
|
|||
/* 60050a4a-4c99-4bad-8c47-3b9b96caf2b4 */
|
||||
#define TRANSFORMIIX_XFORMS_XPATH_EVALUATOR_IID \
|
||||
{ 0x60050a4a, 0x4c99, 0x4bad, { 0x8c, 0x47, 0x3b, 0x9b, 0x96, 0xca, 0xf2, 0xb4 } }
|
||||
|
||||
/* Use this macro when declaring classes that implement this interface. */
|
||||
#define NS_DECL_NSIXFORMXPATHEVALUATOR \
|
||||
|
||||
/* Use this macro when declaring classes that implement this interface. */
|
||||
#define NS_DECL_NSIXFORMXPATHEVALUATOR \
|
||||
NS_IMETHOD CreateExpression(const nsAString & aExpression, nsIDOMNode *aResolverNode,nsIDOMXPathExpression **aResult); \
|
||||
NS_IMETHOD Evaluate(const nsAString & aExpression, nsIDOMNode *aContextNode, nsIDOMNode *aResolverNode, PRUint16 aType, nsISupports *aInResult, nsISupports **aResult);
|
||||
|
||||
/**
|
||||
* Private interface implemented by the nsXFormsXPathEvaluator in Transformiix
|
||||
* and will move to the XForms extension when XPath is made extensible. We
|
||||
|
||||
/**
|
||||
* Private interface implemented by the nsXFormsXPathEvaluator in Transformiix
|
||||
* and will move to the XForms extension when XPath is made extensible. We
|
||||
* are using this interface instead of nsIDOMXPathEvaluator since we can
|
||||
* don't really need all of that overhead. For example, this interface uses
|
||||
* a resolver node from the xforms document rather than forcing XForms to
|
||||
* create a namespace resolver node prior to creating the expression or
|
||||
* running an evaluation.
|
||||
*/
|
||||
class NS_NO_VTABLE nsIXFormsXPathEvaluator : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(TRANSFORMIIX_XFORMS_XPATH_EVALUATOR_IID)
|
||||
|
||||
/**
|
||||
* Function to create a nsIDOMXPathExpression from the provided expression
|
||||
* string. aResolverNode is the xforms node that the expression is
|
||||
*/
|
||||
class NS_NO_VTABLE nsIXFormsXPathEvaluator : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(TRANSFORMIIX_XFORMS_XPATH_EVALUATOR_IID)
|
||||
|
||||
/**
|
||||
* Function to create a nsIDOMXPathExpression from the provided expression
|
||||
* string. aResolverNode is the xforms node that the expression is
|
||||
* associated with.
|
||||
*/
|
||||
*/
|
||||
NS_IMETHOD CreateExpression(const nsAString & aExpression, nsIDOMNode *aResolverNode, nsIDOMXPathExpression **aResult) = 0;
|
||||
|
||||
/**
|
||||
* Function to evaluate the given expression. aResolverNode is the xforms
|
||||
|
||||
/**
|
||||
* Function to evaluate the given expression. aResolverNode is the xforms
|
||||
* node that the expression is associated with. The other parameters are as
|
||||
* required by DOM's XPathEvaluator.
|
||||
*/
|
||||
*/
|
||||
NS_IMETHOD Evaluate(const nsAString & aExpression, nsIDOMNode *aContextNode, nsIDOMNode *aResolverNode, PRUint16 aType, nsISupports *aInResult, nsISupports **aResult) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXFormsXPathEvaluator_h */
|
||||
};
|
||||
|
||||
#endif /* nsIXFormsXPathEvaluator_h */
|
||||
|
|
|
@ -155,18 +155,18 @@ nsresult nsXFormsXPathEvaluator::XFormsParseContextImpl::resolveNamespacePrefix
|
|||
nsVoidableString ns;
|
||||
nsresult rv;
|
||||
// begin - taken directly from nsXPathNSResolver::LookupNamespaceURI
|
||||
if (prefix.EqualsLiteral("xml")) {
|
||||
ns.AssignLiteral("http://www.w3.org/XML/1998/namespace");
|
||||
if (prefix.EqualsLiteral("xml")) {
|
||||
ns.AssignLiteral("http://www.w3.org/XML/1998/namespace");
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOM3Node> dom3Node = do_QueryInterface(mResolverNode);
|
||||
NS_ASSERTION(dom3Node, "Need a node to resolve namespaces.");
|
||||
nsCOMPtr<nsIDOM3Node> dom3Node = do_QueryInterface(mResolverNode);
|
||||
NS_ASSERTION(dom3Node, "Need a node to resolve namespaces.");
|
||||
if( dom3Node ) {
|
||||
rv = dom3Node->LookupNamespaceURI(prefix, ns);
|
||||
rv = dom3Node->LookupNamespaceURI(prefix, ns);
|
||||
}
|
||||
else {
|
||||
SetDOMStringToNull(ns);
|
||||
SetDOMStringToNull(ns);
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -263,11 +263,11 @@ PRBool nsXFormsXPathEvaluator::XFormsParseContextImpl::caseInsensitiveNameTests(
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsXFormsXPathEvaluator::XFormsParseContextImpl::fcp()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsXFormsXPathEvaluator::XFormsParseContextImpl::fcp()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsXFormsXPathEvaluator::XFormsParseContextImpl::SetErrorOffset(PRUint32 aOffset)
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
nsresult resolveFunctionCall(nsIAtom* aName, PRInt32 aID,
|
||||
FunctionCall*& aFunction);
|
||||
PRBool caseInsensitiveNameTests();
|
||||
PRBool fcp();
|
||||
PRBool fcp();
|
||||
void SetErrorOffset(PRUint32 aOffset);
|
||||
|
||||
private:
|
||||
|
|
|
@ -194,96 +194,96 @@ XFormsFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString instanceId;
|
||||
evaluateToString((Expr*)iter.next(), aContext, instanceId);
|
||||
evaluateToString((Expr*)iter.next(), aContext, instanceId);
|
||||
|
||||
// here document is the XForms document
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = mResolverNode->GetOwnerDocument(getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// here document is the XForms document
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = mResolverNode->GetOwnerDocument(getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(document, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> instEle;
|
||||
rv = document->GetElementById(instanceId, getter_AddRefs(instEle));
|
||||
|
||||
PRBool foundInstance = PR_FALSE;
|
||||
nsAutoString localname, namespaceURI;
|
||||
if (instEle) {
|
||||
instEle->GetLocalName(localname);
|
||||
instEle->GetNamespaceURI(namespaceURI);
|
||||
if (localname.EqualsLiteral("instance") &&
|
||||
|
||||
nsCOMPtr<nsIDOMElement> instEle;
|
||||
rv = document->GetElementById(instanceId, getter_AddRefs(instEle));
|
||||
|
||||
PRBool foundInstance = PR_FALSE;
|
||||
nsAutoString localname, namespaceURI;
|
||||
if (instEle) {
|
||||
instEle->GetLocalName(localname);
|
||||
instEle->GetNamespaceURI(namespaceURI);
|
||||
if (localname.EqualsLiteral("instance") &&
|
||||
namespaceURI.EqualsLiteral(NS_NAMESPACE_XFORMS)) {
|
||||
foundInstance = PR_TRUE;
|
||||
}
|
||||
foundInstance = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundInstance) {
|
||||
// We didn't find an instance element with the given id. Return the
|
||||
// empty result set.
|
||||
*aResult = resultSet;
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Make sure that this element is contained in the same
|
||||
// model as the context node of the expression as per
|
||||
// the XForms 1.0 spec.
|
||||
|
||||
// first step is to get the contextNode passed in to
|
||||
// the evaluation
|
||||
|
||||
nsCOMPtr<nsIDOMNode> xfContextNode;
|
||||
rv = txXPathNativeNode::getNode(aContext->getContextNode(),
|
||||
|
||||
if (!foundInstance) {
|
||||
// We didn't find an instance element with the given id. Return the
|
||||
// empty result set.
|
||||
*aResult = resultSet;
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Make sure that this element is contained in the same
|
||||
// model as the context node of the expression as per
|
||||
// the XForms 1.0 spec.
|
||||
|
||||
// first step is to get the contextNode passed in to
|
||||
// the evaluation
|
||||
|
||||
nsCOMPtr<nsIDOMNode> xfContextNode;
|
||||
rv = txXPathNativeNode::getNode(aContext->getContextNode(),
|
||||
getter_AddRefs(xfContextNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// now see if the node we found (instEle) and the
|
||||
// context node for the evaluation (xfContextNode) link
|
||||
// back to the same model.
|
||||
nsCOMPtr<nsIXFormsUtilityService>xformsService =
|
||||
do_GetService("@mozilla.org/xforms-utility-service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> instNode, modelInstance;
|
||||
instNode = do_QueryInterface(instEle);
|
||||
rv = xformsService->GetModelFromNode(instNode,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// now see if the node we found (instEle) and the
|
||||
// context node for the evaluation (xfContextNode) link
|
||||
// back to the same model.
|
||||
nsCOMPtr<nsIXFormsUtilityService>xformsService =
|
||||
do_GetService("@mozilla.org/xforms-utility-service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> instNode, modelInstance;
|
||||
instNode = do_QueryInterface(instEle);
|
||||
rv = xformsService->GetModelFromNode(instNode,
|
||||
getter_AddRefs(modelInstance));
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool modelContainsNode = PR_FALSE;
|
||||
rv = xformsService->IsNodeAssocWithModel(xfContextNode,
|
||||
modelInstance,
|
||||
&modelContainsNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (modelContainsNode) {
|
||||
// ok, we've found an instance node with the proper id
|
||||
// that fulfills the requirement of being from the
|
||||
// same model as the context node. Now we need to
|
||||
// return a 'node-set containing just the root
|
||||
// element node of the referenced instance data'.
|
||||
// Wonderful.
|
||||
|
||||
nsCOMPtr<nsIDOMNode> instanceRoot;
|
||||
rv = xformsService->GetInstanceDocumentRoot(
|
||||
instanceId,
|
||||
modelInstance,
|
||||
getter_AddRefs(instanceRoot));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool modelContainsNode = PR_FALSE;
|
||||
rv = xformsService->IsNodeAssocWithModel(xfContextNode,
|
||||
modelInstance,
|
||||
&modelContainsNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (modelContainsNode) {
|
||||
// ok, we've found an instance node with the proper id
|
||||
// that fulfills the requirement of being from the
|
||||
// same model as the context node. Now we need to
|
||||
// return a 'node-set containing just the root
|
||||
// element node of the referenced instance data'.
|
||||
// Wonderful.
|
||||
|
||||
nsCOMPtr<nsIDOMNode> instanceRoot;
|
||||
rv = xformsService->GetInstanceDocumentRoot(
|
||||
instanceId,
|
||||
modelInstance,
|
||||
getter_AddRefs(instanceRoot));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(instanceRoot, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsAutoPtr<txXPathNode> txNode(txXPathNativeNode::createXPathNode(instanceRoot));
|
||||
if (txNode) {
|
||||
resultSet->add(*txNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// XXX where we need to do the work
|
||||
// if (walker.moveToElementById(instanceId)) {
|
||||
// resultSet->add(walker.getCurrentPosition());
|
||||
// }
|
||||
|
||||
nsAutoPtr<txXPathNode> txNode(txXPathNativeNode::createXPathNode(instanceRoot));
|
||||
if (txNode) {
|
||||
resultSet->add(*txNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// XXX where we need to do the work
|
||||
// if (walker.moveToElementById(instanceId)) {
|
||||
// resultSet->add(walker.getCurrentPosition());
|
||||
// }
|
||||
|
||||
*aResult = resultSet;
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -292,9 +292,9 @@ XFormsFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
}
|
||||
case MAX:
|
||||
{
|
||||
if (!requireParams(1, 1, aContext))
|
||||
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
||||
|
||||
if (!requireParams(1, 1, aContext))
|
||||
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
||||
|
||||
nsRefPtr<txNodeSet> nodes;
|
||||
nsresult rv = evaluateToNodeSet((Expr*)iter.next(), aContext,
|
||||
getter_AddRefs(nodes));
|
||||
|
@ -307,11 +307,11 @@ XFormsFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
nsAutoString resultStr;
|
||||
txXPathNodeUtils::appendNodeValue(nodes->get(i), resultStr);
|
||||
test = Double::toDouble(resultStr);
|
||||
if (Double::isNaN(test)) {
|
||||
if (Double::isNaN(test)) {
|
||||
res = Double::NaN;
|
||||
break;
|
||||
}
|
||||
if (test > res || i == 0) {
|
||||
if (test > res || i == 0) {
|
||||
res = test;
|
||||
}
|
||||
}
|
||||
|
@ -320,9 +320,9 @@ XFormsFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
}
|
||||
case MIN:
|
||||
{
|
||||
if (!requireParams(1, 1, aContext))
|
||||
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
||||
|
||||
if (!requireParams(1, 1, aContext))
|
||||
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
||||
|
||||
nsRefPtr<txNodeSet> nodes;
|
||||
nsresult rv = evaluateToNodeSet((Expr*)iter.next(), aContext,
|
||||
getter_AddRefs(nodes));
|
||||
|
@ -355,16 +355,16 @@ XFormsFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
}
|
||||
case NOW:
|
||||
{
|
||||
if (!requireParams(0, 0, aContext))
|
||||
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
||||
|
||||
if (!requireParams(0, 0, aContext))
|
||||
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
|
||||
|
||||
PRExplodedTime time;
|
||||
char ctime[60];
|
||||
|
||||
PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &time);
|
||||
int gmtoffsethour = time.tm_params.tp_gmt_offset < 0 ?
|
||||
-1*time.tm_params.tp_gmt_offset / 3600 :
|
||||
time.tm_params.tp_gmt_offset / 3600;
|
||||
int gmtoffsethour = time.tm_params.tp_gmt_offset < 0 ?
|
||||
-1*time.tm_params.tp_gmt_offset / 3600 :
|
||||
time.tm_params.tp_gmt_offset / 3600;
|
||||
int remainder = time.tm_params.tp_gmt_offset%3600;
|
||||
int gmtoffsetminute = remainder ? remainder/60 : 00;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче