diff --git a/Common/3dParty/html/css/src/CCompiledStyle.cpp b/Common/3dParty/html/css/src/CCompiledStyle.cpp
index e86d3404cc..3340ba64bc 100644
--- a/Common/3dParty/html/css/src/CCompiledStyle.cpp
+++ b/Common/3dParty/html/css/src/CCompiledStyle.cpp
@@ -12,7 +12,7 @@
#include "StaticFunctions.h"
#include "ConstValues.h"
-#define DEFAULT_FONT_SIZE 14
+#define DEFAULT_FONT_SIZE 12
namespace NSCSS
{
@@ -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.cpp b/Common/3dParty/html/css/src/CCssCalculator.cpp
index 8459444250..99f5d65e05 100644
--- a/Common/3dParty/html/css/src/CCssCalculator.cpp
+++ b/Common/3dParty/html/css/src/CCssCalculator.cpp
@@ -58,6 +58,11 @@ namespace NSCSS
return m_pInternal->GetDpi();
}
+ bool CCssCalculator::HaveStylesById(const std::wstring& wsId) const
+ {
+ return m_pInternal->HaveStylesById(wsId);
+ }
+
void CCssCalculator::ClearPageData()
{
m_pInternal->ClearPageData();
diff --git a/Common/3dParty/html/css/src/CCssCalculator.h b/Common/3dParty/html/css/src/CCssCalculator.h
index 678095428b..5047193e6e 100644
--- a/Common/3dParty/html/css/src/CCssCalculator.h
+++ b/Common/3dParty/html/css/src/CCssCalculator.h
@@ -32,6 +32,8 @@ namespace NSCSS
std::wstring GetEncoding() const;
unsigned short int GetDpi() const;
+ bool HaveStylesById(const std::wstring& wsId) const;
+
void ClearPageData();
void ClearEmbeddedStyles();
void ClearAllowedStyleFiles();
diff --git a/Common/3dParty/html/css/src/CCssCalculator_Private.cpp b/Common/3dParty/html/css/src/CCssCalculator_Private.cpp
index 45017aa9f9..3223e8f34f 100644
--- a/Common/3dParty/html/css/src/CCssCalculator_Private.cpp
+++ b/Common/3dParty/html/css/src/CCssCalculator_Private.cpp
@@ -184,7 +184,7 @@ namespace NSCSS
}
#endif
- const CElement* CStyleStorage::FindElement(const std::wstring& wsSelector)
+ const CElement* CStyleStorage::FindElement(const std::wstring& wsSelector) const
{
if (wsSelector.empty())
return nullptr;
@@ -470,7 +470,7 @@ namespace NSCSS
}
}
- const CElement* CStyleStorage::FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map& mStyleData)
+ const CElement* CStyleStorage::FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map& mStyleData) const
{
std::map::const_iterator itFound = mStyleData.find(wsSelector);
@@ -491,6 +491,21 @@ namespace NSCSS
if (arSelectors.empty())
return false;
+ if (L"#text" == arSelectors.back().m_wsName)
+ {
+ if (arSelectors.size() > 1 && arSelectors.back().m_pCompiledStyle->Empty())
+ *arSelectors.back().m_pCompiledStyle += *(arSelectors.end() - 2)->m_pCompiledStyle;
+
+ if(arSelectors.crend() != std::find_if(arSelectors.crbegin(), arSelectors.crend(),
+ [](const CNode& oNode){ return IsTableElement(oNode.m_wsName); }))
+ {
+ arSelectors.back().m_pCompiledStyle->m_oBackground.Clear();
+ arSelectors.back().m_pCompiledStyle->m_oBorder.Clear();
+ }
+
+ return true;
+ }
+
const std::map, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
if (oItem != m_mUsedStyles.end())
@@ -692,6 +707,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(),
@@ -765,6 +790,11 @@ namespace NSCSS
return m_nDpi;
}
+ bool CCssCalculator_Private::HaveStylesById(const std::wstring& wsId) const
+ {
+ return nullptr != m_oStyleStorage.FindElement(L'#' + wsId);
+ }
+
void CCssCalculator_Private::ClearEmbeddedStyles()
{
m_oStyleStorage.ClearEmbeddedStyles();
diff --git a/Common/3dParty/html/css/src/CCssCalculator_Private.h b/Common/3dParty/html/css/src/CCssCalculator_Private.h
index 814e7228cd..f57c97a189 100644
--- a/Common/3dParty/html/css/src/CCssCalculator_Private.h
+++ b/Common/3dParty/html/css/src/CCssCalculator_Private.h
@@ -37,7 +37,7 @@ namespace NSCSS
void ClearPageData();
#endif
- const CElement* FindElement(const std::wstring& wsSelector);
+ const CElement* FindElement(const std::wstring& wsSelector) const;
private:
typedef struct
{
@@ -77,7 +77,7 @@ namespace NSCSS
void GetOutputData(KatanaOutput* oOutput, std::map& mStyleData);
- const CElement* FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map& mStyleData);
+ const CElement* FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map& mStyleData) const;
};
class CCssCalculator_Private
@@ -122,6 +122,8 @@ namespace NSCSS
std::wstring GetEncoding() const;
unsigned short int GetDpi() const;
+ bool HaveStylesById(const std::wstring& wsId) const;
+
void ClearEmbeddedStyles();
void ClearAllowedStyleFiles();
void ClearStylesFromFile(const std::wstring& wsFilePath);
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 84a0511418..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"