Bug 453916: treat transparency strictly as a special case of color alpha. r+sr=dbaron
This commit is contained in:
@@ -402,12 +402,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||||||
nscolor color;
|
nscolor color;
|
||||||
if (value->GetColorValue(color)) {
|
if (value->GetColorValue(color)) {
|
||||||
aData->mColorData->mBackColor.SetColorValue(color);
|
aData->mColorData->mBackColor.SetColorValue(color);
|
||||||
} else {
|
|
||||||
nsAutoString str(value->GetStringValue());
|
|
||||||
str.CompressWhitespace();
|
|
||||||
if (str.EqualsLiteral("transparent")) {
|
|
||||||
aData->mColorData->mBackColor.SetColorValue(NS_RGBA(0,0,0,0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ GFX_COLOR(tan, NS_RGB(210, 180, 140))
|
|||||||
GFX_COLOR(teal, NS_RGB( 0, 128, 128))
|
GFX_COLOR(teal, NS_RGB( 0, 128, 128))
|
||||||
GFX_COLOR(thistle, NS_RGB(216, 191, 216))
|
GFX_COLOR(thistle, NS_RGB(216, 191, 216))
|
||||||
GFX_COLOR(tomato, NS_RGB(255, 99, 71))
|
GFX_COLOR(tomato, NS_RGB(255, 99, 71))
|
||||||
|
GFX_COLOR(transparent, NS_RGBA(0, 0, 0, 0))
|
||||||
GFX_COLOR(turquoise, NS_RGB( 64, 224, 208))
|
GFX_COLOR(turquoise, NS_RGB( 64, 224, 208))
|
||||||
GFX_COLOR(violet, NS_RGB(238, 130, 238))
|
GFX_COLOR(violet, NS_RGB(238, 130, 238))
|
||||||
GFX_COLOR(wheat, NS_RGB(245, 222, 179))
|
GFX_COLOR(wheat, NS_RGB(245, 222, 179))
|
||||||
|
|||||||
@@ -596,14 +596,12 @@ nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
// pull out styles, colors, composite colors
|
// pull out styles, colors, composite colors
|
||||||
NS_FOR_CSS_SIDES (i) {
|
NS_FOR_CSS_SIDES (i) {
|
||||||
PRBool transparent, foreground;
|
PRBool foreground;
|
||||||
borderStyles[i] = aBorderStyle.GetBorderStyle(i);
|
borderStyles[i] = aBorderStyle.GetBorderStyle(i);
|
||||||
aBorderStyle.GetBorderColor(i, borderColors[i], transparent, foreground);
|
aBorderStyle.GetBorderColor(i, borderColors[i], foreground);
|
||||||
aBorderStyle.GetCompositeColors(i, &compositeColors[i]);
|
aBorderStyle.GetCompositeColors(i, &compositeColors[i]);
|
||||||
|
|
||||||
if (transparent)
|
if (foreground)
|
||||||
borderColors[i] = 0x0;
|
|
||||||
else if (foreground)
|
|
||||||
borderColors[i] = ourColor->mColor;
|
borderColors[i] = ourColor->mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,7 +961,7 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext,
|
|||||||
|
|
||||||
while (context) {
|
while (context) {
|
||||||
result = context->GetStyleBackground();
|
result = context->GetStyleBackground();
|
||||||
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
|
if (NS_GET_A(result->mBackgroundColor) > 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
context = context->GetParent();
|
context = context->GetParent();
|
||||||
@@ -1301,7 +1299,7 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
nsIViewManager* vm = aPresContext->GetViewManager();
|
nsIViewManager* vm = aPresContext->GetViewManager();
|
||||||
|
|
||||||
if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
if (NS_GET_A(canvasColor.mBackgroundColor) == 0) {
|
||||||
nsIView* rootView;
|
nsIView* rootView;
|
||||||
vm->GetRootView(rootView);
|
vm->GetRootView(rootView);
|
||||||
if (!rootView->GetParent()) {
|
if (!rootView->GetParent()) {
|
||||||
@@ -1314,7 +1312,6 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
if (!widgetIsTransparent) {
|
if (!widgetIsTransparent) {
|
||||||
// Ensure that we always paint a color for the root (in case there's
|
// Ensure that we always paint a color for the root (in case there's
|
||||||
// no background at all or a partly transparent image).
|
// no background at all or a partly transparent image).
|
||||||
canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
|
||||||
canvasColor.mBackgroundColor = aPresContext->DefaultBackgroundColor();
|
canvasColor.mBackgroundColor = aPresContext->DefaultBackgroundColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1414,10 +1411,9 @@ IsSolidBorderEdge(const nsStyleBorder& aBorder, PRUint32 aSide)
|
|||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nscolor color;
|
nscolor color;
|
||||||
PRBool isTransparent;
|
|
||||||
PRBool isForeground;
|
PRBool isForeground;
|
||||||
aBorder.GetBorderColor(aSide, color, isTransparent, isForeground);
|
aBorder.GetBorderColor(aSide, color, isForeground);
|
||||||
return !isTransparent && NS_GET_A(color) == 255;
|
return NS_GET_A(color) == 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1590,8 +1586,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
|||||||
// on the dirty rect before accounting for the background-position.
|
// on the dirty rect before accounting for the background-position.
|
||||||
nscoord tileWidth = imageSize.width;
|
nscoord tileWidth = imageSize.width;
|
||||||
nscoord tileHeight = imageSize.height;
|
nscoord tileHeight = imageSize.height;
|
||||||
PRBool needBackgroundColor = !(aColor.mBackgroundFlags &
|
PRBool needBackgroundColor = NS_GET_A(aColor.mBackgroundColor) > 0;
|
||||||
NS_STYLE_BG_COLOR_TRANSPARENT);
|
|
||||||
PRIntn repeat = aColor.mBackgroundRepeat;
|
PRIntn repeat = aColor.mBackgroundRepeat;
|
||||||
|
|
||||||
switch (repeat) {
|
switch (repeat) {
|
||||||
@@ -2331,7 +2326,7 @@ nsCSSRendering::PaintBackgroundColor(nsPresContext* aPresContext,
|
|||||||
// color if we're not completely transparent. See the corresponding check
|
// color if we're not completely transparent. See the corresponding check
|
||||||
// for whether we're allowed to paint background images in
|
// for whether we're allowed to paint background images in
|
||||||
// PaintBackgroundWithSC before the first call to PaintBackgroundColor.
|
// PaintBackgroundWithSC before the first call to PaintBackgroundColor.
|
||||||
if ((aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&
|
if (NS_GET_A(aColor.mBackgroundColor) == 0 &&
|
||||||
(aCanPaintNonWhite || aColor.IsTransparent())) {
|
(aCanPaintNonWhite || aColor.IsTransparent())) {
|
||||||
// nothing to paint
|
// nothing to paint
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -253,31 +253,6 @@ ComputeBorderCornerDimensions(const gfxRect& aOuterRect,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// And this is what we get due to the aRidiculous aPrefix aConvetion
|
|
||||||
// aFor aArguments (sic).
|
|
||||||
static PRBool
|
|
||||||
AreCompositeColorsEqual(nsBorderColors *aA, nsBorderColors *aB)
|
|
||||||
{
|
|
||||||
if (aA == aB)
|
|
||||||
return PR_TRUE;
|
|
||||||
|
|
||||||
if (!aA || !aB)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
while (aA && aB) {
|
|
||||||
if (aA->mTransparent != aB->mTransparent)
|
|
||||||
return PR_FALSE;
|
|
||||||
if (!aA->mTransparent && (aA->mColor != aB->mColor))
|
|
||||||
return PR_FALSE;
|
|
||||||
aA = aA->mNext;
|
|
||||||
aB = aB->mNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
// both should be NULL if these are equal, otherwise one
|
|
||||||
// has more colors than another
|
|
||||||
return (aA == aB);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsCSSBorderRenderer::AreBorderSideFinalStylesSame(PRUint8 aSides)
|
nsCSSBorderRenderer::AreBorderSideFinalStylesSame(PRUint8 aSides)
|
||||||
{
|
{
|
||||||
@@ -295,7 +270,8 @@ nsCSSBorderRenderer::AreBorderSideFinalStylesSame(PRUint8 aSides)
|
|||||||
|
|
||||||
if (mBorderStyles[firstStyle] != mBorderStyles[i] ||
|
if (mBorderStyles[firstStyle] != mBorderStyles[i] ||
|
||||||
mBorderColors[firstStyle] != mBorderColors[i] ||
|
mBorderColors[firstStyle] != mBorderColors[i] ||
|
||||||
!AreCompositeColorsEqual(mCompositeColors[firstStyle], mCompositeColors[i]))
|
!nsBorderColors::Equal(mCompositeColors[firstStyle],
|
||||||
|
mCompositeColors[i]))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,9 +668,6 @@ ComputeCompositeColorForLine(PRUint32 aLineIndex,
|
|||||||
while (aLineIndex-- && aBorderColors->mNext)
|
while (aLineIndex-- && aBorderColors->mNext)
|
||||||
aBorderColors = aBorderColors->mNext;
|
aBorderColors = aBorderColors->mNext;
|
||||||
|
|
||||||
if (aBorderColors->mTransparent)
|
|
||||||
return gfxRGBA(0.0, 0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
return gfxRGBA(aBorderColors->mColor);
|
return gfxRGBA(aBorderColors->mColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -490,16 +490,16 @@ nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
|
|||||||
if (mIsThemed)
|
if (mIsThemed)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
PRBool isCanvas;
|
|
||||||
const nsStyleBackground* bg;
|
const nsStyleBackground* bg;
|
||||||
|
PRBool isCanvas; // not used
|
||||||
PRBool hasBG =
|
PRBool hasBG =
|
||||||
nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bg, &isCanvas);
|
nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame,
|
||||||
if (!hasBG || (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) ||
|
&bg, &isCanvas);
|
||||||
bg->mBackgroundClip != NS_STYLE_BG_CLIP_BORDER ||
|
|
||||||
nsLayoutUtils::HasNonZeroSide(mFrame->GetStyleBorder()->mBorderRadius) ||
|
return (hasBG && NS_GET_A(bg->mBackgroundColor) == 255 &&
|
||||||
NS_GET_A(bg->mBackgroundColor) < 255)
|
bg->mBackgroundClip == NS_STYLE_BG_CLIP_BORDER &&
|
||||||
return PR_FALSE;
|
!nsLayoutUtils::HasNonZeroSide(mFrame->GetStyleBorder()->
|
||||||
return PR_TRUE;
|
mBorderRadius));
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
|||||||
@@ -2725,8 +2725,6 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aFrame) {
|
|||||||
const nsStyleBackground* bg;
|
const nsStyleBackground* bg;
|
||||||
if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg, &isCanvas))
|
if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg, &isCanvas))
|
||||||
return eTransparencyTransparent;
|
return eTransparencyTransparent;
|
||||||
if (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)
|
|
||||||
return eTransparencyTransparent;
|
|
||||||
if (NS_GET_A(bg->mBackgroundColor) < 255)
|
if (NS_GET_A(bg->mBackgroundColor) < 255)
|
||||||
return eTransparencyTransparent;
|
return eTransparencyTransparent;
|
||||||
if (bg->mBackgroundClip != NS_STYLE_BG_CLIP_BORDER)
|
if (bg->mBackgroundClip != NS_STYLE_BG_CLIP_BORDER)
|
||||||
|
|||||||
@@ -193,11 +193,10 @@
|
|||||||
#define NS_STYLE_VOLUME_X_LOUD 5
|
#define NS_STYLE_VOLUME_X_LOUD 5
|
||||||
|
|
||||||
// See nsStyleColor
|
// See nsStyleColor
|
||||||
#define NS_STYLE_COLOR_TRANSPARENT 0
|
#define NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR 1
|
||||||
#ifdef GFX_HAS_INVERT
|
#ifdef GFX_HAS_INVERT
|
||||||
#define NS_STYLE_COLOR_INVERT 1
|
#define NS_STYLE_COLOR_INVERT 2
|
||||||
#endif
|
#endif
|
||||||
#define NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR 2
|
|
||||||
|
|
||||||
// See nsStyleColor
|
// See nsStyleColor
|
||||||
#define NS_COLOR_MOZ_HYPERLINKTEXT -1
|
#define NS_COLOR_MOZ_HYPERLINKTEXT -1
|
||||||
@@ -206,7 +205,7 @@
|
|||||||
#define NS_COLOR_CURRENTCOLOR -4
|
#define NS_COLOR_CURRENTCOLOR -4
|
||||||
|
|
||||||
// See nsStyleBackground
|
// See nsStyleBackground
|
||||||
#define NS_STYLE_BG_COLOR_TRANSPARENT 0x01
|
// 0x01 was background-color:transparent
|
||||||
#define NS_STYLE_BG_IMAGE_NONE 0x02
|
#define NS_STYLE_BG_IMAGE_NONE 0x02
|
||||||
#define NS_STYLE_BG_X_POSITION_PERCENT 0x04
|
#define NS_STYLE_BG_X_POSITION_PERCENT 0x04
|
||||||
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
|
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
|
||||||
|
|||||||
@@ -3036,9 +3036,6 @@ nsTextPaintStyle::InitSelectionColors()
|
|||||||
if (sc) {
|
if (sc) {
|
||||||
const nsStyleBackground* bg = sc->GetStyleBackground();
|
const nsStyleBackground* bg = sc->GetStyleBackground();
|
||||||
mSelectionBGColor = bg->mBackgroundColor;
|
mSelectionBGColor = bg->mBackgroundColor;
|
||||||
if (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
|
||||||
mSelectionBGColor = NS_RGBA(0,0,0,0);
|
|
||||||
}
|
|
||||||
mSelectionTextColor = sc->GetStyleColor()->mColor;
|
mSelectionTextColor = sc->GetStyleColor()->mColor;
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2047,7 +2047,7 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
|
|||||||
else if (mRect.width && mRect.height) {
|
else if (mRect.width && mRect.height) {
|
||||||
const nsStyleBackground* backg = styleContext->GetStyleBackground();
|
const nsStyleBackground* backg = styleContext->GetStyleBackground();
|
||||||
if (styleContext != parentContext &&
|
if (styleContext != parentContext &&
|
||||||
0 == (backg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
NS_GET_A(backg->mBackgroundColor) > 0) {
|
||||||
rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
||||||
nsDisplayMathMLCharBackground(aForFrame, mRect, styleContext));
|
nsDisplayMathMLCharBackground(aForFrame, mRect, styleContext));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|||||||
@@ -233,10 +233,20 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
|
|||||||
if (iProp == eCSSProperty_background_color) {
|
if (iProp == eCSSProperty_background_color) {
|
||||||
// Force non-'transparent' background
|
// Force non-'transparent' background
|
||||||
// colors to the user's default.
|
// colors to the user's default.
|
||||||
|
// We have the value in the form it was
|
||||||
|
// specified at this point, so we have to
|
||||||
|
// look for both the keyword 'transparent'
|
||||||
|
// and its equivalent in rgba notation.
|
||||||
nsCSSUnit u = target->GetUnit();
|
nsCSSUnit u = target->GetUnit();
|
||||||
if (u != eCSSUnit_Enumerated &&
|
nsDependentString buf;
|
||||||
u != eCSSUnit_Inherit &&
|
|
||||||
u != eCSSUnit_Initial) {
|
if ((u == eCSSUnit_Color &&
|
||||||
|
NS_GET_A(target->GetColorValue())
|
||||||
|
> 0) ||
|
||||||
|
(u == eCSSUnit_String &&
|
||||||
|
!nsGkAtoms::transparent->
|
||||||
|
Equals(target->GetStringValue(buf))) ||
|
||||||
|
(u == eCSSUnit_EnumColor)) {
|
||||||
target->SetColorValue(aRuleData->
|
target->SetColorValue(aRuleData->
|
||||||
mPresContext->
|
mPresContext->
|
||||||
DefaultBackgroundColor());
|
DefaultBackgroundColor());
|
||||||
|
|||||||
@@ -450,7 +450,6 @@ CSS_KEY(threedshadow, threedshadow)
|
|||||||
CSS_KEY(toggle, toggle)
|
CSS_KEY(toggle, toggle)
|
||||||
CSS_KEY(top, top)
|
CSS_KEY(top, top)
|
||||||
CSS_KEY(top-outside, top_outside)
|
CSS_KEY(top-outside, top_outside)
|
||||||
CSS_KEY(transparent, transparent)
|
|
||||||
CSS_KEY(tri-state, tri_state)
|
CSS_KEY(tri-state, tri_state)
|
||||||
CSS_KEY(ultra-condensed, ultra_condensed)
|
CSS_KEY(ultra-condensed, ultra_condensed)
|
||||||
CSS_KEY(ultra-expanded, ultra_expanded)
|
CSS_KEY(ultra-expanded, ultra_expanded)
|
||||||
|
|||||||
@@ -3423,14 +3423,6 @@ CSSParserImpl::ParseColor(nsCSSValue& aValue)
|
|||||||
nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(tk->mIdent);
|
nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(tk->mIdent);
|
||||||
if (eCSSKeyword_UNKNOWN < keyword) { // known keyword
|
if (eCSSKeyword_UNKNOWN < keyword) { // known keyword
|
||||||
PRInt32 value;
|
PRInt32 value;
|
||||||
// XXX Now that non-cairo is no longer supported, we should remove
|
|
||||||
// the special parsing of transparent for background-color and
|
|
||||||
// border-color. (It currently overrides this, since keywords
|
|
||||||
// are checked earlier in ParseVariant.)
|
|
||||||
if (keyword == eCSSKeyword_transparent) {
|
|
||||||
aValue.SetColorValue(NS_RGBA(0, 0, 0, 0));
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
if (nsCSSProps::FindKeyword(keyword, nsCSSProps::kColorKTable, value)) {
|
if (nsCSSProps::FindKeyword(keyword, nsCSSProps::kColorKTable, value)) {
|
||||||
aValue.SetIntValue(value, eCSSUnit_EnumColor);
|
aValue.SetIntValue(value, eCSSUnit_EnumColor);
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
@@ -5061,8 +5053,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
|
|||||||
return ParseVariant(aValue, VARIANT_HK,
|
return ParseVariant(aValue, VARIANT_HK,
|
||||||
nsCSSProps::kBackgroundClipKTable);
|
nsCSSProps::kBackgroundClipKTable);
|
||||||
case eCSSProperty_background_color:
|
case eCSSProperty_background_color:
|
||||||
return ParseVariant(aValue, VARIANT_HCK,
|
return ParseVariant(aValue, VARIANT_HC, nsnull);
|
||||||
nsCSSProps::kBackgroundColorKTable);
|
|
||||||
case eCSSProperty_background_image:
|
case eCSSProperty_background_image:
|
||||||
return ParseVariant(aValue, VARIANT_HUO, nsnull);
|
return ParseVariant(aValue, VARIANT_HUO, nsnull);
|
||||||
case eCSSProperty__moz_background_inline_policy:
|
case eCSSProperty__moz_background_inline_policy:
|
||||||
@@ -5608,8 +5599,7 @@ CSSParserImpl::ParseBackground()
|
|||||||
|
|
||||||
// Fill in the values that the shorthand will set if we don't find
|
// Fill in the values that the shorthand will set if we don't find
|
||||||
// other values.
|
// other values.
|
||||||
mTempData.mColor.mBackColor.SetIntValue(NS_STYLE_BG_COLOR_TRANSPARENT,
|
mTempData.mColor.mBackColor.SetColorValue(NS_RGBA(0, 0, 0, 0));
|
||||||
eCSSUnit_Enumerated);
|
|
||||||
mTempData.SetPropertyBit(eCSSProperty_background_color);
|
mTempData.SetPropertyBit(eCSSProperty_background_color);
|
||||||
mTempData.mColor.mBackImage.SetNoneValue();
|
mTempData.mColor.mBackImage.SetNoneValue();
|
||||||
mTempData.SetPropertyBit(eCSSProperty_background_image);
|
mTempData.SetPropertyBit(eCSSProperty_background_image);
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ CSS_PROP_BACKENDONLY(azimuth, azimuth, Azimuth, Aural, mAzimuth, eCSSType_Value,
|
|||||||
CSS_PROP_SHORTHAND(background, background, Background)
|
CSS_PROP_SHORTHAND(background, background, Background)
|
||||||
CSS_PROP_BACKGROUND(background-attachment, background_attachment, BackgroundAttachment, Color, mBackAttachment, eCSSType_Value, kBackgroundAttachmentKTable)
|
CSS_PROP_BACKGROUND(background-attachment, background_attachment, BackgroundAttachment, Color, mBackAttachment, eCSSType_Value, kBackgroundAttachmentKTable)
|
||||||
CSS_PROP_BACKGROUND(-moz-background-clip, _moz_background_clip, MozBackgroundClip, Color, mBackClip, eCSSType_Value, kBackgroundClipKTable)
|
CSS_PROP_BACKGROUND(-moz-background-clip, _moz_background_clip, MozBackgroundClip, Color, mBackClip, eCSSType_Value, kBackgroundClipKTable)
|
||||||
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, Color, mBackColor, eCSSType_Value, kBackgroundColorKTable)
|
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, Color, mBackColor, eCSSType_Value, nsnull)
|
||||||
CSS_PROP_BACKGROUND(background-image, background_image, BackgroundImage, Color, mBackImage, eCSSType_Value, nsnull)
|
CSS_PROP_BACKGROUND(background-image, background_image, BackgroundImage, Color, mBackImage, eCSSType_Value, nsnull)
|
||||||
CSS_PROP_BACKGROUND(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, Color, mBackInlinePolicy, eCSSType_Value, kBackgroundInlinePolicyKTable)
|
CSS_PROP_BACKGROUND(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, Color, mBackInlinePolicy, eCSSType_Value, kBackgroundInlinePolicyKTable)
|
||||||
CSS_PROP_BACKGROUND(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, Color, mBackOrigin, eCSSType_Value, kBackgroundOriginKTable)
|
CSS_PROP_BACKGROUND(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, Color, mBackOrigin, eCSSType_Value, kBackgroundOriginKTable)
|
||||||
|
|||||||
@@ -354,11 +354,6 @@ const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = {
|
|||||||
eCSSKeyword_UNKNOWN,-1
|
eCSSKeyword_UNKNOWN,-1
|
||||||
};
|
};
|
||||||
|
|
||||||
const PRInt32 nsCSSProps::kBackgroundColorKTable[] = {
|
|
||||||
eCSSKeyword_transparent, NS_STYLE_BG_COLOR_TRANSPARENT,
|
|
||||||
eCSSKeyword_UNKNOWN,-1
|
|
||||||
};
|
|
||||||
|
|
||||||
const PRInt32 nsCSSProps::kBackgroundClipKTable[] = {
|
const PRInt32 nsCSSProps::kBackgroundClipKTable[] = {
|
||||||
eCSSKeyword_border, NS_STYLE_BG_CLIP_BORDER,
|
eCSSKeyword_border, NS_STYLE_BG_CLIP_BORDER,
|
||||||
eCSSKeyword_padding, NS_STYLE_BG_CLIP_PADDING,
|
eCSSKeyword_padding, NS_STYLE_BG_CLIP_PADDING,
|
||||||
@@ -406,7 +401,6 @@ const PRInt32 nsCSSProps::kBorderCollapseKTable[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const PRInt32 nsCSSProps::kBorderColorKTable[] = {
|
const PRInt32 nsCSSProps::kBorderColorKTable[] = {
|
||||||
eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT,
|
|
||||||
eCSSKeyword__moz_use_text_color, NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR,
|
eCSSKeyword__moz_use_text_color, NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR,
|
||||||
eCSSKeyword_UNKNOWN,-1
|
eCSSKeyword_UNKNOWN,-1
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ public:
|
|||||||
static const PRInt32 kAzimuthKTable[];
|
static const PRInt32 kAzimuthKTable[];
|
||||||
static const PRInt32 kBackgroundAttachmentKTable[];
|
static const PRInt32 kBackgroundAttachmentKTable[];
|
||||||
static const PRInt32 kBackgroundClipKTable[];
|
static const PRInt32 kBackgroundClipKTable[];
|
||||||
static const PRInt32 kBackgroundColorKTable[];
|
|
||||||
static const PRInt32 kBackgroundInlinePolicyKTable[];
|
static const PRInt32 kBackgroundInlinePolicyKTable[];
|
||||||
static const PRInt32 kBackgroundOriginKTable[];
|
static const PRInt32 kBackgroundOriginKTable[];
|
||||||
static const PRInt32 kBackgroundPositionKTable[];
|
static const PRInt32 kBackgroundPositionKTable[];
|
||||||
|
|||||||
@@ -1056,18 +1056,10 @@ nsComputedDOMStyle::GetBackgroundColor(nsIDOMCSSValue** aValue)
|
|||||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
const nsStyleBackground* color = GetStyleBackground();
|
const nsStyleBackground* color = GetStyleBackground();
|
||||||
|
nsresult rv = SetToRGBAColor(val, color->mBackgroundColor);
|
||||||
if (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
if (NS_FAILED(rv)) {
|
||||||
const nsAFlatCString& backgroundColor =
|
delete val;
|
||||||
nsCSSProps::ValueToKeyword(NS_STYLE_BG_COLOR_TRANSPARENT,
|
return rv;
|
||||||
nsCSSProps::kBackgroundColorKTable);
|
|
||||||
val->SetIdent(backgroundColor);
|
|
||||||
} else {
|
|
||||||
nsresult rv = SetToRGBAColor(val, color->mBackgroundColor);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
delete val;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallQueryInterface(val, aValue);
|
return CallQueryInterface(val, aValue);
|
||||||
@@ -3055,15 +3047,11 @@ nsComputedDOMStyle::GetBorderColorsFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
|||||||
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (borderColors->mTransparent) {
|
nsresult rv = SetToRGBAColor(primitive, borderColors->mColor);
|
||||||
primitive->SetIdent(nsGkAtoms::transparent);
|
if (NS_FAILED(rv)) {
|
||||||
} else {
|
delete valueList;
|
||||||
nsresult rv = SetToRGBAColor(primitive, borderColors->mColor);
|
delete primitive;
|
||||||
if (NS_FAILED(rv)) {
|
return rv;
|
||||||
delete valueList;
|
|
||||||
delete primitive;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool success = valueList->AppendCSSValue(primitive);
|
PRBool success = valueList->AppendCSSValue(primitive);
|
||||||
@@ -3125,23 +3113,16 @@ nsComputedDOMStyle::GetBorderColorFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
|||||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
nscolor color;
|
nscolor color;
|
||||||
PRBool transparent;
|
|
||||||
PRBool foreground;
|
PRBool foreground;
|
||||||
GetStyleBorder()->GetBorderColor(aSide, color, transparent, foreground);
|
GetStyleBorder()->GetBorderColor(aSide, color, foreground);
|
||||||
if (transparent) {
|
if (foreground) {
|
||||||
val->SetIdent(nsGkAtoms::transparent);
|
color = GetStyleColor()->mColor;
|
||||||
} else {
|
}
|
||||||
if (foreground) {
|
|
||||||
const nsStyleColor* colorStruct = GetStyleColor();
|
|
||||||
color = colorStruct->mColor;
|
|
||||||
}
|
|
||||||
// XXX else?
|
|
||||||
|
|
||||||
nsresult rv = SetToRGBAColor(val, color);
|
nsresult rv = SetToRGBAColor(val, color);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
delete val;
|
delete val;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallQueryInterface(val, aValue);
|
return CallQueryInterface(val, aValue);
|
||||||
|
|||||||
@@ -187,13 +187,13 @@ ProcessTableRulesAttribute(void* aStyleStruct,
|
|||||||
borderData->SetBorderStyle(aSide, bStyle);
|
borderData->SetBorderStyle(aSide, bStyle);
|
||||||
|
|
||||||
nscolor borderColor;
|
nscolor borderColor;
|
||||||
PRBool transparent, foreground;
|
PRBool foreground;
|
||||||
borderData->GetBorderColor(aSide, borderColor, transparent, foreground);
|
borderData->GetBorderColor(aSide, borderColor, foreground);
|
||||||
if (transparent || foreground) {
|
if (NS_GET_A(borderColor) == 0 || foreground) {
|
||||||
// use the table's border color if it is set, otherwise use black
|
// use the table's border color if it is set, otherwise use black
|
||||||
nscolor tableBorderColor;
|
nscolor tableBorderColor;
|
||||||
tableBorderData->GetBorderColor(aSide, tableBorderColor, transparent, foreground);
|
tableBorderData->GetBorderColor(aSide, tableBorderColor, foreground);
|
||||||
borderColor = (transparent || foreground) ? NS_RGB(0,0,0) : tableBorderColor;
|
borderColor = (NS_GET_A(borderColor) == 0 || foreground) ? NS_RGB(0,0,0) : tableBorderColor;
|
||||||
borderData->SetBorderColor(aSide, borderColor);
|
borderData->SetBorderColor(aSide, borderColor);
|
||||||
}
|
}
|
||||||
// set the border width to be 1 pixel
|
// set the border width to be 1 pixel
|
||||||
|
|||||||
@@ -1719,7 +1719,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
|||||||
}
|
}
|
||||||
case eStyleStruct_Background:
|
case eStyleStruct_Background:
|
||||||
{
|
{
|
||||||
nsStyleBackground* bg = new (mPresContext) nsStyleBackground(mPresContext);
|
nsStyleBackground* bg = new (mPresContext) nsStyleBackground();
|
||||||
if (NS_LIKELY(bg != nsnull)) {
|
if (NS_LIKELY(bg != nsnull)) {
|
||||||
aContext->SetStyle(eStyleStruct_Background, bg);
|
aContext->SetStyle(eStyleStruct_Background, bg);
|
||||||
}
|
}
|
||||||
@@ -3397,28 +3397,22 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
|
|||||||
const nsRuleDataStruct& aData,
|
const nsRuleDataStruct& aData,
|
||||||
nsStyleContext* aContext,
|
nsStyleContext* aContext,
|
||||||
nsRuleNode* aHighestNode,
|
nsRuleNode* aHighestNode,
|
||||||
const RuleDetail aRuleDetail, PRBool aInherited)
|
const RuleDetail aRuleDetail,
|
||||||
|
PRBool aInherited)
|
||||||
{
|
{
|
||||||
COMPUTE_START_RESET(Background, (mPresContext), bg, parentBG,
|
COMPUTE_START_RESET(Background, (), bg, parentBG, Color, colorData)
|
||||||
Color, colorData)
|
|
||||||
|
|
||||||
// save parentFlags in case bg == parentBG and we clobber them later
|
// save parentFlags in case bg == parentBG and we clobber them later
|
||||||
PRUint8 parentFlags = parentBG->mBackgroundFlags;
|
PRUint8 parentFlags = parentBG->mBackgroundFlags;
|
||||||
|
|
||||||
// background-color: color, string, enum (flags), inherit
|
// background-color: color, string, inherit
|
||||||
if (eCSSUnit_Inherit == colorData.mBackColor.GetUnit()) { // do inherit first, so SetColor doesn't do it
|
if (eCSSUnit_Initial == colorData.mBackColor.GetUnit()) {
|
||||||
bg->mBackgroundColor = parentBG->mBackgroundColor;
|
bg->mBackgroundColor = NS_RGBA(0, 0, 0, 0);
|
||||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
} else if (!SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
||||||
bg->mBackgroundFlags |= (parentFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
mPresContext, aContext, bg->mBackgroundColor,
|
||||||
inherited = PR_TRUE;
|
inherited)) {
|
||||||
}
|
NS_ASSERTION(eCSSUnit_Null == colorData.mBackColor.GetUnit(),
|
||||||
else if (SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
"unexpected color unit");
|
||||||
mPresContext, aContext, bg->mBackgroundColor, inherited)) {
|
|
||||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
|
||||||
}
|
|
||||||
else if (eCSSUnit_Enumerated == colorData.mBackColor.GetUnit() ||
|
|
||||||
eCSSUnit_Initial == colorData.mBackColor.GetUnit()) {
|
|
||||||
bg->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// background-image: url (stored as image), none, inherit
|
// background-image: url (stored as image), none, inherit
|
||||||
@@ -3708,11 +3702,9 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
|||||||
border->EnsureBorderColors();
|
border->EnsureBorderColors();
|
||||||
border->ClearBorderColors(side);
|
border->ClearBorderColors(side);
|
||||||
while (list) {
|
while (list) {
|
||||||
if (SetColor(list->mValue, unused, mPresContext, aContext, borderColor, inherited))
|
if (SetColor(list->mValue, unused, mPresContext,
|
||||||
border->AppendBorderColor(side, borderColor, PR_FALSE);
|
aContext, borderColor, inherited))
|
||||||
else if (eCSSUnit_Enumerated == list->mValue.GetUnit() &&
|
border->AppendBorderColor(side, borderColor);
|
||||||
NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue())
|
|
||||||
border->AppendBorderColor(side, nsnull, PR_TRUE);
|
|
||||||
list = list->mNext;
|
list = list->mNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3721,7 +3713,6 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
|||||||
|
|
||||||
// border-color, border-*-color: color, string, enum, inherit
|
// border-color, border-*-color: color, string, enum, inherit
|
||||||
nsCSSRect ourBorderColor(marginData.mBorderColor);
|
nsCSSRect ourBorderColor(marginData.mBorderColor);
|
||||||
PRBool transparent;
|
|
||||||
PRBool foreground;
|
PRBool foreground;
|
||||||
AdjustLogicalBoxProp(aContext,
|
AdjustLogicalBoxProp(aContext,
|
||||||
marginData.mBorderLeftColorLTRSource,
|
marginData.mBorderLeftColorLTRSource,
|
||||||
@@ -3739,11 +3730,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
|||||||
if (eCSSUnit_Inherit == value.GetUnit()) {
|
if (eCSSUnit_Inherit == value.GetUnit()) {
|
||||||
if (parentContext) {
|
if (parentContext) {
|
||||||
inherited = PR_TRUE;
|
inherited = PR_TRUE;
|
||||||
parentBorder->GetBorderColor(side, borderColor,
|
parentBorder->GetBorderColor(side, borderColor, foreground);
|
||||||
transparent, foreground);
|
if (foreground) {
|
||||||
if (transparent)
|
|
||||||
border->SetBorderTransparent(side);
|
|
||||||
else if (foreground) {
|
|
||||||
// We want to inherit the color from the parent, not use the
|
// We want to inherit the color from the parent, not use the
|
||||||
// color on the element where this chunk of style data will be
|
// color on the element where this chunk of style data will be
|
||||||
// used. We can ensure that the data for the parent are fully
|
// used. We can ensure that the data for the parent are fully
|
||||||
@@ -3762,9 +3750,6 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
|||||||
}
|
}
|
||||||
else if (eCSSUnit_Enumerated == value.GetUnit()) {
|
else if (eCSSUnit_Enumerated == value.GetUnit()) {
|
||||||
switch (value.GetIntValue()) {
|
switch (value.GetIntValue()) {
|
||||||
case NS_STYLE_COLOR_TRANSPARENT:
|
|
||||||
border->SetBorderTransparent(side);
|
|
||||||
break;
|
|
||||||
case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR:
|
case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR:
|
||||||
border->SetBorderToForeground(side);
|
border->SetBorderToForeground(side);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -468,11 +468,9 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
|
|||||||
// aOther.mBorderColors
|
// aOther.mBorderColors
|
||||||
if (mBorderColors) {
|
if (mBorderColors) {
|
||||||
NS_FOR_CSS_SIDES(ix) {
|
NS_FOR_CSS_SIDES(ix) {
|
||||||
if (!mBorderColors[ix] != !aOther.mBorderColors[ix]) {
|
if (!nsBorderColors::Equal(mBorderColors[ix],
|
||||||
|
aOther.mBorderColors[ix])) {
|
||||||
return NS_STYLE_HINT_VISUAL;
|
return NS_STYLE_HINT_VISUAL;
|
||||||
} else if (mBorderColors[ix] && aOther.mBorderColors[ix]) {
|
|
||||||
if (!mBorderColors[ix]->Equals(aOther.mBorderColors[ix]))
|
|
||||||
return NS_STYLE_HINT_VISUAL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1154,15 +1152,15 @@ nsChangeHint nsStyleColor::MaxDifference()
|
|||||||
// nsStyleBackground
|
// nsStyleBackground
|
||||||
//
|
//
|
||||||
|
|
||||||
nsStyleBackground::nsStyleBackground(nsPresContext* aPresContext)
|
nsStyleBackground::nsStyleBackground()
|
||||||
: mBackgroundFlags(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE),
|
: mBackgroundFlags(NS_STYLE_BG_IMAGE_NONE),
|
||||||
mBackgroundAttachment(NS_STYLE_BG_ATTACHMENT_SCROLL),
|
mBackgroundAttachment(NS_STYLE_BG_ATTACHMENT_SCROLL),
|
||||||
mBackgroundClip(NS_STYLE_BG_CLIP_BORDER),
|
mBackgroundClip(NS_STYLE_BG_CLIP_BORDER),
|
||||||
mBackgroundInlinePolicy(NS_STYLE_BG_INLINE_POLICY_CONTINUOUS),
|
mBackgroundInlinePolicy(NS_STYLE_BG_INLINE_POLICY_CONTINUOUS),
|
||||||
mBackgroundOrigin(NS_STYLE_BG_ORIGIN_PADDING),
|
mBackgroundOrigin(NS_STYLE_BG_ORIGIN_PADDING),
|
||||||
mBackgroundRepeat(NS_STYLE_BG_REPEAT_XY)
|
mBackgroundRepeat(NS_STYLE_BG_REPEAT_XY),
|
||||||
|
mBackgroundColor(NS_RGBA(0, 0, 0, 0))
|
||||||
{
|
{
|
||||||
mBackgroundColor = aPresContext->DefaultBackgroundColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
|
nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ struct nsStyleColor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct nsStyleBackground {
|
struct nsStyleBackground {
|
||||||
nsStyleBackground(nsPresContext* aPresContext);
|
nsStyleBackground();
|
||||||
nsStyleBackground(const nsStyleBackground& aOther);
|
nsStyleBackground(const nsStyleBackground& aOther);
|
||||||
~nsStyleBackground();
|
~nsStyleBackground();
|
||||||
|
|
||||||
@@ -179,11 +179,11 @@ struct nsStyleBackground {
|
|||||||
nscolor mBackgroundColor; // [reset]
|
nscolor mBackgroundColor; // [reset]
|
||||||
nsCOMPtr<imgIRequest> mBackgroundImage; // [reset]
|
nsCOMPtr<imgIRequest> mBackgroundImage; // [reset]
|
||||||
|
|
||||||
|
// True if this background is completely transparent.
|
||||||
PRBool IsTransparent() const
|
PRBool IsTransparent() const
|
||||||
{
|
{
|
||||||
return (mBackgroundFlags &
|
return (NS_GET_A(mBackgroundColor) == 0 &&
|
||||||
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE)) ==
|
(mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE));
|
||||||
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to take slower codepaths for fixed background attachment,
|
// We have to take slower codepaths for fixed background attachment,
|
||||||
@@ -193,11 +193,10 @@ struct nsStyleBackground {
|
|||||||
PRBool HasFixedBackground() const;
|
PRBool HasFixedBackground() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BORDER_COLOR_TRANSPARENT 0x40
|
|
||||||
#define BORDER_COLOR_FOREGROUND 0x20
|
#define BORDER_COLOR_FOREGROUND 0x20
|
||||||
#define OUTLINE_COLOR_INITIAL 0x80
|
#define OUTLINE_COLOR_INITIAL 0x80
|
||||||
// TRANSPARENT | FOREGROUND | INITIAL(OUTLINE)
|
// FOREGROUND | INITIAL(OUTLINE)
|
||||||
#define BORDER_COLOR_SPECIAL 0xE0
|
#define BORDER_COLOR_SPECIAL 0xA0
|
||||||
#define BORDER_STYLE_MASK 0x1F
|
#define BORDER_STYLE_MASK 0x1F
|
||||||
|
|
||||||
#define NS_SPACING_MARGIN 0
|
#define NS_SPACING_MARGIN 0
|
||||||
@@ -269,20 +268,18 @@ protected:
|
|||||||
struct nsBorderColors {
|
struct nsBorderColors {
|
||||||
nsBorderColors* mNext;
|
nsBorderColors* mNext;
|
||||||
nscolor mColor;
|
nscolor mColor;
|
||||||
PRBool mTransparent;
|
|
||||||
|
|
||||||
nsBorderColors* CopyColors() {
|
nsBorderColors* CopyColors() {
|
||||||
nsBorderColors* next = nsnull;
|
nsBorderColors* next = nsnull;
|
||||||
if (mNext)
|
if (mNext)
|
||||||
next = mNext->CopyColors();
|
next = mNext->CopyColors();
|
||||||
return new nsBorderColors(mColor, mTransparent, next);
|
return new nsBorderColors(mColor, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsBorderColors() :mNext(nsnull) { mColor = NS_RGB(0,0,0); }
|
nsBorderColors() :mNext(nsnull) { mColor = NS_RGB(0,0,0); }
|
||||||
|
|
||||||
nsBorderColors(const nscolor& aColor, PRBool aTransparent, nsBorderColors* aNext=nsnull) {
|
nsBorderColors(const nscolor& aColor, nsBorderColors* aNext=nsnull) {
|
||||||
mColor = aColor;
|
mColor = aColor;
|
||||||
mTransparent = aTransparent;
|
|
||||||
mNext = aNext;
|
mNext = aNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,16 +287,18 @@ struct nsBorderColors {
|
|||||||
delete mNext;
|
delete mNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool Equals(nsBorderColors* aOther) {
|
static PRBool Equal(const nsBorderColors* c1,
|
||||||
nsBorderColors* c1 = this;
|
const nsBorderColors* c2) {
|
||||||
nsBorderColors* c2 = aOther;
|
if (c1 == c2)
|
||||||
|
return PR_TRUE;
|
||||||
while (c1 && c2) {
|
while (c1 && c2) {
|
||||||
if (c1->mColor != c2->mColor ||
|
if (c1->mColor != c2->mColor)
|
||||||
c1->mTransparent != c2->mTransparent)
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
c1 = c1->mNext;
|
c1 = c1->mNext;
|
||||||
c2 = c2->mNext;
|
c2 = c2->mNext;
|
||||||
}
|
}
|
||||||
|
// both should be NULL if these are equal, otherwise one
|
||||||
|
// has more colors than another
|
||||||
return !c1 && !c2;
|
return !c1 && !c2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -510,16 +509,16 @@ struct nsStyleBorder {
|
|||||||
inline PRBool IsBorderImageLoaded() const;
|
inline PRBool IsBorderImageLoaded() const;
|
||||||
|
|
||||||
void GetBorderColor(PRUint8 aSide, nscolor& aColor,
|
void GetBorderColor(PRUint8 aSide, nscolor& aColor,
|
||||||
PRBool& aTransparent, PRBool& aForeground) const
|
PRBool& aForeground) const
|
||||||
{
|
{
|
||||||
aTransparent = aForeground = PR_FALSE;
|
aForeground = PR_FALSE;
|
||||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||||
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0)
|
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0)
|
||||||
aColor = mBorderColor[aSide];
|
aColor = mBorderColor[aSide];
|
||||||
else if (mBorderStyle[aSide] & BORDER_COLOR_FOREGROUND)
|
else if (mBorderStyle[aSide] & BORDER_COLOR_FOREGROUND)
|
||||||
aForeground = PR_TRUE;
|
aForeground = PR_TRUE;
|
||||||
else
|
else
|
||||||
aTransparent = PR_TRUE;
|
NS_NOTREACHED("OUTLINE_COLOR_INITIAL should not be set here");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBorderColor(PRUint8 aSide, nscolor aColor)
|
void SetBorderColor(PRUint8 aSide, nscolor aColor)
|
||||||
@@ -541,10 +540,10 @@ struct nsStyleBorder {
|
|||||||
*aColors = mBorderColors[aIndex];
|
*aColors = mBorderColors[aIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppendBorderColor(PRInt32 aIndex, nscolor aColor, PRBool aTransparent)
|
void AppendBorderColor(PRInt32 aIndex, nscolor aColor)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aIndex >= 0 && aIndex <= 3, "bad side for composite border color");
|
NS_ASSERTION(aIndex >= 0 && aIndex <= 3, "bad side for composite border color");
|
||||||
nsBorderColors* colorEntry = new nsBorderColors(aColor, aTransparent);
|
nsBorderColors* colorEntry = new nsBorderColors(aColor);
|
||||||
if (!mBorderColors[aIndex])
|
if (!mBorderColors[aIndex])
|
||||||
mBorderColors[aIndex] = colorEntry;
|
mBorderColors[aIndex] = colorEntry;
|
||||||
else {
|
else {
|
||||||
@@ -556,13 +555,6 @@ struct nsStyleBorder {
|
|||||||
mBorderStyle[aIndex] &= ~BORDER_COLOR_SPECIAL;
|
mBorderStyle[aIndex] &= ~BORDER_COLOR_SPECIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBorderTransparent(PRUint8 aSide)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
|
||||||
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
|
|
||||||
mBorderStyle[aSide] |= BORDER_COLOR_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetBorderToForeground(PRUint8 aSide)
|
void SetBorderToForeground(PRUint8 aSide)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ STYLE_STRUCT_INHERITED(Color, CheckColorCallback, (SSARG_PRESCONTEXT))
|
|||||||
STYLE_STRUCT_TEST_CODE( })
|
STYLE_STRUCT_TEST_CODE( })
|
||||||
STYLE_STRUCT_TEST_CODE( } else {)
|
STYLE_STRUCT_TEST_CODE( } else {)
|
||||||
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 2) {)
|
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 2) {)
|
||||||
STYLE_STRUCT_RESET(Background, nsnull, (SSARG_PRESCONTEXT))
|
STYLE_STRUCT_RESET(Background, nsnull, ())
|
||||||
STYLE_STRUCT_TEST_CODE( } else {)
|
STYLE_STRUCT_TEST_CODE( } else {)
|
||||||
STYLE_STRUCT_INHERITED(List, nsnull, ())
|
STYLE_STRUCT_INHERITED(List, nsnull, ())
|
||||||
STYLE_STRUCT_TEST_CODE( })
|
STYLE_STRUCT_TEST_CODE( })
|
||||||
|
|||||||
@@ -4575,12 +4575,9 @@ GetColorAndStyle(const nsIFrame* aFrame,
|
|||||||
(NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {
|
(NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PRBool transparent, foreground;
|
PRBool foreground;
|
||||||
styleData->GetBorderColor(aSide, aColor, transparent, foreground);
|
styleData->GetBorderColor(aSide, aColor, foreground);
|
||||||
if (transparent) {
|
if (foreground) {
|
||||||
aColor = 0;
|
|
||||||
}
|
|
||||||
else if (foreground) {
|
|
||||||
aColor = aFrame->GetStyleColor()->mColor;
|
aColor = aFrame->GetStyleColor()->mColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3199,14 +3199,11 @@ nsTreeBodyFrame::PaintCell(PRInt32 aRowIndex,
|
|||||||
|
|
||||||
const nsStyleBorder* borderStyle = lineContext->GetStyleBorder();
|
const nsStyleBorder* borderStyle = lineContext->GetStyleBorder();
|
||||||
nscolor color;
|
nscolor color;
|
||||||
PRBool transparent, foreground;
|
PRBool foreground;
|
||||||
borderStyle->GetBorderColor(NS_SIDE_LEFT, color, transparent, foreground);
|
borderStyle->GetBorderColor(NS_SIDE_LEFT, color, foreground);
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
// GetBorderColor didn't touch color, thus grab it from the treeline context
|
// GetBorderColor didn't touch color, thus grab it from the treeline context
|
||||||
color = lineContext->GetStyleColor()->mColor;
|
color = lineContext->GetStyleColor()->mColor;
|
||||||
} else if (transparent) {
|
|
||||||
// GetBorderColor didn't touch color, thus set it to transparent
|
|
||||||
color = NS_RGBA(0, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
aRenderingContext.SetColor(color);
|
aRenderingContext.SetColor(color);
|
||||||
PRUint8 style;
|
PRUint8 style;
|
||||||
|
|||||||
Reference in New Issue
Block a user