mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out changeset 1ea4b3582033 (bug 760345) for build bustages at ia2AccessibleComponent.cpp.
This commit is contained in:
parent
67196d833b
commit
c298fe167e
@ -348,11 +348,11 @@ bool TextAttrsMgr::BGColorTextAttr::GetColor(nsIFrame* aFrame,
|
|||||||
TextAttrsMgr::ColorTextAttr::ColorTextAttr(nsIFrame* aRootFrame,
|
TextAttrsMgr::ColorTextAttr::ColorTextAttr(nsIFrame* aRootFrame,
|
||||||
nsIFrame* aFrame)
|
nsIFrame* aFrame)
|
||||||
: TTextAttr<nscolor>(!aFrame) {
|
: TTextAttr<nscolor>(!aFrame) {
|
||||||
mRootNativeValue = aRootFrame->StyleColor()->mColor.ToColor();
|
mRootNativeValue = aRootFrame->StyleColor()->mColor;
|
||||||
mIsRootDefined = true;
|
mIsRootDefined = true;
|
||||||
|
|
||||||
if (aFrame) {
|
if (aFrame) {
|
||||||
mNativeValue = aFrame->StyleColor()->mColor.ToColor();
|
mNativeValue = aFrame->StyleColor()->mColor;
|
||||||
mIsDefined = true;
|
mIsDefined = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,8 +361,9 @@ bool TextAttrsMgr::ColorTextAttr::GetValueFor(Accessible* aAccessible,
|
|||||||
nscolor* aValue) {
|
nscolor* aValue) {
|
||||||
nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
|
nsIContent* elm = nsCoreUtils::GetDOMElementFor(aAccessible->GetContent());
|
||||||
if (elm) {
|
if (elm) {
|
||||||
if (nsIFrame* frame = elm->GetPrimaryFrame()) {
|
nsIFrame* frame = elm->GetPrimaryFrame();
|
||||||
*aValue = frame->StyleColor()->mColor.ToColor();
|
if (frame) {
|
||||||
|
*aValue = frame->StyleColor()->mColor;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1001,7 +1001,7 @@ bool CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||||||
RefPtr<ComputedStyle> canvasStyle =
|
RefPtr<ComputedStyle> canvasStyle =
|
||||||
nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
|
nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
|
||||||
if (canvasStyle) {
|
if (canvasStyle) {
|
||||||
*aColor = canvasStyle->StyleColor()->mColor.ToColor();
|
*aColor = canvasStyle->StyleColor()->mColor;
|
||||||
}
|
}
|
||||||
// Beware that the presShell could be gone here.
|
// Beware that the presShell could be gone here.
|
||||||
}
|
}
|
||||||
|
@ -623,10 +623,10 @@ nsresult HTMLEditor::GetTemporaryStyleForFocusedPositionedElement(
|
|||||||
|
|
||||||
const uint8_t kBlackBgTrigger = 0xd0;
|
const uint8_t kBlackBgTrigger = 0xd0;
|
||||||
|
|
||||||
const auto& color = style->StyleColor()->mColor;
|
nscolor color = style->StyleColor()->mColor;
|
||||||
if (color.red >= kBlackBgTrigger &&
|
if (NS_GET_R(color) >= kBlackBgTrigger &&
|
||||||
color.green >= kBlackBgTrigger &&
|
NS_GET_G(color) >= kBlackBgTrigger &&
|
||||||
color.blue >= kBlackBgTrigger) {
|
NS_GET_B(color) >= kBlackBgTrigger) {
|
||||||
aReturn.AssignLiteral("black");
|
aReturn.AssignLiteral("black");
|
||||||
} else {
|
} else {
|
||||||
aReturn.AssignLiteral("white");
|
aReturn.AssignLiteral("white");
|
||||||
|
@ -256,7 +256,7 @@ void nsFont::AddFontFeaturesToStyle(gfxFontStyle* aStyle,
|
|||||||
aStyle->useGrayscaleAntialiasing = true;
|
aStyle->useGrayscaleAntialiasing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
aStyle->fontSmoothingBackgroundColor = fontSmoothingBackgroundColor.ToColor();
|
aStyle->fontSmoothingBackgroundColor = fontSmoothingBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsFont::AddFontVariationsToStyle(gfxFontStyle* aStyle) const {
|
void nsFont::AddFontVariationsToStyle(gfxFontStyle* aStyle) const {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "gfxFontVariations.h"
|
#include "gfxFontVariations.h"
|
||||||
#include "mozilla/FontPropertyTypes.h"
|
#include "mozilla/FontPropertyTypes.h"
|
||||||
#include "mozilla/RefPtr.h" // for RefPtr
|
#include "mozilla/RefPtr.h" // for RefPtr
|
||||||
#include "mozilla/StyleColorInlines.h" // for StyleRGBA
|
#include "nsColor.h" // for nsColor and NS_RGBA
|
||||||
#include "nsCoord.h" // for nscoord
|
#include "nsCoord.h" // for nscoord
|
||||||
#include "nsTArray.h" // for nsTArray
|
#include "nsTArray.h" // for nsTArray
|
||||||
|
|
||||||
@ -51,8 +51,7 @@ struct nsFont {
|
|||||||
|
|
||||||
// The estimated background color behind the text. Enables a special
|
// The estimated background color behind the text. Enables a special
|
||||||
// rendering mode when NS_GET_A(.) > 0. Only used for text in the chrome.
|
// rendering mode when NS_GET_A(.) > 0. Only used for text in the chrome.
|
||||||
mozilla::StyleRGBA fontSmoothingBackgroundColor =
|
nscolor fontSmoothingBackgroundColor = NS_RGBA(0, 0, 0, 0);
|
||||||
mozilla::StyleRGBA::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
|
||||||
|
@ -1565,9 +1565,5 @@ Color ToDeviceColor(nscolor aColor) {
|
|||||||
return ToDeviceColor(Color::FromABGR(aColor));
|
return ToDeviceColor(Color::FromABGR(aColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
Color ToDeviceColor(const StyleRGBA& aColor) {
|
|
||||||
return ToDeviceColor(aColor.ToColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gfx
|
} // namespace gfx
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -327,9 +327,6 @@ class gfxUtils {
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
struct StyleRGBA;
|
|
||||||
|
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -340,7 +337,6 @@ namespace gfx {
|
|||||||
* applicable).
|
* applicable).
|
||||||
*/
|
*/
|
||||||
Color ToDeviceColor(Color aColor);
|
Color ToDeviceColor(Color aColor);
|
||||||
Color ToDeviceColor(const StyleRGBA& aColor);
|
|
||||||
Color ToDeviceColor(nscolor aColor);
|
Color ToDeviceColor(nscolor aColor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -635,8 +635,13 @@ void nsCanvasFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt) {
|
|||||||
// for HTML documents?
|
// for HTML documents?
|
||||||
nsIFrame* root = mFrames.FirstChild();
|
nsIFrame* root = mFrames.FirstChild();
|
||||||
const nsStyleColor* color = root ? root->StyleColor() : StyleColor();
|
const nsStyleColor* color = root ? root->StyleColor() : StyleColor();
|
||||||
|
if (!color) {
|
||||||
|
NS_ERROR("current color cannot be found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsCSSRendering::PaintFocus(PresContext(), aDrawTarget, focusRect,
|
nsCSSRendering::PaintFocus(PresContext(), aDrawTarget, focusRect,
|
||||||
color->mColor.ToColor());
|
color->mColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
|
@ -1157,7 +1157,7 @@ void nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
|||||||
const nsString& aAltText,
|
const nsString& aAltText,
|
||||||
const nsRect& aRect) {
|
const nsRect& aRect) {
|
||||||
// Set font and color
|
// Set font and color
|
||||||
aRenderingContext.SetColor(Color::FromABGR(StyleColor()->mColor.ToColor()));
|
aRenderingContext.SetColor(Color::FromABGR(StyleColor()->mColor));
|
||||||
RefPtr<nsFontMetrics> fm =
|
RefPtr<nsFontMetrics> fm =
|
||||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||||
|
|
||||||
|
@ -461,8 +461,17 @@ static void SetAnimatable(nsCSSPropertyID aProperty,
|
|||||||
case eCSSProperty_background_color: {
|
case eCSSProperty_background_color: {
|
||||||
// We don't support color animation on the compositor yet so that we can
|
// We don't support color animation on the compositor yet so that we can
|
||||||
// resolve currentColor at this moment.
|
// resolve currentColor at this moment.
|
||||||
nscolor foreground =
|
nscolor foreground;
|
||||||
aFrame->Style()->GetVisitedDependentColor(&nsStyleColor::mColor);
|
if (aFrame->Style()->RelevantLinkVisited()) {
|
||||||
|
if (ComputedStyle* styleIfVisited =
|
||||||
|
aFrame->Style()->GetStyleIfVisited()) {
|
||||||
|
foreground = styleIfVisited->StyleColor()->mColor;
|
||||||
|
} else {
|
||||||
|
foreground = aFrame->Style()->StyleColor()->mColor;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreground = aFrame->Style()->StyleColor()->mColor;
|
||||||
|
}
|
||||||
aAnimatable = aAnimationValue.GetColor(foreground);
|
aAnimatable = aAnimationValue.GetColor(foreground);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -278,8 +278,8 @@ static nscolor GetVisitedDependentColorInternal(ComputedStyle* aSc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static nscolor ExtractColor(const ComputedStyle& aStyle,
|
static nscolor ExtractColor(const ComputedStyle& aStyle,
|
||||||
const StyleRGBA& aColor) {
|
const nscolor& aColor) {
|
||||||
return aColor.ToColor();
|
return aColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nscolor ExtractColor(const ComputedStyle& aStyle,
|
static nscolor ExtractColor(const ComputedStyle& aStyle,
|
||||||
|
@ -15,21 +15,21 @@ namespace mozilla {
|
|||||||
|
|
||||||
// Blend one RGBA color with another based on a given ratios.
|
// Blend one RGBA color with another based on a given ratios.
|
||||||
// It is a linear combination of each channel with alpha premultipled.
|
// It is a linear combination of each channel with alpha premultipled.
|
||||||
static nscolor LinearBlendColors(const StyleRGBA& aBg, float aBgRatio,
|
static nscolor LinearBlendColors(nscolor aBg, float aBgRatio, nscolor aFg,
|
||||||
const StyleRGBA& aFg, float aFgRatio) {
|
float aFgRatio) {
|
||||||
constexpr float kFactor = 1.0f / 255.0f;
|
constexpr float kFactor = 1.0f / 255.0f;
|
||||||
|
|
||||||
float p1 = aBgRatio;
|
float p1 = aBgRatio;
|
||||||
float a1 = kFactor * aBg.alpha;
|
float a1 = kFactor * NS_GET_A(aBg);
|
||||||
float r1 = a1 * aBg.red;
|
float r1 = a1 * NS_GET_R(aBg);
|
||||||
float g1 = a1 * aBg.green;
|
float g1 = a1 * NS_GET_G(aBg);
|
||||||
float b1 = a1 * aBg.blue;
|
float b1 = a1 * NS_GET_B(aBg);
|
||||||
|
|
||||||
float p2 = aFgRatio;
|
float p2 = aFgRatio;
|
||||||
float a2 = kFactor * aFg.alpha;
|
float a2 = kFactor * NS_GET_A(aFg);
|
||||||
float r2 = a2 * aFg.red;
|
float r2 = a2 * NS_GET_R(aFg);
|
||||||
float g2 = a2 * aFg.green;
|
float g2 = a2 * NS_GET_G(aFg);
|
||||||
float b2 = a2 * aFg.blue;
|
float b2 = a2 * NS_GET_B(aFg);
|
||||||
|
|
||||||
float a = p1 * a1 + p2 * a2;
|
float a = p1 * a1 + p2 * a2;
|
||||||
if (a <= 0.f) {
|
if (a <= 0.f) {
|
||||||
@ -55,22 +55,21 @@ bool StyleColor::MaybeTransparent() const {
|
|||||||
return !IsNumeric() || AsNumeric().alpha != 255;
|
return !IsNumeric() || AsNumeric().alpha != 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
static nscolor RGBAToNSColor(const StyleRGBA& aRGBA) {
|
||||||
nscolor StyleColor::CalcColor(nscolor aColor) const {
|
return NS_RGBA(aRGBA.red, aRGBA.green, aRGBA.blue, aRGBA.alpha);
|
||||||
return CalcColor(StyleRGBA::FromColor(aColor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
nscolor StyleColor::CalcColor(const StyleRGBA& aForegroundColor) const {
|
nscolor StyleColor::CalcColor(nscolor aForegroundColor) const {
|
||||||
if (IsNumeric()) {
|
if (IsNumeric()) {
|
||||||
return AsNumeric().ToColor();
|
return RGBAToNSColor(AsNumeric());
|
||||||
}
|
}
|
||||||
if (IsCurrentColor()) {
|
if (IsCurrentColor()) {
|
||||||
return aForegroundColor.ToColor();
|
return aForegroundColor;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(IsComplex());
|
MOZ_ASSERT(IsComplex());
|
||||||
const auto& complex = AsComplex();
|
const auto& complex = AsComplex();
|
||||||
return LinearBlendColors(complex.color, complex.ratios.bg,
|
return LinearBlendColors(RGBAToNSColor(complex.color), complex.ratios.bg,
|
||||||
aForegroundColor, complex.ratios.fg);
|
aForegroundColor, complex.ratios.fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,9 +79,11 @@ nscolor StyleColor::CalcColor(const ComputedStyle& aStyle) const {
|
|||||||
// can skip resolving StyleColor().
|
// can skip resolving StyleColor().
|
||||||
// TODO(djg): Is this optimization worth it?
|
// TODO(djg): Is this optimization worth it?
|
||||||
if (IsNumeric()) {
|
if (IsNumeric()) {
|
||||||
return AsNumeric().ToColor();
|
return RGBAToNSColor(AsNumeric());
|
||||||
}
|
}
|
||||||
return CalcColor(aStyle.StyleColor()->mColor);
|
|
||||||
|
auto fgColor = aStyle.StyleColor()->mColor;
|
||||||
|
return CalcColor(fgColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -14,21 +14,10 @@
|
|||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
inline StyleRGBA StyleRGBA::FromColor(nscolor aColor) {
|
|
||||||
return {NS_GET_R(aColor), NS_GET_G(aColor), NS_GET_B(aColor), NS_GET_A(aColor)};
|
|
||||||
}
|
|
||||||
|
|
||||||
inline nscolor StyleRGBA::ToColor() const {
|
|
||||||
return NS_RGBA(red, green, blue, alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline StyleRGBA StyleRGBA::Transparent() {
|
|
||||||
return {0, 0, 0, 0};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline StyleColor StyleColor::FromColor(nscolor aColor) {
|
inline StyleColor StyleColor::FromColor(nscolor aColor) {
|
||||||
return StyleColor::Numeric(StyleRGBA::FromColor(aColor));
|
return StyleColor::Numeric({NS_GET_R(aColor), NS_GET_G(aColor),
|
||||||
|
NS_GET_B(aColor), NS_GET_A(aColor)});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -47,10 +36,7 @@ inline StyleColor StyleColor::Transparent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
nscolor StyleColor::CalcColor(const StyleRGBA&) const;
|
nscolor StyleColor::CalcColor(nscolor aForegroundColor) const;
|
||||||
|
|
||||||
template <>
|
|
||||||
nscolor StyleColor::CalcColor(nscolor) const;
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
nscolor StyleColor::CalcColor(const ComputedStyle&) const;
|
nscolor StyleColor::CalcColor(const ComputedStyle&) const;
|
||||||
|
@ -1047,7 +1047,7 @@ void nsComputedDOMStyle::SetValueFromComplexColor(
|
|||||||
|
|
||||||
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetColor() {
|
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetColor() {
|
||||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
SetToRGBAColor(val, StyleColor()->mColor.ToColor());
|
SetToRGBAColor(val, StyleColor()->mColor);
|
||||||
return val.forget();
|
return val.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2142,7 +2142,7 @@ static_assert(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
|
|||||||
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetCaretColor() {
|
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetCaretColor() {
|
||||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
if (StyleUI()->mCaretColor.IsAuto()) {
|
if (StyleUI()->mCaretColor.IsAuto()) {
|
||||||
SetToRGBAColor(val, StyleColor()->mColor.ToColor());
|
SetToRGBAColor(val, StyleColor()->mColor);
|
||||||
} else {
|
} else {
|
||||||
SetValueFromComplexColor(val, StyleUI()->mCaretColor.AsColor());
|
SetValueFromComplexColor(val, StyleUI()->mCaretColor.AsColor());
|
||||||
}
|
}
|
||||||
|
@ -1672,9 +1672,8 @@ nsChangeHint nsStyleTableBorder::CalcDifference(
|
|||||||
// nsStyleColor
|
// nsStyleColor
|
||||||
//
|
//
|
||||||
|
|
||||||
static StyleRGBA DefaultColor(const Document& aDocument) {
|
static nscolor DefaultColor(const Document& aDocument) {
|
||||||
return
|
return PreferenceSheet::PrefsFor(aDocument).mDefaultColor;
|
||||||
StyleRGBA::FromColor(PreferenceSheet::PrefsFor(aDocument).mDefaultColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleColor::nsStyleColor(const Document& aDocument)
|
nsStyleColor::nsStyleColor(const Document& aDocument)
|
||||||
|
@ -466,9 +466,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor {
|
|||||||
|
|
||||||
// Don't add ANY members to this struct! We can achieve caching in the rule
|
// Don't add ANY members to this struct! We can achieve caching in the rule
|
||||||
// tree (rather than the style tree) by letting color stay by itself! -dwh
|
// tree (rather than the style tree) by letting color stay by itself! -dwh
|
||||||
//
|
nscolor mColor;
|
||||||
// FIXME(emilio): Not sure having color in its own struct is worth it anymore.
|
|
||||||
mozilla::StyleRGBA mColor;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nsStyleImageLayers {
|
struct nsStyleImageLayers {
|
||||||
|
@ -601,7 +601,7 @@ nsresult nsFilterInstance::BuildPrimitivesForFilter(
|
|||||||
// If we don't have a frame, use opaque black for shadows with unspecified
|
// If we don't have a frame, use opaque black for shadows with unspecified
|
||||||
// shadow colors.
|
// shadow colors.
|
||||||
nscolor shadowFallbackColor =
|
nscolor shadowFallbackColor =
|
||||||
mTargetFrame ? mTargetFrame->StyleColor()->mColor.ToColor() : NS_RGB(0, 0, 0);
|
mTargetFrame ? mTargetFrame->StyleColor()->mColor : NS_RGB(0, 0, 0);
|
||||||
|
|
||||||
nsCSSFilterInstance cssFilterInstance(
|
nsCSSFilterInstance cssFilterInstance(
|
||||||
aFilter, shadowFallbackColor, mTargetBounds,
|
aFilter, shadowFallbackColor, mTargetBounds,
|
||||||
|
@ -283,7 +283,7 @@ void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
nsRect drawRect =
|
nsRect drawRect =
|
||||||
static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
|
static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
|
||||||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect, GetPaintRect(),
|
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect, GetPaintRect(),
|
||||||
mFrame->StyleColor()->mColor.ToColor(),
|
mFrame->StyleColor()->mColor,
|
||||||
PaintTextShadowCallback, (void*)this);
|
PaintTextShadowCallback, (void*)this);
|
||||||
|
|
||||||
PaintTextToContext(aCtx, nsPoint(0, 0), nullptr);
|
PaintTextToContext(aCtx, nsPoint(0, 0), nullptr);
|
||||||
@ -488,7 +488,7 @@ void nsTextBoxFrame::DrawText(gfxContext& aRenderingContext,
|
|||||||
|
|
||||||
CalculateUnderline(refDrawTarget, *fontMet);
|
CalculateUnderline(refDrawTarget, *fontMet);
|
||||||
|
|
||||||
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor.ToColor();
|
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
|
||||||
ColorPattern color(ToDeviceColor(c));
|
ColorPattern color(ToDeviceColor(c));
|
||||||
aRenderingContext.SetColor(Color::FromABGR(c));
|
aRenderingContext.SetColor(Color::FromABGR(c));
|
||||||
|
|
||||||
|
@ -3485,7 +3485,7 @@ ImgDrawResult nsTreeBodyFrame::PaintText(
|
|||||||
}
|
}
|
||||||
|
|
||||||
aRenderingContext.SetColor(
|
aRenderingContext.SetColor(
|
||||||
Color::FromABGR(textContext->StyleColor()->mColor.ToColor()));
|
Color::FromABGR(textContext->StyleColor()->mColor));
|
||||||
nsLayoutUtils::DrawString(
|
nsLayoutUtils::DrawString(
|
||||||
this, *fontMet, &aRenderingContext, text.get(), text.Length(),
|
this, *fontMet, &aRenderingContext, text.get(), text.Length(),
|
||||||
textRect.TopLeft() + nsPoint(0, baseline), cellContext);
|
textRect.TopLeft() + nsPoint(0, baseline), cellContext);
|
||||||
|
@ -40,6 +40,8 @@ use crate::gecko_bindings::structs::nsCSSPropertyID;
|
|||||||
use crate::gecko_bindings::structs::mozilla::PseudoStyleType;
|
use crate::gecko_bindings::structs::mozilla::PseudoStyleType;
|
||||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
|
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
|
||||||
use crate::gecko_bindings::sugar::refptr::RefPtr;
|
use crate::gecko_bindings::sugar::refptr::RefPtr;
|
||||||
|
use crate::gecko::values::convert_nscolor_to_rgba;
|
||||||
|
use crate::gecko::values::convert_rgba_to_nscolor;
|
||||||
use crate::gecko::values::GeckoStyleCoordConvertible;
|
use crate::gecko::values::GeckoStyleCoordConvertible;
|
||||||
use crate::gecko::values::round_border_to_device_pixels;
|
use crate::gecko::values::round_border_to_device_pixels;
|
||||||
use crate::logical_geometry::WritingMode;
|
use crate::logical_geometry::WritingMode;
|
||||||
@ -419,6 +421,18 @@ def set_gecko_property(ffi_name, expr):
|
|||||||
}
|
}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
<%def name="impl_rgba_color(ident, gecko_ffi_name)">
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
|
||||||
|
${set_gecko_property(gecko_ffi_name, "convert_rgba_to_nscolor(&v)")}
|
||||||
|
}
|
||||||
|
<%call expr="impl_simple_copy(ident, gecko_ffi_name)"></%call>
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
|
||||||
|
convert_nscolor_to_rgba(${get_gecko_property(gecko_ffi_name)})
|
||||||
|
}
|
||||||
|
</%def>
|
||||||
|
|
||||||
<%def name="impl_svg_length(ident, gecko_ffi_name)">
|
<%def name="impl_svg_length(ident, gecko_ffi_name)">
|
||||||
// When context-value is used on an SVG length, the corresponding flag is
|
// When context-value is used on an SVG length, the corresponding flag is
|
||||||
// set on mContextFlags, and the length field is set to the initial value.
|
// set on mContextFlags, and the length field is set to the initial value.
|
||||||
@ -1192,6 +1206,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
|
|||||||
predefined_types = {
|
predefined_types = {
|
||||||
"length::NonNegativeLengthPercentageOrNormal": impl_style_coord,
|
"length::NonNegativeLengthPercentageOrNormal": impl_style_coord,
|
||||||
"MozScriptMinSize": impl_absolute_length,
|
"MozScriptMinSize": impl_absolute_length,
|
||||||
|
"RGBAColor": impl_rgba_color,
|
||||||
"SVGLength": impl_svg_length,
|
"SVGLength": impl_svg_length,
|
||||||
"SVGOpacity": impl_svg_opacity,
|
"SVGOpacity": impl_svg_opacity,
|
||||||
"SVGPaint": impl_svg_paint,
|
"SVGPaint": impl_svg_paint,
|
||||||
@ -4328,7 +4343,8 @@ clip-path
|
|||||||
}
|
}
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
<%self:impl_trait style_struct_name="Color">
|
<%self:impl_trait style_struct_name="Color" skip_longhands="color">
|
||||||
|
${impl_rgba_color("color", "mColor")}
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
<%self:impl_trait style_struct_name="InheritedUI" skip_longhands="cursor">
|
<%self:impl_trait style_struct_name="InheritedUI" skip_longhands="cursor">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"background-color",
|
"background-color",
|
||||||
"Color",
|
"Color",
|
||||||
"computed::Color::transparent()",
|
"computed_value::T::transparent()",
|
||||||
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",
|
||||||
animation_value_type="AnimatedColor",
|
animation_value_type="AnimatedColor",
|
||||||
|
@ -521,9 +521,9 @@ ${helpers.single_keyword(
|
|||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"-moz-font-smoothing-background-color",
|
"-moz-font-smoothing-background-color",
|
||||||
"color::MozFontSmoothingBackgroundColor",
|
"RGBAColor",
|
||||||
"computed::color::MozFontSmoothingBackgroundColor::transparent()",
|
"RGBA::transparent()",
|
||||||
animation_value_type="none",
|
animation_value_type="AnimatedRGBA",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
gecko_ffi_name="mFont.fontSmoothingBackgroundColor",
|
gecko_ffi_name="mFont.fontSmoothingBackgroundColor",
|
||||||
enabled_in="chrome",
|
enabled_in="chrome",
|
||||||
|
@ -1287,6 +1287,32 @@ impl LonghandId {
|
|||||||
LonghandId::Direction
|
LonghandId::Direction
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether computed values of this property lossily convert any complex
|
||||||
|
/// colors into RGBA colors.
|
||||||
|
///
|
||||||
|
/// In Gecko, there are some properties still that compute currentcolor
|
||||||
|
/// down to an RGBA color at computed value time, instead of as
|
||||||
|
/// `StyleColor`s. For these properties, we must return `false`,
|
||||||
|
/// so that we correctly avoid caching style data in the rule tree.
|
||||||
|
pub fn stores_complex_colors_lossily(&self) -> bool {
|
||||||
|
% if product == "gecko":
|
||||||
|
matches!(*self,
|
||||||
|
% for property in data.longhands:
|
||||||
|
% if property.predefined_type == "RGBAColor":
|
||||||
|
LonghandId::${property.camel_case} |
|
||||||
|
% endif
|
||||||
|
% endfor
|
||||||
|
LonghandId::BackgroundImage |
|
||||||
|
LonghandId::BorderImageSource |
|
||||||
|
LonghandId::BoxShadow |
|
||||||
|
LonghandId::MaskImage |
|
||||||
|
LonghandId::TextShadow
|
||||||
|
)
|
||||||
|
% else:
|
||||||
|
false
|
||||||
|
% endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator over all the property ids that are enabled for a given
|
/// An iterator over all the property ids that are enabled for a given
|
||||||
|
@ -11,14 +11,14 @@ use cssparser::{Color as CSSParserColor, RGBA};
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{CssWriter, ToCss};
|
use style_traits::{CssWriter, ToCss};
|
||||||
|
|
||||||
|
/// Computed value type for the specified RGBAColor.
|
||||||
|
pub type RGBAColor = RGBA;
|
||||||
|
|
||||||
/// The computed value of the `color` property.
|
/// The computed value of the `color` property.
|
||||||
pub type ColorPropertyValue = RGBA;
|
pub type ColorPropertyValue = RGBA;
|
||||||
|
|
||||||
/// The computed value of `-moz-font-smoothing-background-color`.
|
|
||||||
pub type MozFontSmoothingBackgroundColor = RGBA;
|
|
||||||
|
|
||||||
/// A computed value for `<color>`.
|
/// A computed value for `<color>`.
|
||||||
pub type Color = GenericColor<RGBA>;
|
pub type Color = GenericColor<RGBAColor>;
|
||||||
|
|
||||||
impl Color {
|
impl Color {
|
||||||
/// Returns a complex color value representing transparent.
|
/// Returns a complex color value representing transparent.
|
||||||
|
@ -43,7 +43,7 @@ pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
|
|||||||
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
||||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapType, TouchAction, VerticalAlign, WillChange};
|
pub use self::box_::{ScrollSnapAlign, ScrollSnapType, TouchAction, VerticalAlign, WillChange};
|
||||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue};
|
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, RGBAColor};
|
||||||
pub use self::column::ColumnCount;
|
pub use self::column::ColumnCount;
|
||||||
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterSetOrReset};
|
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterSetOrReset};
|
||||||
pub use self::easing::TimingFunction;
|
pub use self::easing::TimingFunction;
|
||||||
|
@ -373,7 +373,15 @@ impl ToComputedValue for Color {
|
|||||||
type ComputedValue = ComputedColor;
|
type ComputedValue = ComputedColor;
|
||||||
|
|
||||||
fn to_computed_value(&self, context: &Context) -> ComputedColor {
|
fn to_computed_value(&self, context: &Context) -> ComputedColor {
|
||||||
self.to_computed_color(Some(context)).unwrap()
|
let result = self.to_computed_color(Some(context)).unwrap();
|
||||||
|
if !result.is_numeric() {
|
||||||
|
if let Some(longhand) = context.for_non_inherited_property {
|
||||||
|
if longhand.stores_complex_colors_lossily() {
|
||||||
|
context.rule_cache_conditions.borrow_mut().set_uncacheable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_computed_value(computed: &ComputedColor) -> Self {
|
fn from_computed_value(computed: &ComputedColor) -> Self {
|
||||||
@ -385,33 +393,37 @@ impl ToComputedValue for Color {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Specified color value for `-moz-font-smoothing-background-color`.
|
/// Specified color value, but resolved to just RGBA for computed value
|
||||||
///
|
/// with value from color property at the same context.
|
||||||
/// This property does not support `currentcolor`. We could drop it at
|
|
||||||
/// parse-time, but it's not exposed to the web so it doesn't really matter.
|
|
||||||
///
|
|
||||||
/// We resolve it to `transparent` instead.
|
|
||||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
|
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
|
||||||
pub struct MozFontSmoothingBackgroundColor(pub Color);
|
pub struct RGBAColor(pub Color);
|
||||||
|
|
||||||
impl Parse for MozFontSmoothingBackgroundColor {
|
impl Parse for RGBAColor {
|
||||||
fn parse<'i, 't>(
|
fn parse<'i, 't>(
|
||||||
context: &ParserContext,
|
context: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
Color::parse(context, input).map(MozFontSmoothingBackgroundColor)
|
Color::parse(context, input).map(RGBAColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToComputedValue for MozFontSmoothingBackgroundColor {
|
impl ToComputedValue for RGBAColor {
|
||||||
type ComputedValue = RGBA;
|
type ComputedValue = RGBA;
|
||||||
|
|
||||||
fn to_computed_value(&self, context: &Context) -> RGBA {
|
fn to_computed_value(&self, context: &Context) -> RGBA {
|
||||||
self.0.to_computed_value(context).to_rgba(RGBA::transparent())
|
self.0
|
||||||
|
.to_computed_value(context)
|
||||||
|
.to_rgba(context.style().get_color().clone_color())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_computed_value(computed: &RGBA) -> Self {
|
fn from_computed_value(computed: &RGBA) -> Self {
|
||||||
MozFontSmoothingBackgroundColor(Color::rgba(*computed))
|
RGBAColor(Color::rgba(*computed))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Color> for RGBAColor {
|
||||||
|
fn from(color: Color) -> RGBAColor {
|
||||||
|
RGBAColor(color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ pub use self::box_::{Clear, Float, Overflow, OverflowAnchor};
|
|||||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapType};
|
pub use self::box_::{ScrollSnapAlign, ScrollSnapType};
|
||||||
pub use self::box_::{TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
pub use self::box_::{TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
||||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue};
|
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, RGBAColor};
|
||||||
pub use self::column::ColumnCount;
|
pub use self::column::ColumnCount;
|
||||||
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterSetOrReset};
|
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterSetOrReset};
|
||||||
pub use self::easing::TimingFunction;
|
pub use self::easing::TimingFunction;
|
||||||
|
@ -310,12 +310,4 @@ renaming_overrides_prefixing = true
|
|||||||
* Compute the final color, making the argument the foreground color.
|
* Compute the final color, making the argument the foreground color.
|
||||||
*/
|
*/
|
||||||
nscolor CalcColor(nscolor) const;
|
nscolor CalcColor(nscolor) const;
|
||||||
nscolor CalcColor(const StyleRGBA&) const;
|
|
||||||
"""
|
|
||||||
|
|
||||||
"RGBA" = """
|
|
||||||
static inline StyleRGBA Transparent();
|
|
||||||
static inline StyleRGBA FromColor(nscolor);
|
|
||||||
|
|
||||||
inline nscolor ToColor() const;
|
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user