LCOV - code coverage report
Current view: top level - dom/xslt/xpath - txNamedAttributeStep.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 29 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 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 "nsIAtom.h"
       7             : #include "txIXPathContext.h"
       8             : #include "txNodeSet.h"
       9             : #include "txExpr.h"
      10             : #include "txXPathTreeWalker.h"
      11             : 
      12           0 : txNamedAttributeStep::txNamedAttributeStep(int32_t aNsID,
      13             :                                            nsIAtom* aPrefix,
      14           0 :                                            nsIAtom* aLocalName)
      15             :     : mNamespace(aNsID),
      16             :       mPrefix(aPrefix),
      17           0 :       mLocalName(aLocalName)
      18             : {
      19           0 : }
      20             : 
      21             : nsresult
      22           0 : txNamedAttributeStep::evaluate(txIEvalContext* aContext,
      23             :                                txAExprResult** aResult)
      24             : {
      25           0 :     *aResult = nullptr;
      26             : 
      27           0 :     RefPtr<txNodeSet> nodes;
      28           0 :     nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
      29           0 :     NS_ENSURE_SUCCESS(rv, rv);
      30             : 
      31           0 :     txXPathTreeWalker walker(aContext->getContextNode());
      32           0 :     if (walker.moveToNamedAttribute(mLocalName, mNamespace)) {
      33           0 :         rv = nodes->append(walker.getCurrentPosition());
      34           0 :         NS_ENSURE_SUCCESS(rv, rv);
      35             :     }
      36           0 :     NS_ADDREF(*aResult = nodes);
      37             : 
      38           0 :     return NS_OK;
      39             : }
      40             : 
      41           0 : TX_IMPL_EXPR_STUBS_0(txNamedAttributeStep, NODESET_RESULT)
      42             : 
      43             : bool
      44           0 : txNamedAttributeStep::isSensitiveTo(ContextSensitivity aContext)
      45             : {
      46           0 :     return !!(aContext & NODE_CONTEXT);
      47             : }
      48             : 
      49             : #ifdef TX_TO_STRING
      50             : void
      51           0 : txNamedAttributeStep::toString(nsAString& aDest)
      52             : {
      53           0 :     aDest.Append(char16_t('@'));
      54           0 :     if (mPrefix) {
      55           0 :         nsAutoString prefix;
      56           0 :         mPrefix->ToString(prefix);
      57           0 :         aDest.Append(prefix);
      58           0 :         aDest.Append(char16_t(':'));
      59             :     }
      60           0 :     nsAutoString localName;
      61           0 :     mLocalName->ToString(localName);
      62           0 :     aDest.Append(localName);
      63           0 : }
      64             : #endif

Generated by: LCOV version 1.13