1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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/. */
7 /* DOM object representing values in DOM computed style */
9 #ifndef nsROCSSPrimitiveValue_h___
10 #define nsROCSSPrimitiveValue_h___
17 * Read-only CSS primitive value - a DOM object representing values in DOM
20 class nsROCSSPrimitiveValue final
: public mozilla::dom::CSSValue
{
36 void GetCssText(nsAString
&) final
;
37 uint16_t CssValueType() const final
;
40 uint16_t PrimitiveType();
42 // nsROCSSPrimitiveValue
43 nsROCSSPrimitiveValue();
45 void SetNumber(float aValue
);
46 void SetNumber(int32_t aValue
);
47 void SetNumber(uint32_t aValue
);
48 void SetPercent(float aValue
);
49 void SetDegree(float aValue
);
50 void SetPixels(float aValue
);
51 void SetAppUnits(nscoord aValue
);
52 void SetAppUnits(float aValue
);
53 void SetString(const nsACString
& aString
);
54 void SetString(const nsAString
& aString
);
57 void SetString(const char (&aString
)[N
]) {
58 SetString(nsLiteralCString(aString
));
61 void SetTime(float aValue
);
64 virtual ~nsROCSSPrimitiveValue();
77 inline nsROCSSPrimitiveValue
* mozilla::dom::CSSValue::AsPrimitiveValue() {
78 return CssValueType() == mozilla::dom::CSSValue::CSS_PRIMITIVE_VALUE
79 ? static_cast<nsROCSSPrimitiveValue
*>(this)
83 #endif /* nsROCSSPrimitiveValue_h___ */