LCOV - code coverage report
Current view: top level - dom/xslt/xpath - txPredicatedNodeTest.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 27 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       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 "txExprResult.h"
       8             : #include "txSingleNodeContext.h"
       9             : 
      10           0 : txPredicatedNodeTest::txPredicatedNodeTest(txNodeTest* aNodeTest,
      11           0 :                                            Expr* aPredicate)
      12             :     : mNodeTest(aNodeTest),
      13           0 :       mPredicate(aPredicate)
      14             : {
      15           0 :     NS_ASSERTION(!mPredicate->isSensitiveTo(Expr::NODESET_CONTEXT),
      16             :                  "predicate must not be context-nodeset-sensitive");
      17           0 : }
      18             : 
      19             : nsresult
      20           0 : txPredicatedNodeTest::matches(const txXPathNode& aNode,
      21             :                               txIMatchContext* aContext,
      22             :                               bool& aMatched)
      23             : {
      24           0 :     nsresult rv = mNodeTest->matches(aNode, aContext, aMatched);
      25           0 :     NS_ENSURE_SUCCESS(rv, rv);
      26             : 
      27           0 :     if (!aMatched) {
      28           0 :         return NS_OK;
      29             :     }
      30             : 
      31           0 :     txSingleNodeContext context(aNode, aContext);
      32           0 :     RefPtr<txAExprResult> res;
      33           0 :     rv = mPredicate->evaluate(&context, getter_AddRefs(res));
      34           0 :     NS_ENSURE_SUCCESS(rv, rv);
      35             : 
      36           0 :     aMatched = res->booleanValue();
      37           0 :     return NS_OK;
      38             : }
      39             : 
      40             : double
      41           0 : txPredicatedNodeTest::getDefaultPriority()
      42             : {
      43           0 :     return 0.5;
      44             : }
      45             : 
      46             : bool
      47           0 : txPredicatedNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext)
      48             : {
      49           0 :     return mNodeTest->isSensitiveTo(aContext) ||
      50           0 :            mPredicate->isSensitiveTo(aContext);
      51             : }
      52             : 
      53             : #ifdef TX_TO_STRING
      54             : void
      55           0 : txPredicatedNodeTest::toString(nsAString& aDest)
      56             : {
      57           0 :     mNodeTest->toString(aDest);
      58           0 :     aDest.Append(char16_t('['));
      59           0 :     mPredicate->toString(aDest);
      60           0 :     aDest.Append(char16_t(']'));
      61           0 : }
      62             : #endif

Generated by: LCOV version 1.13