diff --git a/Common/3dParty/html/css/src/CCompiledStyle.cpp b/Common/3dParty/html/css/src/CCompiledStyle.cpp index aff4f9c69f..3340ba64bc 100644 --- a/Common/3dParty/html/css/src/CCompiledStyle.cpp +++ b/Common/3dParty/html/css/src/CCompiledStyle.cpp @@ -444,6 +444,11 @@ namespace NSCSS m_oDisplay.SetVAlign(pPropertie.second, unLevel, bHardMode); break; } + CASE(L"white-space"): + { + m_oDisplay.SetWhiteSpace(pPropertie.second, unLevel, bHardMode); + break; + } //TRANSFORM CASE(L"transform"): { diff --git a/Common/3dParty/html/css/src/CCssCalculator_Private.cpp b/Common/3dParty/html/css/src/CCssCalculator_Private.cpp index c15e55a36d..df8064ab50 100644 --- a/Common/3dParty/html/css/src/CCssCalculator_Private.cpp +++ b/Common/3dParty/html/css/src/CCssCalculator_Private.cpp @@ -692,6 +692,16 @@ namespace NSCSS FindPrevAndKindElements(pFoundName, arNextNodes, arFindedElements, wsName, arClasses); } + const CElement* pFoundAll = m_oStyleStorage.FindElement(L"*"); + + if (nullptr != pFoundAll) + { + if (!pFoundAll->Empty()) + arFindedElements.push_back(pFoundAll); + + FindPrevAndKindElements(pFoundAll, arNextNodes, arFindedElements, wsName, arClasses); + } + if (arFindedElements.size() > 1) { std::sort(arFindedElements.rbegin(), arFindedElements.rend(), diff --git a/Common/3dParty/html/css/src/StyleProperties.cpp b/Common/3dParty/html/css/src/StyleProperties.cpp index f94118dbd8..111cba1147 100644 --- a/Common/3dParty/html/css/src/StyleProperties.cpp +++ b/Common/3dParty/html/css/src/StyleProperties.cpp @@ -1328,7 +1328,14 @@ namespace NSCSS // DISPLAY CDisplay::CDisplay() - {} + { + m_eWhiteSpace.SetMapping({{L"normal", EWhiteSpace::Normal }, + {L"nowrap", EWhiteSpace::Nowrap }, + {L"pre", EWhiteSpace::Pre }, + {L"pre-line", EWhiteSpace::Pre_Line}, + {L"pre-wrap", EWhiteSpace::Pre_Wrap}}, + EWhiteSpace::Normal); + } void CDisplay::Equation(CDisplay &oFirstDisplay, CDisplay &oSecondDisplay) { @@ -1341,6 +1348,8 @@ namespace NSCSS CString::Equation(oFirstDisplay.m_oHAlign, oSecondDisplay.m_oHAlign); CString::Equation(oFirstDisplay.m_oDisplay, oSecondDisplay.m_oDisplay); + + CEnum::Equation(oFirstDisplay.m_eWhiteSpace, oSecondDisplay.m_eWhiteSpace); } bool CDisplay::SetX(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode) @@ -1404,6 +1413,11 @@ namespace NSCSS return m_oDisplay.SetValue(wsValue, NSConstValues::DISPLAY_VALUES, unLevel, bHardMode); } + bool CDisplay::SetWhiteSpace(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) + { + return m_eWhiteSpace.SetValue(wsValue, unLevel, bHardMode); + } + const CDigit& CDisplay::GetX() const { return m_oX; @@ -1439,34 +1453,42 @@ namespace NSCSS return m_oDisplay; } + const CEnum& CDisplay::GetWhiteSpace() const + { + return m_eWhiteSpace; + } + bool CDisplay::Empty() const { return m_oX.Empty() && m_oY.Empty() && m_oWidth.Empty() && m_oHeight.Empty() && - m_oHeight.Empty() && m_oVAlign.Empty() && m_oDisplay.Empty(); + m_oHeight.Empty() && m_oVAlign.Empty() && m_oDisplay.Empty() && + (m_eWhiteSpace.Empty() || m_eWhiteSpace == EWhiteSpace::Normal); } CDisplay &CDisplay::operator+=(const CDisplay &oDisplay) { - m_oX += oDisplay.m_oX; - m_oY += oDisplay.m_oY; - m_oWidth = oDisplay.m_oWidth; - m_oHeight = oDisplay.m_oHeight; - m_oHAlign += oDisplay.m_oHAlign; - m_oVAlign += oDisplay.m_oVAlign; - m_oDisplay += oDisplay.m_oDisplay; + m_oX += oDisplay.m_oX; + m_oY += oDisplay.m_oY; + m_oWidth = oDisplay.m_oWidth; + m_oHeight = oDisplay.m_oHeight; + m_oHAlign += oDisplay.m_oHAlign; + m_oVAlign += oDisplay.m_oVAlign; + m_oDisplay += oDisplay.m_oDisplay; + m_eWhiteSpace += oDisplay.m_eWhiteSpace; return *this; } bool CDisplay::operator==(const CDisplay &oDisplay) const { - return m_oX == oDisplay.m_oX && - m_oY == oDisplay.m_oY && - m_oWidth == oDisplay.m_oWidth && - m_oHeight == oDisplay.m_oHeight && - m_oHAlign == oDisplay.m_oHAlign && - m_oVAlign == oDisplay.m_oVAlign && - m_oDisplay == oDisplay.m_oDisplay; + return m_oX == oDisplay.m_oX && + m_oY == oDisplay.m_oY && + m_oWidth == oDisplay.m_oWidth && + m_oHeight == oDisplay.m_oHeight && + m_oHAlign == oDisplay.m_oHAlign && + m_oVAlign == oDisplay.m_oVAlign && + m_oDisplay == oDisplay.m_oDisplay && + m_eWhiteSpace == oDisplay.m_eWhiteSpace.ToInt(); } // STROKE diff --git a/Common/3dParty/html/css/src/StyleProperties.h b/Common/3dParty/html/css/src/StyleProperties.h index 2fa1ce1935..e85c6980e8 100644 --- a/Common/3dParty/html/css/src/StyleProperties.h +++ b/Common/3dParty/html/css/src/StyleProperties.h @@ -328,6 +328,15 @@ namespace NSCSS }; // PROPERTIES + typedef enum + { + Normal, + Nowrap, + Pre, + Pre_Line, + Pre_Wrap + } EWhiteSpace; + class CDisplay { public: @@ -347,6 +356,8 @@ namespace NSCSS bool SetDisplay(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false); + bool SetWhiteSpace(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false); + const CDigit& GetX() const; const CDigit& GetY() const; const CDigit& GetWidth() const; @@ -357,6 +368,8 @@ namespace NSCSS const CString& GetDisplay() const; + const CEnum& GetWhiteSpace() const; + bool Empty() const; CDisplay& operator+=(const CDisplay& oDisplay); @@ -371,6 +384,8 @@ namespace NSCSS CString m_oVAlign; CString m_oDisplay; + + CEnum m_eWhiteSpace; }; class CStroke diff --git a/Common/3dParty/md/md2html.cpp b/Common/3dParty/md/md2html.cpp index 4a243e6c87..d3be666e7f 100644 --- a/Common/3dParty/md/md2html.cpp +++ b/Common/3dParty/md/md2html.cpp @@ -29,7 +29,7 @@ void WriteBaseHtmlStyles(NSFile::CFileBinary& oFile) oFile.WriteStringUTF8(L"