1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/xpath/txRootExpr.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "txExpr.h" 1.10 +#include "txNodeSet.h" 1.11 +#include "txIXPathContext.h" 1.12 +#include "txXPathTreeWalker.h" 1.13 + 1.14 +/** 1.15 + * Evaluates this Expr based on the given context node and processor state 1.16 + * @param context the context node for evaluation of this Expr 1.17 + * @param ps the ContextState containing the stack information needed 1.18 + * for evaluation 1.19 + * @return the result of the evaluation 1.20 +**/ 1.21 +nsresult 1.22 +RootExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) 1.23 +{ 1.24 + txXPathTreeWalker walker(aContext->getContextNode()); 1.25 + walker.moveToRoot(); 1.26 + 1.27 + return aContext->recycler()->getNodeSet(walker.getCurrentPosition(), 1.28 + aResult); 1.29 +} 1.30 + 1.31 +TX_IMPL_EXPR_STUBS_0(RootExpr, NODESET_RESULT) 1.32 + 1.33 +bool 1.34 +RootExpr::isSensitiveTo(ContextSensitivity aContext) 1.35 +{ 1.36 + return !!(aContext & NODE_CONTEXT); 1.37 +} 1.38 + 1.39 +#ifdef TX_TO_STRING 1.40 +void 1.41 +RootExpr::toString(nsAString& dest) 1.42 +{ 1.43 + if (mSerialize) 1.44 + dest.Append(char16_t('/')); 1.45 +} 1.46 +#endif