diff --git a/Common/3dParty/html/css/src/CCssCalculator_Private.cpp b/Common/3dParty/html/css/src/CCssCalculator_Private.cpp
index a5837cdaa1..c95a7243c7 100644
--- a/Common/3dParty/html/css/src/CCssCalculator_Private.cpp
+++ b/Common/3dParty/html/css/src/CCssCalculator_Private.cpp
@@ -733,11 +733,6 @@ namespace NSCSS
});
}
- oStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
-
- for (const CElement* oElement : arFindElements)
- oStyle.AddStyle(oElement->GetStyle(), i + 1);
-
if (NULL != m_mStatictics)
{
std::map::const_iterator oFindCountStyle = m_mStatictics->find(StatistickElement{StatistickElement::IsStyle, arSelectors[i].m_wsStyle});
@@ -755,6 +750,11 @@ namespace NSCSS
}
else
oStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
+
+ for (const CElement* oElement : arFindElements)
+ oStyle.AddStyle(oElement->GetStyle(), i + 1);
+
+ oStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
}
if (!bIsSettings)
diff --git a/Common/3dParty/html/css/src/StyleProperties.cpp b/Common/3dParty/html/css/src/StyleProperties.cpp
index 60190f1280..724acdc9ae 100644
--- a/Common/3dParty/html/css/src/StyleProperties.cpp
+++ b/Common/3dParty/html/css/src/StyleProperties.cpp
@@ -7,6 +7,8 @@ namespace NSCSS
{
namespace NSProperties
{
+ #define CHECK_CONDITIONS (m_bImportant || unLevel <= m_unLevel)
+
static bool CutImportant(std::wstring& wsValue)
{
size_t unBegin = wsValue.find(L"!important");
@@ -83,7 +85,7 @@ namespace NSCSS
template
CValue& CValue::operator=(const T &oValue)
{
- m_oValue = oValue.m_oValue;
+// m_oValue = oValue.m_oValue;
return *this;
}
@@ -117,7 +119,7 @@ namespace NSCSS
bool CString::SetValue(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
{
- if (wsValue.empty() || ((m_bImportant || unLevel < m_unLevel) && !bHardMode))
+ if (wsValue.empty() || (CHECK_CONDITIONS && !bHardMode))
return false;
std::wstring wsNewValue = wsValue;
@@ -136,7 +138,7 @@ namespace NSCSS
bool CString::SetValue(const std::wstring &wsValue, const std::vector &arValiableValues, unsigned int unLevel, bool bHardMode)
{
- if (wsValue.empty() || arValiableValues.empty() || ((m_bImportant || unLevel < m_unLevel) && !bHardMode))
+ if (wsValue.empty() || arValiableValues.empty() || (CHECK_CONDITIONS && !bHardMode))
return false;
std::wstring wsNewValue = wsValue;
@@ -160,7 +162,7 @@ namespace NSCSS
bool CString::SetValue(const std::wstring &wsValue, const std::map &arValiableValues, unsigned int unLevel, bool bHardMode)
{
- if (wsValue.empty() || arValiableValues.empty() || ((m_bImportant || unLevel < m_unLevel) && !bHardMode))
+ if (wsValue.empty() || arValiableValues.empty() || (CHECK_CONDITIONS && !bHardMode))
return false;
std::wstring wsNewValue = wsValue;
@@ -413,7 +415,7 @@ namespace NSCSS
bool CDigit::SetValue(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
{
- if (wsValue.empty() || ((m_bImportant || unLevel < m_unLevel) && !bHardMode))
+ if (wsValue.empty() || (CHECK_CONDITIONS && !bHardMode))
return false;
std::wstring wsNewValue = wsValue;
@@ -423,9 +425,22 @@ namespace NSCSS
if (m_bImportant && !bImportant)
return false;
- if (!CUnitMeasureConverter::GetValue(wsValue, m_oValue, m_enUnitMeasure))
+ double dNewValue;
+ UnitMeasure enNewUnitMeasure;
+
+ if (!CUnitMeasureConverter::GetValue(wsValue, dNewValue, enNewUnitMeasure))
return false;
+ if (Percent == enNewUnitMeasure && !Empty() && unLevel > m_unLevel)
+ {
+ m_oValue *= dNewValue / 100.;
+ }
+ else
+ {
+ m_oValue = dNewValue;
+ m_enUnitMeasure = enNewUnitMeasure;
+ }
+
m_unLevel = unLevel;
m_bImportant = bImportant;
@@ -496,7 +511,7 @@ namespace NSCSS
bool CColor::SetValue(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
{
- if (((m_bImportant || unLevel < m_unLevel) && !bHardMode) || (wsValue.empty() && unLevel == m_unLevel))
+ if (wsValue.empty() || (CHECK_CONDITIONS && !bHardMode))
return false;
if (wsValue.empty())
@@ -698,7 +713,7 @@ namespace NSCSS
bool CMatrix::SetValue(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
{
- if (((m_bImportant || unLevel < m_unLevel) && !bHardMode) || (wsValue.empty() && unLevel == m_unLevel))
+ if ((CHECK_CONDITIONS && !bHardMode) || (wsValue.empty() && unLevel == m_unLevel))
return false;
std::wstring wsNewValue = wsValue;
@@ -2326,7 +2341,7 @@ namespace NSCSS
bool CEnum::SetValue(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
{
- if (wsValue.empty() || m_mMap.empty() || ((m_bImportant || unLevel < m_unLevel) && !bHardMode))
+ if (wsValue.empty() || m_mMap.empty() || (CHECK_CONDITIONS && !bHardMode))
return false;
std::wstring wsNewValue = wsValue;
diff --git a/DesktopEditor/raster/Metafile/svg/SvgObjects/CStyle.cpp b/DesktopEditor/raster/Metafile/svg/SvgObjects/CStyle.cpp
index b2cb524d02..b97f962637 100644
--- a/DesktopEditor/raster/Metafile/svg/SvgObjects/CStyle.cpp
+++ b/DesktopEditor/raster/Metafile/svg/SvgObjects/CStyle.cpp
@@ -179,12 +179,12 @@ namespace SVG
});
}
- pSvgObject->SetData(arSelectors[i].m_mAttributes, i + 1);
+ pSvgObject->SetData(arSelectors[i].m_wsStyle, i + 1, true);
for (const NSCSS::CElement* oElement : arFindElements)
pSvgObject->SetData(oElement->GetStyle(), i + 1);
- pSvgObject->SetData(arSelectors[i].m_wsStyle, i + 1, true);
+ pSvgObject->SetData(arSelectors[i].m_mAttributes, i + 1);
}
}
}