Bug 1637593 [wpt PR 23564] - Fix superclass calls in MarionetteRefTestExecutor, a...
[gecko.git] / layout / style / StyleColorInlines.h
blob51633f118a85f32c039c63e43db64a8f090a001c
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 /* Inline functions for StyleColor (aka values::computed::Color) */
9 #ifndef mozilla_StyleColorInlines_h_
10 #define mozilla_StyleColorInlines_h_
12 #include "nsColor.h"
13 #include "mozilla/ServoStyleConsts.h"
15 namespace mozilla {
17 inline StyleRGBA StyleRGBA::FromColor(nscolor aColor) {
18 return {NS_GET_R(aColor), NS_GET_G(aColor), NS_GET_B(aColor),
19 NS_GET_A(aColor)};
22 inline nscolor StyleRGBA::ToColor() const {
23 return NS_RGBA(red, green, blue, alpha);
26 inline StyleRGBA StyleRGBA::Transparent() { return {0, 0, 0, 0}; }
28 template <>
29 inline StyleColor StyleColor::FromColor(nscolor aColor) {
30 return StyleColor::Numeric(StyleRGBA::FromColor(aColor));
33 template <>
34 inline StyleColor StyleColor::Black() {
35 return FromColor(NS_RGB(0, 0, 0));
38 template <>
39 inline StyleColor StyleColor::White() {
40 return FromColor(NS_RGB(255, 255, 255));
43 template <>
44 inline StyleColor StyleColor::Transparent() {
45 return FromColor(NS_RGBA(0, 0, 0, 0));
48 template <>
49 nscolor StyleColor::CalcColor(const StyleRGBA&) const;
51 template <>
52 nscolor StyleColor::CalcColor(nscolor) const;
54 template <>
55 nscolor StyleColor::CalcColor(const ComputedStyle&) const;
57 template <>
58 nscolor StyleColor::CalcColor(const nsIFrame*) const;
60 } // namespace mozilla
62 #endif // mozilla_StyleColor_h_