tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

txRootExpr.cpp (1177B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "txExpr.h"
      7 #include "txIXPathContext.h"
      8 #include "txNodeSet.h"
      9 #include "txXPathTreeWalker.h"
     10 
     11 /**
     12 * Evaluates this Expr based on the given context node and processor state
     13 * @param context the context node for evaluation of this Expr
     14 * @param ps the ContextState containing the stack information needed
     15 * for evaluation
     16 * @return the result of the evaluation
     17 **/
     18 nsresult RootExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) {
     19  txXPathTreeWalker walker(aContext->getContextNode());
     20  walker.moveToRoot();
     21 
     22  return aContext->recycler()->getNodeSet(walker.getCurrentPosition(), aResult);
     23 }
     24 
     25 TX_IMPL_EXPR_STUBS_0(RootExpr, NODESET_RESULT)
     26 
     27 bool RootExpr::isSensitiveTo(ContextSensitivity aContext) {
     28  return !!(aContext & NODE_CONTEXT);
     29 }
     30 
     31 #ifdef TX_TO_STRING
     32 void RootExpr::toString(nsAString& dest) {
     33  if (mSerialize) dest.Append(char16_t('/'));
     34 }
     35 #endif