Version: (using KDE Devel) Installed from: Compiled sources KHTML/CSS doesn't handle case when there is a keyword (left, center, right) with a percentage or length in second or the opposite a percentage or length with a keyword (top, center, bottom). Exemple: background-position: left 10px; background-position: center 2em; background-position: right 80%; and background-position: 10px top; background-position: 2em center; background-position: 80% bottom; @see khtml/css/parser.php:585 Simple test case with background-position: center 10px: http://yansanmo.no-ip.org:8080/test/css/backgroundImage.htm
From http://www.w3.org/TR/REC-CSS2/colors.html#background-properties: "Keywords cannot be combined with percentage values or length values" So it should ignore the background-position tag and render as if you didn't specify it at all. Problem is: no browser does. Mozilla and IE agree on ignoring the statement in the the spec and konqueror ignores the 10px.
I'm really undecided how to fix your bug report. I guess I would fix the strictness part, but if you found this problem on a web site we should rather add a "IE compliance" check.
https://bugzilla.mozilla.org/show_bug.cgi?id=237065 - that's interesting. They closed a very similiar bug report as INVALID. Still the supplied test case works in my firefox :)
http://www.w3.org/TR/CSS21/colors.html#background-properties Combinations of keyword, length and percentage values are allowed, (e.g., '50% 2cm' or 'center 2cm' or 'center 10%'). Value: [ [ <percentage> | <length> | left | center | right ] [ <percentage> | <length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | inherit And with MSIE: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/backgroundposition.asp
Stephan Kulow writes: > ------- You are receiving this mail because: ------- > You are on the CC list for the bug, or are watching someone who is. > > http://bugs.kde.org/show_bug.cgi?id=91572 > > > > > ------- Additional Comments From coolo kde org 2004-10-18 09:37 ------- > https://bugzilla.mozilla.org/show_bug.cgi?id=237065 - that's interesting. They closed a very similiar bug report as INVALID. Still the supplied test case works in my firefox :) It's a change between CSS2 and CSS 2.1. Several implementers reported that it was as easy to support it as to reject it (and in fact most browsers supported it) and so there was no good reason to forbid 'center 10px' anymore. Thus the CSS working group relaxed the syntax in the revised edition of CSS2. '10px 50%' --> allowed (10 px from the left, 50% from the top) 'left 10%' --> allowed (0% from the left, 10% from the top) 'center 5%' --> allowed (50% from the left, 5% from the top) '5% center' --> allowed (5% from the left, 50% from the top) '2px bottom' --> allowed (2px from the left, 100% from the top) 'center top' --> allowed (50% from the left, 0% from the top) 'top center' --> allowed! (in this case vertical comes before horizontal) 'right top' --> allowd (100% from the left, 0% from the top) 'top right' --> allowed! (in this case vertical comes before horizontal) '10px left' --> NOT allowed (10px from the left and 50% from the left?) 'top 20%' --> NOT allowed (0% from the top and 20% from the top?) Bert
Some tests cases (with the Bert's test cases). http://yansanmo.no-ip.org:8080/test/css/backgroundPosition.php With a 800x600 screen, the green square should be over the background or as the text says.
CVS commit by coolo: implementing CSS 2.1 compliant parsing of background-position. There are several cases to catch, which makes the code a bit longer than the usual property. BUG: 91572 M +5 -0 ChangeLog 1.308 M +196 -80 css/cssparser.cpp 1.296 M +6 -1 css/cssparser.h 1.77