diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-07 12:33:12 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-07 13:47:51 +0200 |
commit | cded65d05a01ac34af750ddb97f1ffb51f3d638a (patch) | |
tree | ad3825866c608bb8aefcd6ef3329c2d8048ccb44 /svgio/source/svgreader | |
parent | 68c6401e5359466fc0b888d1f3a9be75e4c6ec51 (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
Diffstat (limited to 'svgio/source/svgreader')
-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 a2ed97a940ed..5e355ea309da 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 4ae287784d8c..7fd541a2a93e 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; } @@ -1093,13 +1087,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; |