LayoutTests:
Reviewed by Darin.
- tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=9506
Tests using HSL rather than RGB for color values.
* fast/css/hsl-color-expected.checksum: Added.
* fast/css/hsl-color-expected.png: Added.
* fast/css/hsl-color-expected.txt: Added.
* fast/css/hsl-color.html: Added.
* fast/css/hsla-color-expected.checksum: Added.
* fast/css/hsla-color-expected.png: Added.
* fast/css/hsla-color-expected.txt: Added.
* fast/css/hsla-color.html: Added.
WebCore:
Reviewed by Darin.
- Added HSL color support as specified in CSS3 spec.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9506
Added parsing support of hsl(h,s,l) and hsla(h,s,l,a)
Added converting code to convert HSL to RGB
* css/cssparser.cpp:
(WebCore::CSSParser::parseColorParameters):
Moved common code to parse RGB/RGBA values into it's
own function. This code was duplicated in the parseColorFromValue()
method.
(WebCore::CSSParser::parseHSLParameters):
Common code to parse HSL/HSLA values.
(WebCore::CSSParser::parseColorFromValue):
Moved RGB/RGBA parsing out to seperate function as the code was
duplicated.
Added parsing support for hsl( and hsla(
* css/cssparser.h:
Added two new functions parseColorParameters() and
parseHSLParameters().
* platform/Color.cpp:
(WebCore::calcHue):
Added Hue parameter to RGB color.
(WebCore::makeRGBAFromHSLA):
New function to convert HSLA to RGBA.
* platform/Color.h:
Added new functions makeRGBAFromHSLA() and calcHue().
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/css/hsla-color.html b/LayoutTests/fast/css/hsla-color.html
new file mode 100644
index 0000000..6365f592
--- /dev/null
+++ b/LayoutTests/fast/css/hsla-color.html
@@ -0,0 +1,17 @@
+<html lang="en">
+<title>CSS 3.0 HSLA color support test</title>
+
+<style type="text/css">
+body {background-color:yellow;}
+h1#red {color: hsla(0, 100%, 50%, 0.5) }
+h1#green {color: hsla(120, 100%, 50%, 0.0) }
+h1#greensolid {color: hsla(120, 100%, 50%, 1.0) }
+</style>
+</head>
+
+<body>
+<h1 id="red">This should be red, alpha 0.5</h1>
+<h1 id="green">This should be green, alpha 0.0</h1>
+<h1 id="greensolid">This should be green, alpha 1.0</h1>
+</body></html>
+