tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CSSUnitValue.h (1861B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      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/. */
      6 
      7 #ifndef LAYOUT_STYLE_TYPEDOM_CSSUNITVALUE_H_
      8 #define LAYOUT_STYLE_TYPEDOM_CSSUNITVALUE_H_
      9 
     10 #include "js/TypeDecls.h"
     11 #include "mozilla/dom/CSSNumericValue.h"
     12 #include "nsString.h"
     13 
     14 template <class T>
     15 struct already_AddRefed;
     16 template <class T>
     17 class nsCOMPtr;
     18 class nsISupports;
     19 
     20 namespace mozilla {
     21 
     22 struct CSSPropertyId;
     23 class ErrorResult;
     24 
     25 namespace dom {
     26 
     27 class GlobalObject;
     28 
     29 class CSSUnitValue final : public CSSNumericValue {
     30 public:
     31  CSSUnitValue(nsCOMPtr<nsISupports> aParent, double aValue,
     32               const nsACString& aUnit);
     33 
     34  JSObject* WrapObject(JSContext* aCx,
     35                       JS::Handle<JSObject*> aGivenProto) override;
     36 
     37  // start of CSSUnitValue Web IDL declarations
     38 
     39  // https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunitvalue-cssunitvalue
     40  static already_AddRefed<CSSUnitValue> Constructor(const GlobalObject& aGlobal,
     41                                                    double aValue,
     42                                                    const nsACString& aUnit,
     43                                                    ErrorResult& aRv);
     44 
     45  double Value() const;
     46 
     47  void SetValue(double aArg);
     48 
     49  void GetUnit(nsCString& aRetVal) const;
     50 
     51  // end of CSSUnitValue Web IDL declarations
     52 
     53  void ToCssTextWithProperty(const CSSPropertyId& aPropertyId,
     54                             nsACString& aDest) const;
     55 
     56 private:
     57  virtual ~CSSUnitValue() = default;
     58 
     59  double mValue;
     60  const nsCString mUnit;
     61 };
     62 
     63 }  // namespace dom
     64 }  // namespace mozilla
     65 
     66 #endif  // LAYOUT_STYLE_TYPEDOM_CSSUNITVALUE_H_