Version: (using KDE KDE 3.5.4) Installed from: Ubuntu Packages When viewing the page "http://www.oswd.org/design/preview/id/2993" in Firefox 1.5, the entire area on the left side of the window (the Pages/Category/Meta links list) is correctly rendered in light green. When :hover'ing over a line, the background of the line switches to a lighter green. When this same page is viewed in Konqueror, the heading "Pages/Category/Meta" areas are colored light green. However, each link line has a yellow background and when :hover'ed over becomes almost white in color. This is an extremely noticeable CSS-rendering bug that should be easily fixable. Hope this helps, Bob
Still valid in 4.1.1
SVN commit 864150 by ggarand: do not attempt to recover incorrectly written hexadecimal colours when the parser is in strict mode. BUG: 132581 M +26 -24 cssparser.cpp --- trunk/KDE/kdelibs/khtml/css/cssparser.cpp #864149:864150 @@ -2134,31 +2134,33 @@ } } -static bool parseColor(int unit, const QString& name, QRgb& rgb) +static bool parseColor(int unit, const QString& name, QRgb& rgb, bool strict) { int len = name.length(); if ( !len ) return false; - const unsigned short* c = - reinterpret_cast<const unsigned short*>( name.unicode() ); + if (unit == CSSPrimitiveValue::CSS_RGBCOLOR || !strict) { + const unsigned short* c = + reinterpret_cast<const unsigned short*>( name.unicode() ); - rgb = 0xff; // fixed alpha - if ( len == 6 ) { - // RRGGBB - bool error = false; - for ( int i = 0; i < 6; ++i, ++c ) - rgb = rgb << 4 | hex2int( *c, &error ); - if ( !error ) - return true; - } else if ( len == 3 ) { - // RGB, shortcut for RRGGBB - bool error = false; - for ( int i = 0; i < 3; ++i, ++c ) - rgb = rgb << 8 | 0x11 * hex2int( *c, &error ); - if ( !error ) - return true; + rgb = 0xff; // fixed alpha + if ( len == 6 ) { + // RRGGBB + bool error = false; + for ( int i = 0; i < 6; ++i, ++c ) + rgb = rgb << 4 | hex2int( *c, &error ); + if ( !error ) + return true; + } else if ( len == 3 ) { + // RGB, shortcut for RRGGBB + bool error = false; + for ( int i = 0; i < 3; ++i, ++c ) + rgb = rgb << 8 | 0x11 * hex2int( *c, &error ); + if ( !error ) + return true; + } } if ( unit == CSSPrimitiveValue::CSS_IDENT ) { @@ -2182,17 +2184,17 @@ CSSPrimitiveValueImpl *CSSParser::parseColorFromValue(Value* value) { QRgb c = khtml::transparentColor; - if ( !strict && value->unit == CSSPrimitiveValue::CSS_NUMBER && + if ( !strict && value->unit == CSSPrimitiveValue::CSS_NUMBER && // color: 000000 (quirk) value->fValue >= 0. && value->fValue < 1000000. ) { QString str; str.sprintf( "%06d", (int)(value->fValue+.5) ); - if ( !::parseColor( value->unit, str, c ) ) + if ( !::parseColor( CSSPrimitiveValue::CSS_RGBCOLOR, str, c, strict ) ) return 0; } - else if (value->unit == CSSPrimitiveValue::CSS_RGBCOLOR || - value->unit == CSSPrimitiveValue::CSS_IDENT || - (!strict && value->unit == CSSPrimitiveValue::CSS_DIMENSION)) { - if ( !::parseColor( value->unit, qString( value->string ), c) ) + else if (value->unit == CSSPrimitiveValue::CSS_RGBCOLOR || // color: #ff0000 + value->unit == CSSPrimitiveValue::CSS_IDENT || // color: red || color: ff0000 (quirk) + (!strict && value->unit == CSSPrimitiveValue::CSS_DIMENSION)) { // color: 00ffff (quirk) + if ( !::parseColor( value->unit, qString( value->string ), c, strict) ) return 0; } else if ( value->unit == Value::Function &&