/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef LAYOUT_STYLE_TYPEDOM_CSSMATHINVERT_H_
#define LAYOUT_STYLE_TYPEDOM_CSSMATHINVERT_H_

#include "js/TypeDecls.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/dom/CSSMathValue.h"
#include "mozilla/dom/CSSNumericValueBindingFwd.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"

template <class T>
struct already_AddRefed;
template <class T>
class nsCOMPtr;
class nsISupports;

namespace mozilla {

struct CSSPropertyId;
template <typename T>
class MovingNotNull;
struct StyleMathInvert;

namespace dom {

class GlobalObject;

class CSSMathInvert final : public CSSMathValue {
 public:
  CSSMathInvert(nsCOMPtr<nsISupports> aParent,
                MovingNotNull<UniquePtr<StyleNumericType>> aNumericType,
                RefPtr<CSSNumericValue> aValue);

  static RefPtr<CSSMathInvert> Create(nsCOMPtr<nsISupports> aParent,
                                      const StyleMathInvert& aMathInvert);

  NS_DECL_ISUPPORTS_INHERITED
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CSSMathInvert, CSSMathValue)

  JSObject* WrapObject(JSContext* aCx,
                       JS::Handle<JSObject*> aGivenProto) override;

  // start of CSSMathInvert Web IDL declarations

  // https://drafts.css-houdini.org/css-typed-om-1/#dom-cssmathinvert-cssmathinvert
  static already_AddRefed<CSSMathInvert> Constructor(
      const GlobalObject& aGlobal, const CSSNumberish& aArg);

  CSSNumericValue* Value() const;

  // end of CSSMathInvert Web IDL declarations

  void ToCssTextWithProperty(const CSSPropertyId& aPropertyId,
                             const SerializationContext& aContext,
                             nsACString& aDest) const;

  StyleMathInvert ToStyleMathInvert() const;

 private:
  virtual ~CSSMathInvert() = default;

  RefPtr<CSSNumericValue> mValue;
};

}  // namespace dom
}  // namespace mozilla

#endif  // LAYOUT_STYLE_TYPEDOM_CSSMATHINVERT_H_
