content/xul/templates/src/nsContentSupportMap.cpp

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:2c58d8e0a89f
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 "nsContentSupportMap.h"
7 #include "nsXULElement.h"
8
9 void
10 nsContentSupportMap::Init()
11 {
12 PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
13 sizeof(Entry), PL_DHASH_MIN_SIZE);
14 }
15
16 void
17 nsContentSupportMap::Finish()
18 {
19 if (mMap.ops)
20 PL_DHashTableFinish(&mMap);
21 }
22
23 nsresult
24 nsContentSupportMap::Remove(nsIContent* aElement)
25 {
26 if (!mMap.ops)
27 return NS_ERROR_NOT_INITIALIZED;
28
29 nsIContent* child = aElement;
30 do {
31 PL_DHashTableOperate(&mMap, child, PL_DHASH_REMOVE);
32 child = child->GetNextNode(aElement);
33 } while(child);
34
35 return NS_OK;
36 }
37
38

mercurial