nsCSSAnonBoxes.cpp 1.4 KB

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