Bug 193434 - [testcase] [CSS 2.1 Conformance] rgb() should take either three integer values or three percentage values but not mixed
Summary: [testcase] [CSS 2.1 Conformance] rgb() should take either three integer value...
Status: VERIFIED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 4.2.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-21 00:17 UTC by Gérard Talbot (no longer involved)
Modified: 2009-06-14 03:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gérard Talbot (no longer involved) 2009-05-21 00:17:11 UTC
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    Ubuntu Packages

Testcase
--------
http://www.hixie.ch/tests/evil/css/css21/tests/t040306-syntax-01-f.htm

Relevant excerpt of code
------------------------

 <style type="text/css">
    p.incorrect { color: green }
    p#numnumpercent { color: rgb(255, 0, 0%) }
    p#percentnumnum { color: rgb(100%, 0, 0) }
    p#percentpercentnum { color: rgb(100%, 0%, 0) }
    p#percentnumpercent { color: rgb(100%, 0, 0%) }
  </style>

  <p id="numnumpercent" class="incorrect">This should be green</p>
  <p id="percentnumnum" class="incorrect">This should be green</p>
  <p id="percentpercentnum" class="incorrect">This should be green</p>
  <p id="percentnumpercent" class="incorrect">This should be green</p>

Description
-----------

{
The format of an RGB value in the functional notation is 'rgb(' followed by a comma-separated list of three numerical values (either three integer values or three percentage values) followed by ')'.
}
CSS 2.1, section 4.3.6, Color defined, specified as a numerical RGB specification.
http://www.w3.org/TR/CSS21/syndata.html#value-def-color

From reading the spec, we are lead to believe that the "or" is exclusive: so, it's either 3 integers or 3 percentage values but not mixed, with no mixing allowed.

Therefore the 4 CSS rules

    p#numnumpercent { color: rgb(255, 0, 0%) }
    p#percentnumnum { color: rgb(100%, 0, 0) }
    p#percentpercentnum { color: rgb(100%, 0%, 0) }
    p#percentnumpercent { color: rgb(100%, 0, 0%) }

should trigger respectively 4 parsing errors and then 
p.incorrect { color: green }
should apply making the first 4 lines as green, not red.

I searched for a duplicate and did not find any.

regards, Gérard
Comment 1 Gérard Talbot (no longer involved) 2009-05-21 00:26:45 UTC
The CSS validator will also report parsing errors for the 4 respective declarations.

1 p#numnumpercent  Value Error : color This number should be an integer.  )  
2 p#percentnumnum  Value Error : color 0 is an incorrect percentage  )  
3 p#percentpercentnum  Value Error : color 0 is an incorrect percentage  )  
4 p#percentnumpercent  Value Error : color 0 is an incorrect percentage  )

regards, Gérard
Comment 2 Gérard Talbot (no longer involved) 2009-05-21 05:43:44 UTC
This bug still occurs, occurs as well in Konqueror 4.2.3

regards, Gérard
Comment 3 Germain Garand 2009-05-21 14:30:42 UTC
(fixed in my tree, waiting commit)
Comment 4 Gérard Talbot (no longer involved) 2009-05-21 18:09:33 UTC
The testcase mentioned in the description has been submitted to become part of the CSS 2.1 Conformance test suite:

RGB color syntax error handling (test for validity)
http://www.w3.org/Style/CSS/Test/CSS2.1/current/html4/color-000.htm

regards, Gérard
Comment 5 Germain Garand 2009-05-22 06:43:21 UTC
SVN commit 971234 by ggarand:

don't allow mix of percents and integers in functional-style colour
declarations since it is explicitely disallowed by CSS 2.1

BUG: 193434


 M  +5 -3      cssparser.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=971234
Comment 6 Germain Garand 2009-05-23 04:53:33 UTC
SVN commit 971651 by ggarand:

automatically merged revision 971234:
don't allow mix of percents and integers in functional-style colour
declarations since it is explicitely disallowed by CSS 2.1

BUG: 193434

 M  +5 -3      cssparser.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=971651
Comment 7 Gérard Talbot (no longer involved) 2009-06-14 03:17:39 UTC
I get expected results with Konqueror 4.2.4.

Marking as VERIFIED

regards, Gérard