Color transparency support in html import/export
authorAlexey Chernov <4ernov@gmail.com>
Mon, 2 Jul 2012 19:14:31 +0000 (23:14 +0400)
committerQt by Nokia <qt-info@nokia.com>
Tue, 10 Jul 2012 01:24:56 +0000 (03:24 +0200)
commit2d5d6c8fbc4e0575bd4388a8ccc6d198619a3a03
treeaefa4f4f16366f23ce492fbe8b8eacd06ce1fea4
parent69fb70f6b3c88d4d2bb5ca97dbb7f77f42c828c5
Color transparency support in html import/export

Export of color transparency component is added for cases where color
is exported to html. New static function colorValue() is added to
prepare CSS string representation of QColor. When the color is opaque,
it falls down to QColor::name() method which was used previously,
otherwise it returns 'rgba()' CSS statement or 'transparent' keyword in
case transparency is 0.
6-digit precision is used for alpha value as it's maximum which can be
processed properly by Gecko and Webkit engines
(http://lists.w3.org/Archives/Public/www-style/2009Dec/0295.html).

Import part for rgba() statement was also added to QCssParser. It
supports rgba() color values as stated in CSS Color Module Level 3
(http://www.w3.org/TR/css3-color/#rgba-color).

Import of undocumented statement 'rgba(int,int,int,int);' was also
added to preserve regression test success and to provide compatibility
with previous code relying on this behaviour.

Test cases added to QCssParser autotest for rgba(int,int,int,float)
statement and to QTextDocument autotest for rgba(int,int,int,float)
and 'transparent' statements for certain 'color', 'background-color'
and 'bgcolor' properties.

Change-Id: Id341c4e800249820d52edef8003e50f9a74d062b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
src/gui/text/qcssparser.cpp
src/gui/text/qtextdocument.cpp
tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp