forked from mirrors/gecko-dev
Bug 1846249 - Change color functions to constants r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D184929
This commit is contained in:
parent
5023905cc7
commit
6798545271
17 changed files with 86 additions and 87 deletions
|
|
@ -41,11 +41,14 @@ struct nsFont final {
|
||||||
mozilla::StyleFontSizeAdjust sizeAdjust =
|
mozilla::StyleFontSizeAdjust sizeAdjust =
|
||||||
mozilla::StyleFontSizeAdjust::None();
|
mozilla::StyleFontSizeAdjust::None();
|
||||||
|
|
||||||
|
#pragma push_macro("TRANSPARENT")
|
||||||
|
#undef TRANSPARENT
|
||||||
// The estimated background color behind the text. Enables a special
|
// The estimated background color behind the text. Enables a special
|
||||||
// rendering mode when the alpha component > 0. Only used for text in the
|
// rendering mode when the alpha component > 0. Only used for text in the
|
||||||
// chrome.
|
// chrome.
|
||||||
mozilla::StyleAbsoluteColor fontSmoothingBackgroundColor =
|
mozilla::StyleAbsoluteColor fontSmoothingBackgroundColor =
|
||||||
mozilla::StyleAbsoluteColor::Transparent();
|
mozilla::StyleAbsoluteColor::TRANSPARENT;
|
||||||
|
#pragma pop_macro("TRANSPARENT")
|
||||||
|
|
||||||
// Language system tag, to override document language;
|
// Language system tag, to override document language;
|
||||||
// this is an OpenType "language system" tag represented as a 32-bit integer
|
// this is an OpenType "language system" tag represented as a 32-bit integer
|
||||||
|
|
|
||||||
|
|
@ -1809,7 +1809,7 @@ void nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
||||||
struct nsRecessedBorder : public nsStyleBorder {
|
struct nsRecessedBorder : public nsStyleBorder {
|
||||||
explicit nsRecessedBorder(nscoord aBorderWidth) {
|
explicit nsRecessedBorder(nscoord aBorderWidth) {
|
||||||
for (const auto side : AllPhysicalSides()) {
|
for (const auto side : AllPhysicalSides()) {
|
||||||
BorderColorFor(side) = StyleColor::Black();
|
BorderColorFor(side) = StyleColor::BLACK;
|
||||||
mBorder.Side(side) = aBorderWidth;
|
mBorder.Side(side) = aBorderWidth;
|
||||||
// Note: use SetBorderStyle here because we want to affect
|
// Note: use SetBorderStyle here because we want to affect
|
||||||
// mComputedBorder
|
// mComputedBorder
|
||||||
|
|
|
||||||
|
|
@ -552,7 +552,7 @@ static StyleAbsoluteColor GetSpecifiedColor(
|
||||||
const StyleGenericGradientItem<StyleColor, T>& aItem,
|
const StyleGenericGradientItem<StyleColor, T>& aItem,
|
||||||
const ComputedStyle& aStyle) {
|
const ComputedStyle& aStyle) {
|
||||||
if (aItem.IsInterpolationHint()) {
|
if (aItem.IsInterpolationHint()) {
|
||||||
return StyleAbsoluteColor::Transparent();
|
return StyleAbsoluteColor::TRANSPARENT;
|
||||||
}
|
}
|
||||||
const StyleColor& c = aItem.IsSimpleColorStop()
|
const StyleColor& c = aItem.IsSimpleColorStop()
|
||||||
? aItem.AsSimpleColorStop()
|
? aItem.AsSimpleColorStop()
|
||||||
|
|
@ -1084,7 +1084,7 @@ void nsCSSGradientRenderer::Paint(gfxContext& aContext, const nsRect& aDest,
|
||||||
|
|
||||||
gfxRect dirtyFillRect = fillRect.Intersect(dirtyAreaToFill);
|
gfxRect dirtyFillRect = fillRect.Intersect(dirtyAreaToFill);
|
||||||
gfxRect fillRectRelativeToTile = dirtyFillRect - tileRect.TopLeft();
|
gfxRect fillRectRelativeToTile = dirtyFillRect - tileRect.TopLeft();
|
||||||
auto edgeColor = StyleAbsoluteColor::Transparent();
|
auto edgeColor = StyleAbsoluteColor::TRANSPARENT;
|
||||||
if (mGradient->IsLinear() && !isRepeat &&
|
if (mGradient->IsLinear() && !isRepeat &&
|
||||||
RectIsBeyondLinearGradientEdge(fillRectRelativeToTile, matrix, mStops,
|
RectIsBeyondLinearGradientEdge(fillRectRelativeToTile, matrix, mStops,
|
||||||
gradientStart, gradientEnd,
|
gradientStart, gradientEnd,
|
||||||
|
|
|
||||||
|
|
@ -28,37 +28,31 @@ inline StyleAbsoluteColor StyleAbsoluteColor::Srgb(float red, float green,
|
||||||
StyleColorSpace::Srgb, StyleColorFlags{0}};
|
StyleColorSpace::Srgb, StyleColorFlags{0}};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StyleAbsoluteColor StyleAbsoluteColor::Transparent() {
|
|
||||||
return StyleAbsoluteColor::Srgb(0.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline StyleAbsoluteColor StyleAbsoluteColor::Black() {
|
|
||||||
return StyleAbsoluteColor::Srgb(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline StyleAbsoluteColor StyleAbsoluteColor::White() {
|
|
||||||
return StyleAbsoluteColor::Srgb(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline StyleColor StyleColor::FromColor(nscolor aColor) {
|
inline StyleColor StyleColor::FromColor(nscolor aColor) {
|
||||||
return StyleColor::Absolute(StyleAbsoluteColor::FromColor(aColor));
|
return StyleColor::Absolute(StyleAbsoluteColor::FromColor(aColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
// Workaround for window.h conflict.
|
||||||
inline StyleColor StyleColor::Black() {
|
#pragma push_macro("TRANSPARENT")
|
||||||
return FromColor(NS_RGB(0, 0, 0));
|
#undef TRANSPARENT
|
||||||
}
|
|
||||||
|
|
||||||
|
// static
|
||||||
template <>
|
template <>
|
||||||
inline StyleColor StyleColor::White() {
|
inline const StyleColor StyleColor::TRANSPARENT =
|
||||||
return FromColor(NS_RGB(255, 255, 255));
|
StyleColor::Absolute(StyleAbsoluteColor::TRANSPARENT);
|
||||||
}
|
|
||||||
|
|
||||||
|
#pragma pop_macro("TRANSPARENT")
|
||||||
|
|
||||||
|
// static
|
||||||
template <>
|
template <>
|
||||||
inline StyleColor StyleColor::Transparent() {
|
inline const StyleColor StyleColor::BLACK =
|
||||||
return FromColor(NS_RGBA(0, 0, 0, 0));
|
StyleColor::Absolute(StyleAbsoluteColor::BLACK);
|
||||||
}
|
|
||||||
|
// static
|
||||||
|
template <>
|
||||||
|
inline const StyleColor StyleColor::WHITE =
|
||||||
|
StyleColor::Absolute(StyleAbsoluteColor::WHITE);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
StyleAbsoluteColor StyleColor::ResolveColor(const StyleAbsoluteColor&) const;
|
StyleAbsoluteColor StyleColor::ResolveColor(const StyleAbsoluteColor&) const;
|
||||||
|
|
|
||||||
|
|
@ -752,7 +752,7 @@ using SVGPaintFallback = StyleGenericSVGPaintFallback<StyleColor>;
|
||||||
// nsStyleSVG
|
// nsStyleSVG
|
||||||
//
|
//
|
||||||
nsStyleSVG::nsStyleSVG()
|
nsStyleSVG::nsStyleSVG()
|
||||||
: mFill{StyleSVGPaintKind::Color(StyleColor::Black()),
|
: mFill{StyleSVGPaintKind::Color(StyleColor::BLACK),
|
||||||
SVGPaintFallback::Unset()},
|
SVGPaintFallback::Unset()},
|
||||||
mStroke{StyleSVGPaintKind::None(), SVGPaintFallback::Unset()},
|
mStroke{StyleSVGPaintKind::None(), SVGPaintFallback::Unset()},
|
||||||
mMarkerEnd(StyleUrlOrNone::None()),
|
mMarkerEnd(StyleUrlOrNone::None()),
|
||||||
|
|
@ -899,9 +899,9 @@ nsStyleSVGReset::nsStyleSVGReset()
|
||||||
mR(NonNegativeLengthPercentage::Zero()),
|
mR(NonNegativeLengthPercentage::Zero()),
|
||||||
mMask(nsStyleImageLayers::LayerType::Mask),
|
mMask(nsStyleImageLayers::LayerType::Mask),
|
||||||
mClipPath(StyleClipPath::None()),
|
mClipPath(StyleClipPath::None()),
|
||||||
mStopColor(StyleColor::Black()),
|
mStopColor(StyleColor::BLACK),
|
||||||
mFloodColor(StyleColor::Black()),
|
mFloodColor(StyleColor::BLACK),
|
||||||
mLightingColor(StyleColor::White()),
|
mLightingColor(StyleColor::WHITE),
|
||||||
mStopOpacity(1.0f),
|
mStopOpacity(1.0f),
|
||||||
mFloodOpacity(1.0f),
|
mFloodOpacity(1.0f),
|
||||||
mVectorEffect(StyleVectorEffect::None),
|
mVectorEffect(StyleVectorEffect::None),
|
||||||
|
|
@ -2037,7 +2037,7 @@ nsChangeHint nsStyleImageLayers::Layer::CalcDifference(
|
||||||
|
|
||||||
nsStyleBackground::nsStyleBackground()
|
nsStyleBackground::nsStyleBackground()
|
||||||
: mImage(nsStyleImageLayers::LayerType::Background),
|
: mImage(nsStyleImageLayers::LayerType::Background),
|
||||||
mBackgroundColor(StyleColor::Transparent()) {
|
mBackgroundColor(StyleColor::TRANSPARENT) {
|
||||||
MOZ_COUNT_CTOR(nsStyleBackground);
|
MOZ_COUNT_CTOR(nsStyleBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,30 @@ macro_rules! color_components_as {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbsoluteColor {
|
impl AbsoluteColor {
|
||||||
|
/// A fully transparent color in the legacy syntax.
|
||||||
|
pub const TRANSPARENT: Self = Self {
|
||||||
|
components: ColorComponents(0.0, 0.0, 0.0),
|
||||||
|
alpha: 0.0,
|
||||||
|
color_space: ColorSpace::Srgb,
|
||||||
|
flags: ColorFlags { bits: 0 }, // cbindgen does not like ColorFlags::empty().
|
||||||
|
};
|
||||||
|
|
||||||
|
/// An opaque black color in the legacy syntax.
|
||||||
|
pub const BLACK: Self = Self {
|
||||||
|
components: ColorComponents(0.0, 0.0, 0.0),
|
||||||
|
alpha: 1.0,
|
||||||
|
color_space: ColorSpace::Srgb,
|
||||||
|
flags: ColorFlags { bits: 0 }, // cbindgen does not like ColorFlags::empty().
|
||||||
|
};
|
||||||
|
|
||||||
|
/// An opaque white color in the legacy syntax.
|
||||||
|
pub const WHITE: Self = Self {
|
||||||
|
components: ColorComponents(1.0, 1.0, 1.0),
|
||||||
|
alpha: 1.0,
|
||||||
|
color_space: ColorSpace::Srgb,
|
||||||
|
flags: ColorFlags { bits: 0 }, // cbindgen does not like ColorFlags::empty().
|
||||||
|
};
|
||||||
|
|
||||||
/// Create a new [`AbsoluteColor`] with the given [`ColorSpace`] and
|
/// Create a new [`AbsoluteColor`] with the given [`ColorSpace`] and
|
||||||
/// components.
|
/// components.
|
||||||
pub fn new(color_space: ColorSpace, components: ColorComponents, alpha: f32) -> Self {
|
pub fn new(color_space: ColorSpace, components: ColorComponents, alpha: f32) -> Self {
|
||||||
|
|
@ -223,21 +247,6 @@ impl AbsoluteColor {
|
||||||
Self::new(ColorSpace::Srgb, ColorComponents(red, green, blue), alpha)
|
Self::new(ColorSpace::Srgb, ColorComponents(red, green, blue), alpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new transparent color.
|
|
||||||
pub fn transparent() -> Self {
|
|
||||||
Self::srgb(0.0, 0.0, 0.0, 0.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a new opaque black color.
|
|
||||||
pub fn black() -> Self {
|
|
||||||
Self::srgb(0.0, 0.0, 0.0, 1.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a new opaque white color.
|
|
||||||
pub fn white() -> Self {
|
|
||||||
Self::srgb(1.0, 1.0, 1.0, 1.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return all the components of the color in an array. (Includes alpha)
|
/// Return all the components of the color in an array. (Includes alpha)
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn raw_components(&self) -> &[f32; 4] {
|
pub fn raw_components(&self) -> &[f32; 4] {
|
||||||
|
|
|
||||||
|
|
@ -445,7 +445,7 @@ fn tweak_when_ignoring_colors(
|
||||||
// We assume here currentColor is opaque.
|
// We assume here currentColor is opaque.
|
||||||
color
|
color
|
||||||
.to_computed_value(context)
|
.to_computed_value(context)
|
||||||
.resolve_to_absolute(&AbsoluteColor::black())
|
.resolve_to_absolute(&AbsoluteColor::BLACK)
|
||||||
.alpha
|
.alpha
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"background-color",
|
"background-color",
|
||||||
"Color",
|
"Color",
|
||||||
"computed::Color::transparent()",
|
"computed::Color::TRANSPARENT",
|
||||||
engines="gecko servo-2013 servo-2020",
|
engines="gecko servo-2013 servo-2020",
|
||||||
initial_specified_value="SpecifiedValue::transparent()",
|
initial_specified_value="SpecifiedValue::transparent()",
|
||||||
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
|
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
|
||||||
|
|
|
||||||
|
|
@ -445,7 +445,7 @@ ${helpers.single_keyword(
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"-moz-font-smoothing-background-color",
|
"-moz-font-smoothing-background-color",
|
||||||
"color::MozFontSmoothingBackgroundColor",
|
"color::MozFontSmoothingBackgroundColor",
|
||||||
"computed::color::MozFontSmoothingBackgroundColor::transparent()",
|
"computed::color::MozFontSmoothingBackgroundColor::TRANSPARENT",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
animation_value_type="none",
|
animation_value_type="none",
|
||||||
gecko_ffi_name="mFont.fontSmoothingBackgroundColor",
|
gecko_ffi_name="mFont.fontSmoothingBackgroundColor",
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ ${helpers.single_keyword(
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"fill",
|
"fill",
|
||||||
"SVGPaint",
|
"SVGPaint",
|
||||||
"crate::values::computed::SVGPaint::black()",
|
"crate::values::computed::SVGPaint::BLACK",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
animation_value_type="IntermediateSVGPaint",
|
animation_value_type="IntermediateSVGPaint",
|
||||||
boxed=True,
|
boxed=True,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"color",
|
"color",
|
||||||
"ColorPropertyValue",
|
"ColorPropertyValue",
|
||||||
"crate::color::AbsoluteColor::black()",
|
"crate::color::AbsoluteColor::BLACK",
|
||||||
engines="gecko servo-2013 servo-2020",
|
engines="gecko servo-2013 servo-2020",
|
||||||
animation_value_type="AbsoluteColor",
|
animation_value_type="AbsoluteColor",
|
||||||
ignored_when_colors_disabled="True",
|
ignored_when_colors_disabled="True",
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ ${helpers.single_keyword(
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"stop-color",
|
"stop-color",
|
||||||
"Color",
|
"Color",
|
||||||
"computed::Color::black()",
|
"computed::Color::BLACK",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
animation_value_type="AnimatedRGBA",
|
animation_value_type="AnimatedRGBA",
|
||||||
spec="https://www.w3.org/TR/SVGTiny12/painting.html#StopColorProperty",
|
spec="https://www.w3.org/TR/SVGTiny12/painting.html#StopColorProperty",
|
||||||
|
|
@ -40,7 +40,7 @@ ${helpers.predefined_type(
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"flood-color",
|
"flood-color",
|
||||||
"Color",
|
"Color",
|
||||||
"computed::Color::black()",
|
"computed::Color::BLACK",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
animation_value_type="AnimatedColor",
|
animation_value_type="AnimatedColor",
|
||||||
spec="https://www.w3.org/TR/SVG/filters.html#FloodColorProperty",
|
spec="https://www.w3.org/TR/SVG/filters.html#FloodColorProperty",
|
||||||
|
|
@ -58,7 +58,7 @@ ${helpers.predefined_type(
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"lighting-color",
|
"lighting-color",
|
||||||
"Color",
|
"Color",
|
||||||
"computed::Color::white()",
|
"computed::Color::WHITE",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
animation_value_type="AnimatedColor",
|
animation_value_type="AnimatedColor",
|
||||||
spec="https://www.w3.org/TR/SVG/filters.html#LightingColorProperty",
|
spec="https://www.w3.org/TR/SVG/filters.html#LightingColorProperty",
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ impl Animate for Color {
|
||||||
impl ComputeSquaredDistance for Color {
|
impl ComputeSquaredDistance for Color {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||||
let current_color = AbsoluteColor::transparent();
|
let current_color = AbsoluteColor::TRANSPARENT;
|
||||||
self.resolve_to_absolute(¤t_color)
|
self.resolve_to_absolute(¤t_color)
|
||||||
.compute_squared_distance(&other.resolve_to_absolute(¤t_color))
|
.compute_squared_distance(&other.resolve_to_absolute(¤t_color))
|
||||||
}
|
}
|
||||||
|
|
@ -83,6 +83,6 @@ impl ComputeSquaredDistance for Color {
|
||||||
impl ToAnimatedZero for Color {
|
impl ToAnimatedZero for Color {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||||
Ok(Color::Absolute(AbsoluteColor::transparent()))
|
Ok(Color::Absolute(AbsoluteColor::TRANSPARENT))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,15 @@ impl ToCss for Color {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Color {
|
impl Color {
|
||||||
|
/// A fully transparent color.
|
||||||
|
pub const TRANSPARENT: Self = Self::Absolute(AbsoluteColor::TRANSPARENT);
|
||||||
|
|
||||||
|
/// An opaque black color.
|
||||||
|
pub const BLACK: Self = Self::Absolute(AbsoluteColor::BLACK);
|
||||||
|
|
||||||
|
/// An opaque white color.
|
||||||
|
pub const WHITE: Self = Self::Absolute(AbsoluteColor::WHITE);
|
||||||
|
|
||||||
/// Create a new computed [`Color`] from a given color-mix, simplifying it to an absolute color
|
/// Create a new computed [`Color`] from a given color-mix, simplifying it to an absolute color
|
||||||
/// if possible.
|
/// if possible.
|
||||||
pub fn from_color_mix(color_mix: ColorMix) -> Self {
|
pub fn from_color_mix(color_mix: ColorMix) -> Self {
|
||||||
|
|
@ -52,21 +61,6 @@ impl Color {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a complex color value representing transparent.
|
|
||||||
pub fn transparent() -> Color {
|
|
||||||
Color::Absolute(AbsoluteColor::transparent())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns opaque black.
|
|
||||||
pub fn black() -> Color {
|
|
||||||
Color::Absolute(AbsoluteColor::black())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns opaque white.
|
|
||||||
pub fn white() -> Color {
|
|
||||||
Color::Absolute(AbsoluteColor::white())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Combine this complex color with the given foreground color into an
|
/// Combine this complex color with the given foreground color into an
|
||||||
/// absolute color.
|
/// absolute color.
|
||||||
pub fn resolve_to_absolute(&self, current_color: &AbsoluteColor) -> AbsoluteColor {
|
pub fn resolve_to_absolute(&self, current_color: &AbsoluteColor) -> AbsoluteColor {
|
||||||
|
|
@ -93,7 +87,7 @@ impl Color {
|
||||||
|
|
||||||
impl ToAnimatedZero for AbsoluteColor {
|
impl ToAnimatedZero for AbsoluteColor {
|
||||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||||
Ok(Self::transparent())
|
Ok(Self::TRANSPARENT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,10 @@ pub type SVGPaintKind = generic::GenericSVGPaintKind<Color, ComputedUrl>;
|
||||||
|
|
||||||
impl SVGPaint {
|
impl SVGPaint {
|
||||||
/// Opaque black color
|
/// Opaque black color
|
||||||
pub fn black() -> Self {
|
pub const BLACK: Self = Self {
|
||||||
SVGPaint {
|
kind: generic::SVGPaintKind::Color(Color::BLACK),
|
||||||
kind: generic::SVGPaintKind::Color(Color::black()),
|
fallback: generic::SVGPaintFallback::Unset,
|
||||||
fallback: generic::SVGPaintFallback::Unset,
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <length> | <percentage> | <number> | context-value
|
/// <length> | <percentage> | <number> | context-value
|
||||||
|
|
|
||||||
|
|
@ -801,7 +801,7 @@ impl Color {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn transparent() -> Self {
|
pub fn transparent() -> Self {
|
||||||
// We should probably set authored to "transparent", but maybe it doesn't matter.
|
// We should probably set authored to "transparent", but maybe it doesn't matter.
|
||||||
Self::from_absolute_color(AbsoluteColor::transparent())
|
Self::from_absolute_color(AbsoluteColor::TRANSPARENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a color from an [`AbsoluteColor`].
|
/// Create a color from an [`AbsoluteColor`].
|
||||||
|
|
@ -974,7 +974,7 @@ impl ToComputedValue for MozFontSmoothingBackgroundColor {
|
||||||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||||
self.0
|
self.0
|
||||||
.to_computed_value(context)
|
.to_computed_value(context)
|
||||||
.resolve_to_absolute(&AbsoluteColor::transparent())
|
.resolve_to_absolute(&AbsoluteColor::TRANSPARENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,12 @@ header = """/* This Source Code Form is subject to the terms of the Mozilla Publ
|
||||||
// Work-around silly windows.h define.
|
// Work-around silly windows.h define.
|
||||||
#pragma push_macro("STRICT")
|
#pragma push_macro("STRICT")
|
||||||
#undef STRICT
|
#undef STRICT
|
||||||
|
#pragma push_macro("TRANSPARENT")
|
||||||
|
#undef TRANSPARENT
|
||||||
"""
|
"""
|
||||||
trailer = """
|
trailer = """
|
||||||
#pragma pop_macro("STRICT")
|
#pragma pop_macro("STRICT")
|
||||||
|
#pragma pop_macro("TRANSPARENT")
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#include "mozilla/ServoStyleConstsInlines.h"
|
#include "mozilla/ServoStyleConstsInlines.h"
|
||||||
"""
|
"""
|
||||||
|
|
@ -546,10 +549,12 @@ renaming_overrides_prefixing = true
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"GenericColor" = """
|
"GenericColor" = """
|
||||||
|
static const StyleGenericColor TRANSPARENT;
|
||||||
|
static const StyleGenericColor BLACK;
|
||||||
|
static const StyleGenericColor WHITE;
|
||||||
|
|
||||||
static inline StyleGenericColor FromColor(nscolor);
|
static inline StyleGenericColor FromColor(nscolor);
|
||||||
static inline StyleGenericColor Black();
|
|
||||||
static inline StyleGenericColor White();
|
|
||||||
static inline StyleGenericColor Transparent();
|
|
||||||
bool MaybeTransparent() const;
|
bool MaybeTransparent() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -580,10 +585,6 @@ renaming_overrides_prefixing = true
|
||||||
*/
|
*/
|
||||||
static inline StyleAbsoluteColor Srgb(float red, float green, float blue, float alpha);
|
static inline StyleAbsoluteColor Srgb(float red, float green, float blue, float alpha);
|
||||||
|
|
||||||
static inline StyleAbsoluteColor Transparent();
|
|
||||||
static inline StyleAbsoluteColor Black();
|
|
||||||
static inline StyleAbsoluteColor White();
|
|
||||||
|
|
||||||
static inline StyleAbsoluteColor FromColor(nscolor);
|
static inline StyleAbsoluteColor FromColor(nscolor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue