1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/templates/src/nsContentSupportMap.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsContentSupportMap.h" 1.10 +#include "nsXULElement.h" 1.11 + 1.12 +void 1.13 +nsContentSupportMap::Init() 1.14 +{ 1.15 + PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr, 1.16 + sizeof(Entry), PL_DHASH_MIN_SIZE); 1.17 +} 1.18 + 1.19 +void 1.20 +nsContentSupportMap::Finish() 1.21 +{ 1.22 + if (mMap.ops) 1.23 + PL_DHashTableFinish(&mMap); 1.24 +} 1.25 + 1.26 +nsresult 1.27 +nsContentSupportMap::Remove(nsIContent* aElement) 1.28 +{ 1.29 + if (!mMap.ops) 1.30 + return NS_ERROR_NOT_INITIALIZED; 1.31 + 1.32 + nsIContent* child = aElement; 1.33 + do { 1.34 + PL_DHashTableOperate(&mMap, child, PL_DHASH_REMOVE); 1.35 + child = child->GetNextNode(aElement); 1.36 + } while(child); 1.37 + 1.38 + return NS_OK; 1.39 +} 1.40 + 1.41 +