nsCSSAnonBoxes.cpp (1557B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* atom list for CSS anonymous boxes */ 8 9 #include "nsCSSAnonBoxes.h" 10 11 #include "nsGkAtomConsts.h" 12 #include "nsStaticAtomUtils.h" 13 14 using namespace mozilla; 15 16 /* static */ 17 bool nsCSSAnonBoxes::IsTreePseudoElement(nsAtom* aPseudo) { 18 return StringBeginsWith(nsDependentAtomString(aPseudo), u":-moz-tree-"_ns); 19 } 20 21 #ifdef DEBUG 22 /* static */ 23 nsStaticAtom* nsCSSAnonBoxes::GetAtomBase() { 24 return const_cast<nsStaticAtom*>( 25 nsGkAtoms::GetAtomByIndex(kAtomIndex_AnonBoxes)); 26 } 27 28 /* static */ 29 void nsCSSAnonBoxes::AssertAtoms() { 30 nsStaticAtom* base = GetAtomBase(); 31 size_t index = 0; 32 # define CSS_ANON_BOX(name_, value_) \ 33 { \ 34 RefPtr<nsAtom> atom = NS_Atomize(value_); \ 35 MOZ_ASSERT(atom == nsGkAtoms::AnonBox_##name_, \ 36 "Static atom for " #name_ " has incorrect value"); \ 37 MOZ_ASSERT(atom == &base[index], \ 38 "Static atom for " #name_ " not at expected index"); \ 39 ++index; \ 40 } 41 # include "nsCSSAnonBoxList.h" 42 # undef CSS_ANON_BOX 43 } 44 #endif