diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-07 12:33:12 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-07-11 19:04:34 +0200 |
commit | f1521046d8ad0d8cea877c7b3070b18f3bca9f93 (patch) | |
tree | 9aa02a36278e2b9fee940e477c2d9b71b2208d04 /svgio/source | |
parent | d086930523d4f5397d38f0d5a5be571cff8ee66b (diff) |
tdf#149893: Color names are ASCII case-insensitive
See https://www.w3.org/TR/css-color-3/#html4
Change-Id: Ifdf887bad08ab606abef78fa8335bc49507f4a43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136879
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
(cherry picked from commit 8da687a2843a2cc9e5db3c82204260bde783a76c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136863
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136882
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 8 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtools.cxx | 18 |
2 files changed, 10 insertions, 16 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 21ef7cebf5cf..df200e40f428 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1301,7 +1301,7 @@ namespace svgio::svgreader OUString aURL; SvgNumber aOpacity; - if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent, aOpacity)) + if(readSvgPaint(aContent, aSvgPaint, aURL, aOpacity)) { setFill(aSvgPaint); if(aOpacity.isSet()) @@ -1346,7 +1346,7 @@ namespace svgio::svgreader OUString aURL; SvgNumber aOpacity; - if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent, aOpacity)) + if(readSvgPaint(aContent, aSvgPaint, aURL, aOpacity)) { maStroke = aSvgPaint; if(aOpacity.isSet()) @@ -1475,7 +1475,7 @@ namespace svgio::svgreader OUString aURL; SvgNumber aOpacity; - if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent, aOpacity)) + if(readSvgPaint(aContent, aSvgPaint, aURL, aOpacity)) { maStopColor = aSvgPaint; if(aOpacity.isSet()) @@ -1788,7 +1788,7 @@ namespace svgio::svgreader OUString aURL; SvgNumber aOpacity; - if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent, aOpacity)) + if(readSvgPaint(aContent, aSvgPaint, aURL, aOpacity)) { maColor = aSvgPaint; if(aOpacity.isSet()) diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 928dfbe5caa9..cb2f1abce77d 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -486,7 +486,7 @@ namespace svgio::svgreader } } - bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName, bool bCaseIndependent) + bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName) { typedef std::unordered_map< OUString, Color > ColorTokenMapper; typedef std::pair< OUString, Color > ColorTokenValueType; @@ -640,13 +640,7 @@ namespace svgio::svgreader { ColorTokenValueType(OUString("yellowgreen"), Color(154, 205, 50) ) }, }; - ColorTokenMapper::const_iterator aResult(aColorTokenMapperList.find(rName)); - - if(bCaseIndependent && aResult == aColorTokenMapperList.end()) - { - // also try case independent match (e.g. for Css styles) - aResult = aColorTokenMapperList.find(rName.toAsciiLowerCase()); - } + ColorTokenMapper::const_iterator aResult(aColorTokenMapperList.find(rName.toAsciiLowerCase())); if(aResult == aColorTokenMapperList.end()) { @@ -659,7 +653,7 @@ namespace svgio::svgreader } } - bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, bool bCaseIndependent, SvgNumber& rOpacity) + bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, SvgNumber& rOpacity) { const sal_Int32 nLen(rCandidate.getLength()); @@ -798,7 +792,7 @@ namespace svgio::svgreader else { // color keyword - if(match_colorKeyword(rColor, rCandidate, bCaseIndependent)) + if(match_colorKeyword(rColor, rCandidate)) { return true; } @@ -1084,13 +1078,13 @@ namespace svgio::svgreader } bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, - OUString& rURL, bool bCaseIndependent, SvgNumber& rOpacity) + OUString& rURL, SvgNumber& rOpacity) { if( !rCandidate.isEmpty() ) { basegfx::BColor aColor; - if(read_color(rCandidate, aColor, bCaseIndependent, rOpacity)) + if(read_color(rCandidate, aColor, rOpacity)) { rSvgPaint = SvgPaint(aColor, true, true); return true; |