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 "nsTemplateMatch.h"
7 : #include "nsTemplateRule.h"
8 :
9 : // static
10 : void
11 0 : nsTemplateMatch::Destroy(nsTemplateMatch*& aMatch, bool aRemoveResult)
12 : {
13 0 : if (aRemoveResult && aMatch->mResult)
14 0 : aMatch->mResult->HasBeenRemoved();
15 0 : ::delete aMatch;
16 0 : aMatch = nullptr;
17 0 : }
18 :
19 : nsresult
20 0 : nsTemplateMatch::RuleMatched(nsTemplateQuerySet* aQuerySet,
21 : nsTemplateRule* aRule,
22 : int16_t aRuleIndex,
23 : nsIXULTemplateResult* aResult)
24 : {
25 : // assign the rule index, used to indicate that a match is active, and
26 : // so the tree builder can get the right action body to generate
27 0 : mRuleIndex = aRuleIndex;
28 :
29 0 : nsCOMPtr<nsIDOMNode> rulenode;
30 0 : aRule->GetRuleNode(getter_AddRefs(rulenode));
31 0 : if (rulenode)
32 0 : return aResult->RuleMatched(aQuerySet->mCompiledQuery, rulenode);
33 :
34 0 : return NS_OK;
35 : }
|