diff --git a/Common/3dParty/html/css/src/CCompiledStyle.cpp b/Common/3dParty/html/css/src/CCompiledStyle.cpp index 5852c560f7..c62d997d61 100644 --- a/Common/3dParty/html/css/src/CCompiledStyle.cpp +++ b/Common/3dParty/html/css/src/CCompiledStyle.cpp @@ -1282,7 +1282,10 @@ namespace NSCSS Scale(nValue, enScalingDirection); - sValueString += std::to_wstring(nValue); + sValueString += std::to_wstring(nValue); + + if (!iswdigit(sValueTemp.back())) + sValueString += sValueTemp.back(); } else sValueString += sValueTemp; diff --git a/Common/3dParty/html/css/src/ConstValues.h b/Common/3dParty/html/css/src/ConstValues.h index e0ba99e7e6..61fff36e64 100644 --- a/Common/3dParty/html/css/src/ConstValues.h +++ b/Common/3dParty/html/css/src/ConstValues.h @@ -2023,7 +2023,7 @@ namespace NSCSS if (sValue.empty()) return BorderSide(); - const std::vector arValues = NS_STATIC_FUNCTIONS::GetWordsW(sValue, L" "); + const std::vector arValues = NS_STATIC_FUNCTIONS::GetWordsW(NS_STATIC_FUNCTIONS::NormalizeRGB(sValue), L" "); BorderSide oBorderSide; for (std::wstring sValue : arValues) { diff --git a/Common/3dParty/html/css/src/StaticFunctions.h b/Common/3dParty/html/css/src/StaticFunctions.h index 50f85b922b..c984887374 100644 --- a/Common/3dParty/html/css/src/StaticFunctions.h +++ b/Common/3dParty/html/css/src/StaticFunctions.h @@ -315,6 +315,26 @@ namespace NSCSS return sValue.empty() ? false : std::all_of(sValue.begin(), sValue.end(), [] (const wchar_t& cChar) { return iswdigit(cChar); }); } + inline std::wstring NormalizeRGB(const std::wstring& wsValue) + { + std::wstring wsNewValue = wsValue; + + size_t unBegin = 0, unEnd; + + while (std::wstring::npos != (unBegin = wsNewValue.find(L"rgb(", unBegin))) + { + unEnd = wsNewValue.find(L")", unBegin); + + while ((unBegin = wsNewValue.find(L" ", unBegin)) != std::wstring::npos && unBegin < unEnd) + { + wsNewValue.replace(unBegin, 1, L","); + ++unBegin; + } + } + + return wsNewValue; + } + inline std::wstring ConvertRgbToHex(const std::wstring& sRgbValue) { size_t posFirst = sRgbValue.find_first_of(L"01234567890");