Correctly deal with BODY tag BACKGROUND attribute that is an empty string.

This commit is contained in:
vidur%netscape.com 1998-08-12 17:51:31 +00:00
parent 552d205f90
commit b7ad94a52c

View File

@ -873,24 +873,26 @@ nsHTMLContainer::MapBackgroundAttributesInto(nsIStyleContext* aContext,
// background
if (eContentAttr_HasValue == GetAttribute(nsHTMLAtoms::background, value)) {
if (eHTMLUnit_String == value.GetUnit()) {
// Resolve url to an absolute url
nsIURL* docURL = nsnull;
nsIDocument* doc = mDocument;
if (nsnull != doc) {
docURL = doc->GetDocumentURL();
}
nsAutoString absURLSpec;
nsAutoString spec;
value.GetStringValue(spec);
nsresult rv = NS_MakeAbsoluteURL(docURL, "", spec, absURLSpec);
if (nsnull != docURL) {
NS_RELEASE(docURL);
if (spec.Length() > 0) {
// Resolve url to an absolute url
nsIURL* docURL = nsnull;
nsIDocument* doc = mDocument;
if (nsnull != doc) {
docURL = doc->GetDocumentURL();
}
nsresult rv = NS_MakeAbsoluteURL(docURL, "", spec, absURLSpec);
if (nsnull != docURL) {
NS_RELEASE(docURL);
}
nsStyleColor* color = (nsStyleColor*)aContext->GetMutableStyleData(eStyleStruct_Color);
color->mBackgroundImage = absURLSpec;
color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
color->mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY;
}
nsStyleColor* color = (nsStyleColor*)aContext->GetMutableStyleData(eStyleStruct_Color);
color->mBackgroundImage = absURLSpec;
color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
color->mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY;
}
}