nsStyleStructFwd.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * Forward declarations to avoid including all of nsStyleStruct.h.
  7. */
  8. #ifndef nsStyleStructFwd_h_
  9. #define nsStyleStructFwd_h_
  10. enum nsStyleStructID {
  11. /*
  12. * Define the constants eStyleStruct_Font, etc.
  13. *
  14. * The C++ standard, section 7.2, guarantees that enums begin with 0 and
  15. * increase by 1.
  16. *
  17. * We separate the IDs of Reset and Inherited structs so that we can use
  18. * the IDs as indices (offset by nsStyleStructID_*_Start) into arrays of
  19. * one type or the other.
  20. */
  21. nsStyleStructID_None = -1,
  22. nsStyleStructID_Inherited_Start = 0,
  23. // a dummy value so the value after it is the same as ..._Inherited_Start
  24. nsStyleStructID_DUMMY1 = nsStyleStructID_Inherited_Start - 1,
  25. #define STYLE_STRUCT_INHERITED(name, checkdata_cb) \
  26. eStyleStruct_##name,
  27. #define STYLE_STRUCT_RESET(name, checkdata_cb)
  28. #include "nsStyleStructList.h"
  29. #undef STYLE_STRUCT_INHERITED
  30. #undef STYLE_STRUCT_RESET
  31. nsStyleStructID_Reset_Start,
  32. // a dummy value so the value after it is the same as ..._Reset_Start
  33. nsStyleStructID_DUMMY2 = nsStyleStructID_Reset_Start - 1,
  34. #define STYLE_STRUCT_RESET(name, checkdata_cb) \
  35. eStyleStruct_##name,
  36. #define STYLE_STRUCT_INHERITED(name, checkdata_cb)
  37. #include "nsStyleStructList.h"
  38. #undef STYLE_STRUCT_INHERITED
  39. #undef STYLE_STRUCT_RESET
  40. // one past the end; length of 0-based list
  41. nsStyleStructID_Length,
  42. nsStyleStructID_Inherited_Count =
  43. nsStyleStructID_Reset_Start - nsStyleStructID_Inherited_Start,
  44. nsStyleStructID_Reset_Count =
  45. nsStyleStructID_Length - nsStyleStructID_Reset_Start,
  46. };
  47. // A bit corresponding to each struct ID
  48. #define NS_STYLE_INHERIT_BIT(sid_) (1 << uint64_t(eStyleStruct_##sid_))
  49. typedef decltype(nsStyleStructID(0) + nsStyleStructID(0)) nsStyleStructID_size_t;
  50. #endif /* nsStyleStructFwd_h_ */