SVGColor custom text format is different from the CSS color custom text format
https://bugs.webkit.org/show_bug.cgi?id=148879
Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-09-11
Reviewed by Daniel Bates.
Source/WebCore:
Implement the serialization of a CSS color value as it is described in
<https://drafts.csswg.org/cssom/#serializing-css-values>. Add the new
function Color::cssText() which is refactored from the existing function
Color::serialized(). Use the new function for serializing the SVGColor
always and also for Color but only when the alpha component is not 1.
Test: svg/css/computed-style-rgb-color.html
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Move the code
for serializing the color from this function to Color::cssText().
* platform/graphics/Color.cpp:
(WebCore::Color::serialized): Call Color::cssText() if the alpha component
is not 1 and delete the repeated code.
(WebCore::Color::cssText):
* platform/graphics/Color.h: Add the new function to the header file.
* svg/SVGColor.cpp:
(WebCore::SVGColor::customCSSText): Call Color::cssText() always instead
of calling Color::serialized() for serializing the SVGColor.
LayoutTests:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/parse-color-int-or-percent-crash.html:
* platform/mac/svg/webarchive/svg-script-subresouces-expected.txt:
* svg/css/case-sensitive-tags-expected.txt:
* svg/css/case-sensitive-tags.html:
* svg/css/getComputedStyle-basic-expected.txt:
* svg/css/script-tests/svg-attribute-parser-mode.js:
* svg/css/svg-attribute-parser-mode-expected.txt:
* svg/dom/SVGColor-expected.txt:
* svg/dom/SVGPaint-expected.txt:
* svg/dom/SVGStyleElement/disable-svg-style-element-expected.txt:
* svg/dom/SVGStyleElement/script-tests/disable-svg-style-element.js:
* svg/dom/script-tests/SVGColor.js:
* svg/dom/script-tests/SVGPaint.js:
* svg/webarchive/svg-script-subresouces-expected.webarchive:
* transitions/svg-transitions-expected.txt:
Fix expected results for existing tests
* svg/css/computed-style-rgb-color-expected.txt: Added.
* svg/css/computed-style-rgb-color.html: Added.
Ensure that the correct format is returned when getComputedStyle() is
called for an SVG color.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189646
268f45cc-cd09-0410-ab3c-
d52691b4dbfc