no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / style / nsCSSAnonBoxes.h
blob78539b8d1055e7066bc2e11369b772ccc6d93dfe
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/. */
7 /* atom list for CSS anonymous boxes */
9 #ifndef nsCSSAnonBoxes_h___
10 #define nsCSSAnonBoxes_h___
12 #include "nsAtom.h"
13 #include "nsGkAtoms.h"
14 #include "mozilla/PseudoStyleType.h"
16 class nsCSSAnonBoxes {
17 using PseudoStyleType = mozilla::PseudoStyleType;
18 using PseudoStyle = mozilla::PseudoStyle;
20 public:
21 static bool IsTreePseudoElement(nsAtom* aPseudo);
22 static bool IsNonElement(PseudoStyleType aPseudo) {
23 return aPseudo == PseudoStyleType::mozText ||
24 aPseudo == PseudoStyleType::oofPlaceholder ||
25 aPseudo == PseudoStyleType::firstLetterContinuation;
28 enum class NonInheriting : uint8_t {
29 #define CSS_ANON_BOX(_name, _value) /* nothing */
30 #define CSS_NON_INHERITING_ANON_BOX(_name, _value) _name,
31 #include "nsCSSAnonBoxList.h"
32 #undef CSS_NON_INHERITING_ANON_BOX
33 #undef CSS_ANON_BOX
34 _Count
37 // Get the NonInheriting type for a given pseudo tag. The pseudo tag must
38 // test true for IsNonInheritingAnonBox.
39 static NonInheriting NonInheritingTypeForPseudoType(PseudoStyleType aType) {
40 MOZ_ASSERT(PseudoStyle::IsNonInheritingAnonBox(aType));
41 static_assert(sizeof(PseudoStyleType) == sizeof(uint8_t), "");
42 return static_cast<NonInheriting>(
43 static_cast<uint8_t>(aType) -
44 static_cast<uint8_t>(PseudoStyleType::NonInheritingAnonBoxesStart));
47 #ifdef DEBUG
48 static nsStaticAtom* GetAtomBase();
49 static void AssertAtoms();
50 #endif
52 // Alias nsCSSAnonBoxes::foo() to nsGkAtoms::AnonBox_foo.
53 #define CSS_ANON_BOX(name_, value_) \
54 static nsCSSAnonBoxPseudoStaticAtom* name_() { \
55 return const_cast<nsCSSAnonBoxPseudoStaticAtom*>( \
56 static_cast<const nsCSSAnonBoxPseudoStaticAtom*>( \
57 nsGkAtoms::AnonBox_##name_)); \
59 #include "nsCSSAnonBoxList.h"
60 #undef CSS_ANON_BOX
63 #endif /* nsCSSAnonBoxes_h___ */