DeclarationBlockInlines.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* -*- Mode: C++; tab-width: 8; 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. #ifndef mozilla_DeclarationBlockInlines_h
  6. #define mozilla_DeclarationBlockInlines_h
  7. #include "mozilla/css/Declaration.h"
  8. #include "mozilla/ServoDeclarationBlock.h"
  9. namespace mozilla {
  10. MOZ_DEFINE_STYLO_METHODS(DeclarationBlock, css::Declaration, ServoDeclarationBlock)
  11. MozExternalRefCountType
  12. DeclarationBlock::AddRef()
  13. {
  14. MOZ_STYLO_FORWARD(AddRef, ())
  15. }
  16. MozExternalRefCountType
  17. DeclarationBlock::Release()
  18. {
  19. MOZ_STYLO_FORWARD(Release, ())
  20. }
  21. already_AddRefed<DeclarationBlock>
  22. DeclarationBlock::Clone() const
  23. {
  24. RefPtr<DeclarationBlock> result;
  25. if (IsGecko()) {
  26. result = new css::Declaration(*AsGecko());
  27. } else {
  28. result = new ServoDeclarationBlock(*AsServo());
  29. }
  30. return result.forget();
  31. }
  32. already_AddRefed<DeclarationBlock>
  33. DeclarationBlock::EnsureMutable()
  34. {
  35. #ifdef DEBUG
  36. if (IsGecko()) {
  37. AsGecko()->AssertNotExpanded();
  38. }
  39. #endif
  40. if (!IsMutable()) {
  41. return Clone();
  42. }
  43. return do_AddRef(this);
  44. }
  45. void
  46. DeclarationBlock::ToString(nsAString& aString) const
  47. {
  48. MOZ_STYLO_FORWARD(ToString, (aString))
  49. }
  50. uint32_t
  51. DeclarationBlock::Count() const
  52. {
  53. MOZ_STYLO_FORWARD(Count, ())
  54. }
  55. bool
  56. DeclarationBlock::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const
  57. {
  58. MOZ_STYLO_FORWARD(GetNthProperty, (aIndex, aReturn))
  59. }
  60. void
  61. DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
  62. nsAString& aValue) const
  63. {
  64. MOZ_STYLO_FORWARD(GetPropertyValue, (aProperty, aValue))
  65. }
  66. void
  67. DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
  68. nsAString& aValue) const
  69. {
  70. MOZ_STYLO_FORWARD(GetPropertyValueByID, (aPropID, aValue))
  71. }
  72. void
  73. DeclarationBlock::GetAuthoredPropertyValue(const nsAString& aProperty,
  74. nsAString& aValue) const
  75. {
  76. MOZ_STYLO_FORWARD(GetAuthoredPropertyValue, (aProperty, aValue))
  77. }
  78. bool
  79. DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
  80. {
  81. MOZ_STYLO_FORWARD(GetPropertyIsImportant, (aProperty))
  82. }
  83. void
  84. DeclarationBlock::RemoveProperty(const nsAString& aProperty)
  85. {
  86. MOZ_STYLO_FORWARD(RemoveProperty, (aProperty))
  87. }
  88. void
  89. DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aProperty)
  90. {
  91. MOZ_STYLO_FORWARD(RemovePropertyByID, (aProperty))
  92. }
  93. } // namespace mozilla
  94. #endif // mozilla_DeclarationBlockInlines_h