mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Remove support for fallback background colors. (Bug 496721) r+sr=bzbarsky
This commit is contained in:
parent
98b2b4a981
commit
44a6267b1d
@ -531,8 +531,8 @@ nsBGColorTextAttr::GetColor(nsIFrame *aFrame, nscolor *aColor)
|
||||
{
|
||||
const nsStyleBackground *styleBackground = aFrame->GetStyleBackground();
|
||||
|
||||
if (NS_GET_A(styleBackground->mFallbackBackgroundColor) > 0) {
|
||||
*aColor = styleBackground->mFallbackBackgroundColor;
|
||||
if (NS_GET_A(styleBackground->mBackgroundColor) > 0) {
|
||||
*aColor = styleBackground->mBackgroundColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1949,16 +1949,12 @@ nsGenericHTMLElement::MapBGColorInto(const nsMappedAttributes* aAttributes,
|
||||
if (!(aData->mSIDs & NS_STYLE_INHERIT_BIT(Background)))
|
||||
return;
|
||||
|
||||
if (aData->mColorData->mBackColor.mXValue.GetUnit() == eCSSUnit_Null &&
|
||||
if (aData->mColorData->mBackColor.GetUnit() == eCSSUnit_Null &&
|
||||
aData->mPresContext->UseDocumentColors()) {
|
||||
NS_ASSERTION(aData->mColorData->mBackColor.mYValue.GetUnit() ==
|
||||
eCSSUnit_Null,
|
||||
"half a property?");
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bgcolor);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->mColorData->mBackColor.mXValue.SetColorValue(color);
|
||||
aData->mColorData->mBackColor.mYValue.SetColorValue(color);
|
||||
aData->mColorData->mBackColor.SetColorValue(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -377,15 +377,10 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
if (!value) {
|
||||
value = aAttributes->GetAttr(nsGkAtoms::background);
|
||||
}
|
||||
if (value &&
|
||||
aData->mColorData->mBackColor.mXValue.GetUnit() == eCSSUnit_Null) {
|
||||
NS_ASSERTION(aData->mColorData->mBackColor.mYValue.GetUnit()
|
||||
== eCSSUnit_Null,
|
||||
"half a property?");
|
||||
if (value && aData->mColorData->mBackColor.GetUnit() == eCSSUnit_Null) {
|
||||
nscolor color;
|
||||
if (value->GetColorValue(color)) {
|
||||
aData->mColorData->mBackColor.mXValue.SetColorValue(color);
|
||||
aData->mColorData->mBackColor.mYValue.SetColorValue(color);
|
||||
aData->mColorData->mBackColor.SetColorValue(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1536,16 +1536,9 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
drawBackgroundColor = aPresContext->GetBackgroundColorDraw();
|
||||
}
|
||||
|
||||
nsStyleBackground::Image bottomImage(aColor.BottomLayer().mImage);
|
||||
PRBool useFallbackColor = PR_FALSE;
|
||||
if (bottomImage.mSpecified) {
|
||||
if (!drawBackgroundImage ||
|
||||
!UseImageRequestForBackground(bottomImage.mRequest)) {
|
||||
bottomImage.mRequest = nsnull;
|
||||
}
|
||||
useFallbackColor = bottomImage.mRequest == nsnull;
|
||||
} else {
|
||||
NS_ASSERTION(bottomImage.mRequest == nsnull, "malformed image struct");
|
||||
imgIRequest *bottomImage = aColor.BottomLayer().mImage;
|
||||
if (!drawBackgroundImage || !UseImageRequestForBackground(bottomImage)) {
|
||||
bottomImage = nsnull;
|
||||
}
|
||||
|
||||
// If GetBackgroundColorDraw() is false, we are still expected to
|
||||
@ -1554,8 +1547,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
// color was specified.
|
||||
nscolor bgColor;
|
||||
if (drawBackgroundColor) {
|
||||
bgColor = useFallbackColor ? aColor.mFallbackBackgroundColor
|
||||
: aColor.mBackgroundColor;
|
||||
bgColor = aColor.mBackgroundColor;
|
||||
if (NS_GET_A(bgColor) == 0)
|
||||
drawBackgroundColor = PR_FALSE;
|
||||
} else {
|
||||
@ -1643,11 +1635,11 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
// association of the style data with the frame.
|
||||
aPresContext->SetupBackgroundImageLoaders(aForFrame, &aColor);
|
||||
|
||||
if (bottomImage.mRequest &&
|
||||
if (bottomImage &&
|
||||
aColor.BottomLayer().mRepeat == NS_STYLE_BG_REPEAT_XY &&
|
||||
drawBackgroundColor) {
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
bottomImage.mRequest->GetImage(getter_AddRefs(image));
|
||||
bottomImage->GetImage(getter_AddRefs(image));
|
||||
// If the image is completely opaque, we may not need to paint
|
||||
// the background color.
|
||||
nsCOMPtr<gfxIImageFrame> gfxImgFrame;
|
||||
@ -1717,7 +1709,7 @@ PaintBackgroundLayer(nsPresContext* aPresContext,
|
||||
PRBool aUsePrintSettings)
|
||||
{
|
||||
// Lookup the image
|
||||
imgIRequest *req = aLayer.mImage.mRequest;
|
||||
imgIRequest *req = aLayer.mImage;
|
||||
if (!UseImageRequestForBackground(req)) {
|
||||
// There's no image or it's not ready to be painted.
|
||||
return;
|
||||
|
@ -550,9 +550,9 @@ nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
|
||||
return PR_TRUE;
|
||||
|
||||
if (bottomLayer.mRepeat == NS_STYLE_BG_REPEAT_XY) {
|
||||
if (bottomLayer.mImage.mRequest) {
|
||||
if (bottomLayer.mImage) {
|
||||
nsCOMPtr<imgIContainer> container;
|
||||
bottomLayer.mImage.mRequest->GetImage(getter_AddRefs(container));
|
||||
bottomLayer.mImage->GetImage(getter_AddRefs(container));
|
||||
if (container) {
|
||||
PRUint32 nframes;
|
||||
container->GetNumFrames(&nframes);
|
||||
@ -585,7 +585,7 @@ nsDisplayBackground::IsUniform(nsDisplayListBuilder* aBuilder) {
|
||||
nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bg);
|
||||
if (!hasBG)
|
||||
return PR_TRUE;
|
||||
if (!bg->BottomLayer().mImage.mRequest &&
|
||||
if (!bg->BottomLayer().mImage &&
|
||||
bg->mImageCount == 1 &&
|
||||
!nsLayoutUtils::HasNonZeroCorner(mFrame->GetStyleBorder()->mBorderRadius) &&
|
||||
bg->BottomLayer().mClip == NS_STYLE_BG_CLIP_BORDER)
|
||||
|
@ -3141,7 +3141,6 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aFrame) {
|
||||
if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg))
|
||||
return eTransparencyTransparent;
|
||||
if (NS_GET_A(bg->mBackgroundColor) < 255 ||
|
||||
NS_GET_A(bg->mFallbackBackgroundColor) < 255 ||
|
||||
// bottom layer's clip is used for the color
|
||||
bg->BottomLayer().mClip != NS_STYLE_BG_CLIP_BORDER)
|
||||
return eTransparencyTransparent;
|
||||
|
@ -1265,7 +1265,7 @@ nsPresContext::SetupBackgroundImageLoaders(nsIFrame* aFrame,
|
||||
{
|
||||
nsRefPtr<nsImageLoader> loaders;
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, aStyleBackground) {
|
||||
imgIRequest *image = aStyleBackground->mLayers[i].mImage.mRequest;
|
||||
imgIRequest *image = aStyleBackground->mLayers[i].mImage;
|
||||
loaders = nsImageLoader::Create(aFrame, image, PR_FALSE, loaders);
|
||||
}
|
||||
SetImageLoaders(aFrame, BACKGROUND_IMAGE, loaders);
|
||||
|
@ -533,9 +533,9 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
const nsStyleBackground *oldBG = aOldStyleContext->GetStyleBackground();
|
||||
const nsStyleBackground *newBG = GetStyleBackground();
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, oldBG) {
|
||||
imgIRequest *oldImage = oldBG->mLayers[i].mImage.mRequest;
|
||||
imgIRequest *oldImage = oldBG->mLayers[i].mImage;
|
||||
imgIRequest *newImage = i < newBG->mImageCount
|
||||
? newBG->mLayers[i].mImage.mRequest.get()
|
||||
? newBG->mLayers[i].mImage.get()
|
||||
: nsnull;
|
||||
if (oldImage && !EqualImages(oldImage, newImage)) {
|
||||
// stop the image loading for the frame, the image has changed
|
||||
@ -4062,7 +4062,7 @@ nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
|
||||
const nsStyleBackground *bg = GetStyleBackground();
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
||||
const nsStyleBackground::Layer &layer = bg->mLayers[i];
|
||||
if (layer.mImage.mRequest &&
|
||||
if (layer.mImage &&
|
||||
(layer.mPosition.mXIsPercent || layer.mPosition.mYIsPercent)) {
|
||||
Invalidate(nsRect(0, 0, aOldRect.width, aOldRect.height));
|
||||
return;
|
||||
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color only applied when there is an image." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: lime red;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color only applied when there is an image." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: lime red;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color not applied when background image loads successfully." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(transparent-32x32.png) lime red;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color applied when background image corrupted." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(malformed.png) red lime;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color applied when background image missing." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(404.png) red lime;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color is based on whether the *bottom-most* image is corrupted." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(transparent-32x32.png), url(malformed.png) red lime;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color is based on whether the *bottom-most* image is corrupted." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(malformed.png), url(transparent-32x32.png) lime red;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color is based on whether the *bottom-most* image is missing." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(transparent-32x32.png), url(404.png) red lime;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="Fallback color is based on whether the *bottom-most* image is missing." />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(404.png), url(transparent-32x32.png) lime red;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>css3-background: fallback colors</title>
|
||||
<link rel="author" title="L. David Baron" href="http://dbaron.org/" />
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/csswg/css3-background/#background-color" />
|
||||
<meta name="flags" content="" />
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: url(lime-32x32.png);
|
||||
}
|
||||
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,13 +1,3 @@
|
||||
== fallback-color-1.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-2.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-3.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-4.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-5.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-6.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-7.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-8.xhtml fallback-color-ref.xhtml
|
||||
== fallback-color-9.xhtml fallback-color-ref.xhtml
|
||||
!= fallback-color-ref.xhtml about:blank
|
||||
== layers-stacking-order.xhtml layers-stacking-order-ref.xhtml
|
||||
== layers-layer-count-cascade-1.xhtml layers-layer-count-1-ref.xhtml
|
||||
== layers-layer-count-inheritance-1.xhtml layers-layer-count-1-ref.xhtml
|
||||
|
@ -98,7 +98,7 @@
|
||||
.parser { height: 3em; }
|
||||
.parser { width: 200; }
|
||||
.parser { border: 5em solid red ! error; }
|
||||
.parser { background: red pink pink; }
|
||||
.parser { background: red pink; }
|
||||
|
||||
/* line fourteen (last line of face): table */
|
||||
ul { display: table; padding: 0; margin: -1em 7em 0; background: red; }
|
||||
|
@ -216,6 +216,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
|
||||
aRuleData->mFontData->mFamilyFromHTML = PR_FALSE;
|
||||
}
|
||||
else if (iProp == eCSSProperty_color ||
|
||||
iProp == eCSSProperty_background_color ||
|
||||
iProp == eCSSProperty_border_top_color ||
|
||||
iProp == eCSSProperty_border_right_color_value ||
|
||||
iProp == eCSSProperty_border_right_color_ltr_source ||
|
||||
@ -227,8 +228,31 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
|
||||
iProp == eCSSProperty__moz_column_rule_color ||
|
||||
iProp == eCSSProperty_outline_color) {
|
||||
if (ShouldIgnoreColors(aRuleData)) {
|
||||
// Ignore 'color', 'border-*-color', etc.
|
||||
*target = nsCSSValue();
|
||||
if (iProp == eCSSProperty_background_color) {
|
||||
// Force non-'transparent' background
|
||||
// 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();
|
||||
nsDependentString buf;
|
||||
|
||||
if ((u == eCSSUnit_Color &&
|
||||
NS_GET_A(target->GetColorValue())
|
||||
> 0) ||
|
||||
(u == eCSSUnit_Ident &&
|
||||
!nsGkAtoms::transparent->
|
||||
Equals(target->GetStringValue(buf))) ||
|
||||
(u == eCSSUnit_EnumColor)) {
|
||||
target->SetColorValue(aRuleData->
|
||||
mPresContext->
|
||||
DefaultBackgroundColor());
|
||||
}
|
||||
} else {
|
||||
// Ignore 'color', 'border-*-color', etc.
|
||||
*target = nsCSSValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,37 +285,6 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
|
||||
if (target->mXValue.GetUnit() == eCSSUnit_Null) {
|
||||
target->mXValue = val->mXValue;
|
||||
target->mYValue = val->mYValue;
|
||||
if (iProp == eCSSProperty_background_color &&
|
||||
ShouldIgnoreColors(aRuleData)) {
|
||||
// Force non-'transparent' background 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.
|
||||
nsCSSValue &colorVal = target->mXValue;
|
||||
nsCSSUnit u = colorVal.GetUnit();
|
||||
nsDependentString buf;
|
||||
|
||||
if ((u == eCSSUnit_Color &&
|
||||
NS_GET_A(colorVal.GetColorValue())
|
||||
> 0) ||
|
||||
(u == eCSSUnit_Ident &&
|
||||
!nsGkAtoms::transparent->
|
||||
Equals(colorVal.GetStringValue(buf))) ||
|
||||
(u == eCSSUnit_EnumColor)) {
|
||||
colorVal.SetColorValue(aRuleData->
|
||||
mPresContext->
|
||||
DefaultBackgroundColor());
|
||||
}
|
||||
// We could consider using the fallback
|
||||
// background color for both values, but it
|
||||
// might not make sense if the author didn't
|
||||
// specify an image. But since we're
|
||||
// dropping author images, we'll just use
|
||||
// the non-fallback for both.
|
||||
target->mYValue = target->mXValue;
|
||||
}
|
||||
}
|
||||
cursor += CDBValuePairStorage_advance;
|
||||
} break;
|
||||
|
@ -413,7 +413,6 @@ protected:
|
||||
PRBool ParseBackgroundItem(BackgroundItem& aItem, PRBool aFirstItem);
|
||||
|
||||
PRBool ParseBackgroundList(nsCSSProperty aPropID); // a single value prop-id
|
||||
PRBool ParseBackgroundColor(PRBool aInShorthand);
|
||||
PRBool ParseBackgroundPosition();
|
||||
PRBool ParseBoxPositionValues(nsCSSValuePair& aOut);
|
||||
PRBool ParseBorderColor();
|
||||
@ -5013,8 +5012,6 @@ CSSParserImpl::ParseProperty(nsCSSProperty aPropID)
|
||||
switch (aPropID) { // handle shorthand or multiple properties
|
||||
case eCSSProperty_background:
|
||||
return ParseBackground();
|
||||
case eCSSProperty_background_color:
|
||||
return ParseBackgroundColor(PR_FALSE);
|
||||
case eCSSProperty_background_position:
|
||||
return ParseBackgroundPosition();
|
||||
case eCSSProperty_background_attachment:
|
||||
@ -5274,7 +5271,6 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
|
||||
switch (aPropID) {
|
||||
case eCSSProperty_UNKNOWN:
|
||||
case eCSSProperty_background:
|
||||
case eCSSProperty_background_color:
|
||||
case eCSSProperty_background_position:
|
||||
case eCSSProperty_border:
|
||||
case eCSSProperty_border_color:
|
||||
@ -5394,6 +5390,8 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
|
||||
// Used only internally.
|
||||
return ParseVariant(aValue, VARIANT_HK,
|
||||
nsCSSProps::kBackgroundClipKTable);
|
||||
case eCSSProperty_background_color:
|
||||
return ParseVariant(aValue, VARIANT_HC, nsnull);
|
||||
case eCSSProperty_background_image:
|
||||
// Used only internally.
|
||||
return ParseVariant(aValue, VARIANT_HUO, nsnull);
|
||||
@ -5943,8 +5941,7 @@ CSSParserImpl::ParseBackground()
|
||||
|
||||
// These two are set through side-effects of ParseBackgroundItem.
|
||||
mTempData.SetPropertyBit(eCSSProperty_background_color);
|
||||
mTempData.mColor.mBackColor.mXValue.SetColorValue(NS_RGBA(0, 0, 0, 0));
|
||||
mTempData.mColor.mBackColor.mYValue.SetColorValue(NS_RGBA(0, 0, 0, 0));
|
||||
mTempData.mColor.mBackColor.SetColorValue(NS_RGBA(0, 0, 0, 0));
|
||||
|
||||
BackgroundItem bgitem;
|
||||
nsCSSValuePairList *positionHead = nsnull, **positionTail = &positionHead;
|
||||
@ -6068,7 +6065,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundItem& aItem,
|
||||
} else {
|
||||
val.SetInitialValue();
|
||||
}
|
||||
mTempData.mColor.mBackColor.SetBothValuesTo(val);
|
||||
mTempData.mColor.mBackColor = val;
|
||||
aItem.mImage = val;
|
||||
aItem.mRepeat = val;
|
||||
aItem.mAttachment = val;
|
||||
@ -6152,7 +6149,8 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundItem& aItem,
|
||||
if (haveColor)
|
||||
return PR_FALSE;
|
||||
haveColor = PR_TRUE;
|
||||
if (!ParseBackgroundColor(PR_TRUE)) {
|
||||
if (!ParseSingleValueProperty(mTempData.mColor.mBackColor,
|
||||
eCSSProperty_background_color)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aItem.mLastItem = PR_TRUE;
|
||||
@ -6177,9 +6175,10 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundItem& aItem,
|
||||
if (haveColor)
|
||||
return PR_FALSE;
|
||||
haveColor = PR_TRUE;
|
||||
// Note: ParseBackgroundColor parses 'inherit' and 'initial', but
|
||||
// Note: This parses 'inherit' and 'initial', but
|
||||
// we've already checked for them, so it's ok.
|
||||
if (!ParseBackgroundColor(PR_TRUE)) {
|
||||
if (!ParseSingleValueProperty(mTempData.mColor.mBackColor,
|
||||
eCSSProperty_background_color)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aItem.mLastItem = PR_TRUE;
|
||||
@ -6231,32 +6230,6 @@ CSSParserImpl::ParseBackgroundList(nsCSSProperty aPropID)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
CSSParserImpl::ParseBackgroundColor(PRBool aInShorthand)
|
||||
{
|
||||
nsCSSValuePair &backColor = mTempData.mColor.mBackColor;
|
||||
mTempData.SetPropertyBit(eCSSProperty_background_color);
|
||||
if (!ParseVariant(backColor.mXValue,
|
||||
aInShorthand ? VARIANT_COLOR : VARIANT_HC, nsnull)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
backColor.mYValue = backColor.mXValue;
|
||||
switch (backColor.mXValue.GetUnit()) {
|
||||
case eCSSUnit_Inherit:
|
||||
case eCSSUnit_Initial:
|
||||
NS_ASSERTION(!aInShorthand,
|
||||
"should not get inherit or initial in shorthand");
|
||||
return ExpectEndProperty(); // we're done
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Ignore success, since the value is optional.
|
||||
ParseVariant(backColor.mYValue, VARIANT_COLOR, nsnull);
|
||||
|
||||
return aInShorthand || ExpectEndProperty();
|
||||
}
|
||||
|
||||
// This function is very similar to ParseBackgroundList.
|
||||
PRBool
|
||||
CSSParserImpl::ParseBackgroundPosition()
|
||||
|
@ -292,7 +292,7 @@ CSS_PROP_BACKENDONLY(azimuth, azimuth, Azimuth, 0, Aural, mAzimuth, eCSSType_Val
|
||||
CSS_PROP_SHORTHAND(background, background, Background, 0)
|
||||
CSS_PROP_BACKGROUND(background-attachment, background_attachment, BackgroundAttachment, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE | CSS_PROPERTY_VALUE_LIST_USES_COMMAS, Color, mBackAttachment, eCSSType_ValueList, kBackgroundAttachmentKTable)
|
||||
CSS_PROP_BACKGROUND(-moz-background-clip, _moz_background_clip, MozBackgroundClip, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE | CSS_PROPERTY_VALUE_LIST_USES_COMMAS, Color, mBackClip, eCSSType_ValueList, kBackgroundClipKTable)
|
||||
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE, Color, mBackColor, eCSSType_ValuePair, nsnull)
|
||||
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE, Color, mBackColor, eCSSType_Value, nsnull)
|
||||
CSS_PROP_BACKGROUND(background-image, background_image, BackgroundImage, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE | CSS_PROPERTY_VALUE_LIST_USES_COMMAS, Color, mBackImage, eCSSType_ValueList, nsnull)
|
||||
CSS_PROP_BACKGROUND(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE, Color, mBackInlinePolicy, eCSSType_Value, kBackgroundInlinePolicyKTable)
|
||||
CSS_PROP_BACKGROUND(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE | CSS_PROPERTY_VALUE_LIST_USES_COMMAS, Color, mBackOrigin, eCSSType_ValueList, kBackgroundOriginKTable)
|
||||
|
@ -307,7 +307,7 @@ struct nsCSSColor : public nsCSSStruct {
|
||||
~nsCSSColor(void);
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValuePair mBackColor;
|
||||
nsCSSValue mBackColor;
|
||||
nsCSSValueList* mBackImage;
|
||||
nsCSSValueList* mBackRepeat;
|
||||
nsCSSValueList* mBackAttachment;
|
||||
|
@ -1217,42 +1217,17 @@ nsComputedDOMStyle::GetBackgroundClip(nsIDOMCSSValue** aValue)
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetBackgroundColor(nsIDOMCSSValue** aValue)
|
||||
{
|
||||
const nsStyleBackground* bg = GetStyleBackground();
|
||||
nsresult rv;
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (bg->mBackgroundColor == bg->mFallbackBackgroundColor) {
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = SetToRGBAColor(val, bg->mBackgroundColor);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete val;
|
||||
return rv;
|
||||
}
|
||||
rv = CallQueryInterface(val, aValue);
|
||||
} else {
|
||||
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
||||
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
for (PRUint32 i = 0; i < 2; ++i) {
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
if (!val || !valueList->AppendCSSValue(val)) {
|
||||
delete val;
|
||||
delete valueList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = SetToRGBAColor(val, (i == 0) ? bg->mBackgroundColor
|
||||
: bg->mFallbackBackgroundColor);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete valueList;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
rv = CallQueryInterface(valueList, aValue);
|
||||
const nsStyleBackground* color = GetStyleBackground();
|
||||
nsresult rv = SetToRGBAColor(val, color->mBackgroundColor);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete val;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1271,7 +1246,7 @@ nsComputedDOMStyle::GetBackgroundImage(nsIDOMCSSValue** aValue)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
imgIRequest *image = bg->mLayers[i].mImage.mRequest;
|
||||
imgIRequest *image = bg->mLayers[i].mImage;
|
||||
if (!image) {
|
||||
val->SetIdent(eCSSKeyword_none);
|
||||
} else {
|
||||
|
@ -3802,22 +3802,20 @@ struct BackgroundItemComputer<nsCSSValueList, PRUint8>
|
||||
};
|
||||
|
||||
NS_SPECIALIZE_TEMPLATE
|
||||
struct BackgroundItemComputer<nsCSSValueList, nsStyleBackground::Image>
|
||||
struct BackgroundItemComputer<nsCSSValueList, nsCOMPtr<imgIRequest> >
|
||||
{
|
||||
static void ComputeValue(nsStyleContext* aStyleContext,
|
||||
const nsCSSValueList* aSpecifiedValue,
|
||||
nsStyleBackground::Image& aComputedValue,
|
||||
nsCOMPtr<imgIRequest>& aComputedValue,
|
||||
PRBool& aCanStoreInRuleTree)
|
||||
{
|
||||
const nsCSSValue &value = aSpecifiedValue->mValue;
|
||||
if (eCSSUnit_Image == value.GetUnit()) {
|
||||
aComputedValue.mRequest = value.GetImageValue();
|
||||
aComputedValue.mSpecified = PR_TRUE;
|
||||
aComputedValue = value.GetImageValue();
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(eCSSUnit_None == value.GetUnit(), "unexpected unit");
|
||||
aComputedValue.mRequest = nsnull;
|
||||
aComputedValue.mSpecified = PR_FALSE;
|
||||
aComputedValue = nsnull;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -3958,23 +3956,13 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
|
||||
{
|
||||
COMPUTE_START_RESET(Background, (), bg, parentBG, Color, colorData)
|
||||
|
||||
// background-color: color, string, inherit [pair]
|
||||
if (eCSSUnit_Initial == colorData.mBackColor.mXValue.GetUnit()) {
|
||||
// background-color: color, string, inherit
|
||||
if (eCSSUnit_Initial == colorData.mBackColor.GetUnit()) {
|
||||
bg->mBackgroundColor = NS_RGBA(0, 0, 0, 0);
|
||||
} else if (!SetColor(colorData.mBackColor.mXValue,
|
||||
parentBG->mBackgroundColor, mPresContext,
|
||||
aContext, bg->mBackgroundColor, canStoreInRuleTree)) {
|
||||
NS_ASSERTION(eCSSUnit_Null == colorData.mBackColor.mXValue.GetUnit(),
|
||||
"unexpected color unit");
|
||||
}
|
||||
|
||||
if (eCSSUnit_Initial == colorData.mBackColor.mYValue.GetUnit()) {
|
||||
bg->mFallbackBackgroundColor = NS_RGBA(0, 0, 0, 0);
|
||||
} else if (!SetColor(colorData.mBackColor.mYValue,
|
||||
parentBG->mFallbackBackgroundColor, mPresContext,
|
||||
aContext, bg->mFallbackBackgroundColor,
|
||||
} else if (!SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
||||
mPresContext, aContext, bg->mBackgroundColor,
|
||||
canStoreInRuleTree)) {
|
||||
NS_ASSERTION(eCSSUnit_Null == colorData.mBackColor.mYValue.GetUnit(),
|
||||
NS_ASSERTION(eCSSUnit_Null == colorData.mBackColor.GetUnit(),
|
||||
"unexpected color unit");
|
||||
}
|
||||
|
||||
@ -3984,7 +3972,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
|
||||
// background-image: url (stored as image), none, inherit [list]
|
||||
SetBackgroundList(aContext, colorData.mBackImage, bg->mLayers,
|
||||
parentBG->mLayers, &nsStyleBackground::Layer::mImage,
|
||||
nsStyleBackground::Image(), parentBG->mImageCount,
|
||||
nsCOMPtr<imgIRequest>(nsnull), parentBG->mImageCount,
|
||||
bg->mImageCount, maxItemCount, rebuild, canStoreInRuleTree);
|
||||
|
||||
// background-repeat: enum, inherit, initial [list]
|
||||
@ -5677,8 +5665,7 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
|
||||
ruleData.mMarginData = &marginData;
|
||||
|
||||
nsCSSValue* backgroundValues[] = {
|
||||
&colorData.mBackColor.mXValue,
|
||||
&colorData.mBackColor.mYValue,
|
||||
&colorData.mBackColor,
|
||||
&firstBackgroundImage
|
||||
};
|
||||
|
||||
|
@ -1218,7 +1218,6 @@ nsStyleBackground::nsStyleBackground()
|
||||
, mPositionCount(1)
|
||||
, mImageCount(1)
|
||||
, mBackgroundColor(NS_RGBA(0, 0, 0, 0))
|
||||
, mFallbackBackgroundColor(NS_RGBA(0, 0, 0, 0))
|
||||
, mBackgroundInlinePolicy(NS_STYLE_BG_INLINE_POLICY_CONTINUOUS)
|
||||
{
|
||||
Layer *onlyLayer = mLayers.AppendElement();
|
||||
@ -1235,7 +1234,6 @@ nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
|
||||
, mImageCount(aSource.mImageCount)
|
||||
, mLayers(aSource.mLayers) // deep copy
|
||||
, mBackgroundColor(aSource.mBackgroundColor)
|
||||
, mFallbackBackgroundColor(aSource.mFallbackBackgroundColor)
|
||||
, mBackgroundInlinePolicy(aSource.mBackgroundInlinePolicy)
|
||||
{
|
||||
// If the deep copy of mLayers failed, truncate the counts.
|
||||
@ -1258,7 +1256,6 @@ nsStyleBackground::~nsStyleBackground()
|
||||
nsChangeHint nsStyleBackground::CalcDifference(const nsStyleBackground& aOther) const
|
||||
{
|
||||
if (mBackgroundColor != aOther.mBackgroundColor ||
|
||||
mFallbackBackgroundColor != aOther.mFallbackBackgroundColor ||
|
||||
mBackgroundInlinePolicy != aOther.mBackgroundInlinePolicy ||
|
||||
mImageCount != aOther.mImageCount)
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
@ -1284,8 +1281,7 @@ PRBool nsStyleBackground::HasFixedBackground() const
|
||||
{
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, this) {
|
||||
const Layer &layer = mLayers[i];
|
||||
if (layer.mAttachment == NS_STYLE_BG_ATTACHMENT_FIXED &&
|
||||
layer.mImage.mRequest) {
|
||||
if (layer.mAttachment == NS_STYLE_BG_ATTACHMENT_FIXED && layer.mImage) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -1294,7 +1290,7 @@ PRBool nsStyleBackground::HasFixedBackground() const
|
||||
|
||||
PRBool nsStyleBackground::IsTransparent() const
|
||||
{
|
||||
return !BottomLayer().mImage.mRequest && mImageCount == 1 &&
|
||||
return !BottomLayer().mImage && mImageCount == 1 &&
|
||||
NS_GET_A(mBackgroundColor) == 0;
|
||||
}
|
||||
|
||||
@ -1307,28 +1303,6 @@ nsStyleBackground::Position::SetInitialValues()
|
||||
mYIsPercent = PR_TRUE;
|
||||
}
|
||||
|
||||
// Initialize to initial values
|
||||
nsStyleBackground::Image::Image()
|
||||
{
|
||||
SetInitialValues();
|
||||
}
|
||||
|
||||
nsStyleBackground::Image::~Image()
|
||||
{
|
||||
}
|
||||
|
||||
void nsStyleBackground::Image::SetInitialValues()
|
||||
{
|
||||
mRequest = nsnull;
|
||||
mSpecified = PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsStyleBackground::Image::operator==(const Image& aOther) const
|
||||
{
|
||||
return mSpecified == aOther.mSpecified &&
|
||||
EqualImages(mRequest, aOther.mRequest);
|
||||
}
|
||||
|
||||
nsStyleBackground::Layer::Layer()
|
||||
{
|
||||
}
|
||||
@ -1345,7 +1319,7 @@ nsStyleBackground::Layer::SetInitialValues()
|
||||
mOrigin = NS_STYLE_BG_ORIGIN_PADDING;
|
||||
mRepeat = NS_STYLE_BG_REPEAT_XY;
|
||||
mPosition.SetInitialValues();
|
||||
mImage.SetInitialValues();
|
||||
mImage = nsnull;
|
||||
}
|
||||
|
||||
PRBool nsStyleBackground::Layer::operator==(const Layer& aOther) const
|
||||
@ -1355,7 +1329,7 @@ PRBool nsStyleBackground::Layer::operator==(const Layer& aOther) const
|
||||
mOrigin == aOther.mOrigin &&
|
||||
mRepeat == aOther.mRepeat &&
|
||||
mPosition == aOther.mPosition &&
|
||||
mImage == aOther.mImage;
|
||||
EqualImages(mImage, aOther.mImage);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
|
@ -194,34 +194,6 @@ struct nsStyleBackground {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* We represent images as as struct because we need to distinguish the
|
||||
* case where the imgIRequest is null because the winning
|
||||
* background-image declaration specified no image from the case where
|
||||
* the imgIRequest is null because the image that was specified was
|
||||
* blocked or missing (e.g., missing file).
|
||||
*/
|
||||
struct Image;
|
||||
friend struct Image;
|
||||
struct Image {
|
||||
nsCOMPtr<imgIRequest> mRequest;
|
||||
PRBool mSpecified; // if false, mRequest is guaranteed to be null
|
||||
|
||||
// These are not inline so that we can avoid #include "imgIRequest.h"
|
||||
|
||||
// Initialize to initial values
|
||||
Image();
|
||||
~Image();
|
||||
void SetInitialValues();
|
||||
|
||||
// An equality operator that compares the images using URL-equality
|
||||
// rather than pointer-equality.
|
||||
PRBool operator==(const Image& aOther) const;
|
||||
PRBool operator!=(const Image& aOther) const {
|
||||
return !(*this == aOther);
|
||||
}
|
||||
};
|
||||
|
||||
struct Layer;
|
||||
friend struct Layer;
|
||||
struct Layer {
|
||||
@ -230,7 +202,7 @@ struct nsStyleBackground {
|
||||
PRUint8 mOrigin; // [reset] See nsStyleConsts.h
|
||||
PRUint8 mRepeat; // [reset] See nsStyleConsts.h
|
||||
Position mPosition; // [reset]
|
||||
Image mImage; // [reset]
|
||||
nsCOMPtr<imgIRequest> mImage; // [reset]
|
||||
|
||||
// Initializes only mImage
|
||||
Layer();
|
||||
@ -272,7 +244,6 @@ struct nsStyleBackground {
|
||||
for (PRUint32 var_ = (stylebg_)->mImageCount; var_-- != 0; )
|
||||
|
||||
nscolor mBackgroundColor; // [reset]
|
||||
nscolor mFallbackBackgroundColor; // [reset]
|
||||
|
||||
// FIXME: This (now background-break in css3-background) should
|
||||
// probably move into a different struct so that everything in
|
||||
|
@ -621,7 +621,7 @@ var gCSSProperties = {
|
||||
/* multiple backgrounds */
|
||||
"url(404.png), url(404.png)",
|
||||
"url(404.png), url(404.png) transparent",
|
||||
"url(404.png), url(404.png) transparent red",
|
||||
"url(404.png), url(404.png) red",
|
||||
"repeat-x, fixed, none",
|
||||
"0% top url(404.png), url(404.png) 0% top",
|
||||
"fixed repeat-y top left url(404.png), repeat-x green",
|
||||
@ -666,8 +666,8 @@ var gCSSProperties = {
|
||||
domProp: "backgroundColor",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "transparent", "transparent transparent", "rgba(255, 127, 15, 0)", "hsla(240, 97%, 50%, 0.0)", "rgba(0, 0, 0, 0)", "rgba(255,255,255,-3.7)" ],
|
||||
other_values: [ "green", "rgb(255, 0, 128)", "#fc2", "#96ed2a", "black", "rgba(255,255,0,3)", "transparent green", "green transparent", "blue fuchsia", "rgb(3,4,5) hsl(240, 50%, 50%)" ],
|
||||
initial_values: [ "transparent", "rgba(255, 127, 15, 0)", "hsla(240, 97%, 50%, 0.0)", "rgba(0, 0, 0, 0)", "rgba(255,255,255,-3.7)" ],
|
||||
other_values: [ "green", "rgb(255, 0, 128)", "#fc2", "#96ed2a", "black", "rgba(255,255,0,3)" ],
|
||||
invalid_values: [ "#0", "#00", "#0000", "#00000", "#0000000", "#00000000", "#000000000", "rgb(255.0,0.387,3489)" ]
|
||||
},
|
||||
"background-image": {
|
||||
|
@ -202,7 +202,7 @@ TableBackgroundPainter::TableBackgroundData::ShouldSetBCBorder()
|
||||
}
|
||||
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, mBackground) {
|
||||
if (mBackground->mLayers[i].mImage.mRequest)
|
||||
if (mBackground->mLayers[i].mImage)
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -4117,7 +4117,7 @@ nsTreeBodyFrame::ScrollInternal(const ScrollParts& aParts, PRInt32 aRow)
|
||||
// See if we have a transparent background or a background image.
|
||||
// If we do, then we cannot blit.
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->BottomLayer().mImage.mRequest ||
|
||||
if (background->BottomLayer().mImage ||
|
||||
background->mImageCount > 1 ||
|
||||
NS_GET_A(background->mBackgroundColor) < 255 ||
|
||||
PR_ABS(delta)*mRowHeight >= mRect.height) {
|
||||
@ -4157,7 +4157,7 @@ nsTreeBodyFrame::ScrollHorzInternal(const ScrollParts& aParts, PRInt32 aPosition
|
||||
// See if we have a transparent background or a background image.
|
||||
// If we do, then we cannot blit.
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->BottomLayer().mImage.mRequest ||
|
||||
if (background->BottomLayer().mImage ||
|
||||
background->mImageCount > 1 ||
|
||||
NS_GET_A(background->mBackgroundColor) < 255 ||
|
||||
PR_ABS(delta) >= mRect.width) {
|
||||
|
Loading…
Reference in New Issue
Block a user