|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
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 /* atom list for CSS anonymous boxes */ |
|
7 |
|
8 #include "mozilla/ArrayUtils.h" |
|
9 |
|
10 #include "nsCSSAnonBoxes.h" |
|
11 #include "nsAtomListUtils.h" |
|
12 #include "nsStaticAtom.h" |
|
13 |
|
14 using namespace mozilla; |
|
15 |
|
16 // define storage for all atoms |
|
17 #define CSS_ANON_BOX(_name, _value) \ |
|
18 nsICSSAnonBoxPseudo* nsCSSAnonBoxes::_name; |
|
19 #include "nsCSSAnonBoxList.h" |
|
20 #undef CSS_ANON_BOX |
|
21 |
|
22 #define CSS_ANON_BOX(name_, value_) \ |
|
23 NS_STATIC_ATOM_BUFFER(name_##_buffer, value_) |
|
24 #include "nsCSSAnonBoxList.h" |
|
25 #undef CSS_ANON_BOX |
|
26 |
|
27 static const nsStaticAtom CSSAnonBoxes_info[] = { |
|
28 #define CSS_ANON_BOX(name_, value_) \ |
|
29 NS_STATIC_ATOM(name_##_buffer, (nsIAtom**)&nsCSSAnonBoxes::name_), |
|
30 #include "nsCSSAnonBoxList.h" |
|
31 #undef CSS_ANON_BOX |
|
32 }; |
|
33 |
|
34 void nsCSSAnonBoxes::AddRefAtoms() |
|
35 { |
|
36 NS_RegisterStaticAtoms(CSSAnonBoxes_info); |
|
37 } |
|
38 |
|
39 bool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom) |
|
40 { |
|
41 return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info, |
|
42 ArrayLength(CSSAnonBoxes_info)); |
|
43 } |
|
44 |
|
45 #ifdef MOZ_XUL |
|
46 /* static */ bool |
|
47 nsCSSAnonBoxes::IsTreePseudoElement(nsIAtom* aPseudo) |
|
48 { |
|
49 return StringBeginsWith(nsDependentAtomString(aPseudo), |
|
50 NS_LITERAL_STRING(":-moz-tree-")); |
|
51 } |
|
52 #endif |