SVGColor custom text format is different from the CSS color custom text format
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Sep 2015 01:51:56 +0000 (01:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Sep 2015 01:51:56 +0000 (01:51 +0000)
commit0d082accf2ac2dd443e9138195a1e453bc1a908d
treef2da8c09c4175789bb5a752ef2b7c72e73a6646e
parentb27b63147ca79c53f67fb6e1dbe68d40f37898b9
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
25 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/fast/css/parse-color-int-or-percent-crash.html
LayoutTests/platform/mac/svg/webarchive/svg-script-subresouces-expected.txt
LayoutTests/svg/css/case-sensitive-tags-expected.txt
LayoutTests/svg/css/case-sensitive-tags.html
LayoutTests/svg/css/computed-style-rgb-color-expected.txt [new file with mode: 0644]
LayoutTests/svg/css/computed-style-rgb-color.html [new file with mode: 0644]
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
LayoutTests/svg/css/script-tests/svg-attribute-parser-mode.js
LayoutTests/svg/css/svg-attribute-parser-mode-expected.txt
LayoutTests/svg/dom/SVGColor-expected.txt
LayoutTests/svg/dom/SVGPaint-expected.txt
LayoutTests/svg/dom/SVGStyleElement/disable-svg-style-element-expected.txt
LayoutTests/svg/dom/SVGStyleElement/script-tests/disable-svg-style-element.js
LayoutTests/svg/dom/script-tests/SVGColor.js
LayoutTests/svg/dom/script-tests/SVGPaint.js
LayoutTests/svg/webarchive/svg-script-subresouces-expected.webarchive
LayoutTests/transitions/svg-transitions-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/platform/graphics/Color.cpp
Source/WebCore/platform/graphics/Color.h
Source/WebCore/svg/SVGColor.cpp