From 21967fb93c1c255b996122a563ae1977b51e4fee Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Thu, 10 Dec 1998 17:50:43 +0000 Subject: [PATCH] Added some code to handle illegal color values more compatabibly --- content/html/content/src/nsGenericHTMLElement.cpp | 8 +++++++- layout/html/content/src/nsGenericHTMLElement.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 274b08d91d3..4d9c45f2fda 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1226,7 +1226,7 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, colorStr.CompressWhitespace(); char cbuf[40]; colorStr.ToCString(cbuf, sizeof(cbuf)); - nscolor color; + nscolor color = 0; if (NS_ColorNameToRGB(cbuf, &color)) { aResult.SetStringValue(colorStr); return PR_TRUE; @@ -1237,9 +1237,15 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, } } +#if XXX_no_nav_compat // Illegal values are mapped to empty aResult.SetEmptyValue(); return PR_FALSE; +#else + // Illegal values in nav are mapped to zero + aResult.SetColorValue(0); + return PR_TRUE; +#endif } PRBool diff --git a/layout/html/content/src/nsGenericHTMLElement.cpp b/layout/html/content/src/nsGenericHTMLElement.cpp index 274b08d91d3..4d9c45f2fda 100644 --- a/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/layout/html/content/src/nsGenericHTMLElement.cpp @@ -1226,7 +1226,7 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, colorStr.CompressWhitespace(); char cbuf[40]; colorStr.ToCString(cbuf, sizeof(cbuf)); - nscolor color; + nscolor color = 0; if (NS_ColorNameToRGB(cbuf, &color)) { aResult.SetStringValue(colorStr); return PR_TRUE; @@ -1237,9 +1237,15 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, } } +#if XXX_no_nav_compat // Illegal values are mapped to empty aResult.SetEmptyValue(); return PR_FALSE; +#else + // Illegal values in nav are mapped to zero + aResult.SetColorValue(0); + return PR_TRUE; +#endif } PRBool