summaryrefslogtreecommitdiff
path: root/xfa/fde/css
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/css')
-rw-r--r--xfa/fde/css/fde_css.h2
-rw-r--r--xfa/fde/css/fde_csscache.cpp4
-rw-r--r--xfa/fde/css/fde_csscache.h5
-rw-r--r--xfa/fde/css/fde_cssstylesheet.cpp16
-rw-r--r--xfa/fde/css/fde_cssstylesheet.h22
-rw-r--r--xfa/fde/css/fde_csssyntax.cpp5
6 files changed, 28 insertions, 26 deletions
diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h
index a0ede3d9f7..74a0ef609a 100644
--- a/xfa/fde/css/fde_css.h
+++ b/xfa/fde/css/fde_css.h
@@ -718,8 +718,6 @@ class IFDE_CSSRule {
virtual FDE_CSSRULETYPE GetType() const = 0;
};
-typedef CFX_MassArrayTemplate<IFDE_CSSRule*> CFDE_CSSRuleArray;
-
class IFDE_CSSStyleRule : public IFDE_CSSRule {
public:
// IFDE_CSSValue
diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp
index a355a43c61..2343c993a2 100644
--- a/xfa/fde/css/fde_csscache.cpp
+++ b/xfa/fde/css/fde_csscache.cpp
@@ -53,12 +53,12 @@ FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it)
iClassIndex(0),
dwClassHashs(1) {
if (it.dwClassHashs.GetSize() > 0)
- dwClassHashs.Copy(it.dwClassHashs);
+ dwClassHashs.Copy(it.dwClassHashs, 0, -1);
}
FDE_CSSTagCache::~FDE_CSSTagCache() {}
-CFDE_CSSAccelerator::CFDE_CSSAccelerator() {}
+CFDE_CSSAccelerator::CFDE_CSSAccelerator() : m_Stack(100) {}
CFDE_CSSAccelerator::~CFDE_CSSAccelerator() {}
diff --git a/xfa/fde/css/fde_csscache.h b/xfa/fde/css/fde_csscache.h
index bab86ea880..8f4f2a78c7 100644
--- a/xfa/fde/css/fde_csscache.h
+++ b/xfa/fde/css/fde_csscache.h
@@ -49,7 +49,6 @@ class FDE_CSSTagCache : public CFX_Target {
int32_t iClassIndex;
CFX_BaseArrayTemplate<uint32_t> dwClassHashs;
};
-typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack;
class CFDE_CSSAccelerator : public CFX_Target {
public:
@@ -59,12 +58,12 @@ class CFDE_CSSAccelerator : public CFX_Target {
void OnEnterTag(CXFA_CSSTagProvider* pTag);
void OnLeaveTag(CXFA_CSSTagProvider* pTag);
- void Clear() { m_Stack.RemoveAll(); }
+ void Clear() { m_Stack.RemoveAll(FALSE); }
FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); }
protected:
- CFDE_CSSTagStack m_Stack;
+ CFX_ObjectStackTemplate<FDE_CSSTagCache> m_Stack;
};
#endif // XFA_FDE_CSS_FDE_CSSCACHE_H_
diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp
index 87137c4259..99beab8cf6 100644
--- a/xfa/fde/css/fde_cssstylesheet.cpp
+++ b/xfa/fde/css/fde_cssstylesheet.cpp
@@ -78,7 +78,8 @@ CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(uint32_t dwMediaList)
: m_wCodePage(FX_CODEPAGE_UTF8),
m_wRefCount(1),
m_dwMediaList(dwMediaList),
- m_pAllocator(nullptr) {
+ m_pAllocator(nullptr),
+ m_RuleArray(100) {
ASSERT(m_dwMediaList > 0);
}
@@ -104,7 +105,7 @@ void CFDE_CSSStyleSheet::Reset() {
break;
}
}
- m_RuleArray.RemoveAll();
+ m_RuleArray.RemoveAll(FALSE);
m_Selectors.RemoveAll();
m_StringCache.clear();
delete m_pAllocator;
@@ -241,7 +242,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule(
FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
CFDE_CSSSyntaxParser* pSyntax,
- CFDE_CSSRuleArray& ruleArray) {
+ CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray) {
m_Selectors.RemoveAt(0, m_Selectors.GetSize());
CFDE_CSSStyleRule* pStyleRule = nullptr;
const FX_WCHAR* pszValue = nullptr;
@@ -306,7 +307,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule(
CFDE_CSSSyntaxParser* pSyntax,
- CFDE_CSSRuleArray& ruleArray) {
+ CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray) {
CFDE_CSSFontFaceRule* pFontFaceRule = nullptr;
const FX_WCHAR* pszValue = nullptr;
int32_t iValueLen = 0;
@@ -392,8 +393,9 @@ CFDE_CSSDeclaration* CFDE_CSSStyleRule::GetDeclaration() {
return &m_Declaration;
}
-void CFDE_CSSStyleRule::SetSelector(IFX_MemoryAllocator* pStaticStore,
- const CFDE_CSSSelectorArray& list) {
+void CFDE_CSSStyleRule::SetSelector(
+ IFX_MemoryAllocator* pStaticStore,
+ const CFX_ArrayTemplate<CFDE_CSSSelector*>& list) {
ASSERT(!m_ppSelector);
m_iSelectors = list.GetSize();
m_ppSelector = static_cast<CFDE_CSSSelector**>(
@@ -404,7 +406,7 @@ void CFDE_CSSStyleRule::SetSelector(IFX_MemoryAllocator* pStaticStore,
}
CFDE_CSSMediaRule::CFDE_CSSMediaRule(uint32_t dwMediaList)
- : m_dwMediaList(dwMediaList) {}
+ : m_dwMediaList(dwMediaList), m_RuleArray(100) {}
CFDE_CSSMediaRule::~CFDE_CSSMediaRule() {
for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) {
diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h
index 83eac993e7..d4781f8a8d 100644
--- a/xfa/fde/css/fde_cssstylesheet.h
+++ b/xfa/fde/css/fde_cssstylesheet.h
@@ -39,8 +39,6 @@ class CFDE_CSSSelector : public CFX_Target {
CFDE_CSSSelector* m_pNext;
};
-typedef CFX_ArrayTemplate<CFDE_CSSSelector*> CFDE_CSSSelectorArray;
-
class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target {
public:
CFDE_CSSStyleRule();
@@ -52,7 +50,7 @@ class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target {
CFDE_CSSDeclaration& GetDeclImp() { return m_Declaration; }
void SetSelector(IFX_MemoryAllocator* pStaticStore,
- const CFDE_CSSSelectorArray& list);
+ const CFX_ArrayTemplate<CFDE_CSSSelector*>& list);
protected:
CFDE_CSSDeclaration m_Declaration;
@@ -70,11 +68,11 @@ class CFDE_CSSMediaRule : public IFDE_CSSMediaRule, public CFX_Target {
int32_t CountRules() const override;
IFDE_CSSRule* GetRule(int32_t index) override;
- CFDE_CSSRuleArray& GetArray() { return m_RuleArray; }
+ CFX_MassArrayTemplate<IFDE_CSSRule*>& GetArray() { return m_RuleArray; }
protected:
uint32_t m_dwMediaList;
- CFDE_CSSRuleArray m_RuleArray;
+ CFX_MassArrayTemplate<IFDE_CSSRule*> m_RuleArray;
};
class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule, public CFX_Target {
@@ -122,21 +120,23 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target {
protected:
void Reset();
FX_BOOL LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax);
- FDE_CSSSYNTAXSTATUS LoadStyleRule(CFDE_CSSSyntaxParser* pSyntax,
- CFDE_CSSRuleArray& ruleArray);
+ FDE_CSSSYNTAXSTATUS LoadStyleRule(
+ CFDE_CSSSyntaxParser* pSyntax,
+ CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray);
FDE_CSSSYNTAXSTATUS LoadImportRule(CFDE_CSSSyntaxParser* pSyntax);
FDE_CSSSYNTAXSTATUS LoadPageRule(CFDE_CSSSyntaxParser* pSyntax);
FDE_CSSSYNTAXSTATUS LoadMediaRule(CFDE_CSSSyntaxParser* pSyntax);
- FDE_CSSSYNTAXSTATUS LoadFontFaceRule(CFDE_CSSSyntaxParser* pSyntax,
- CFDE_CSSRuleArray& ruleArray);
+ FDE_CSSSYNTAXSTATUS LoadFontFaceRule(
+ CFDE_CSSSyntaxParser* pSyntax,
+ CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray);
FDE_CSSSYNTAXSTATUS SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax);
uint16_t m_wCodePage;
uint16_t m_wRefCount;
uint32_t m_dwMediaList;
IFX_MemoryAllocator* m_pAllocator;
- CFDE_CSSRuleArray m_RuleArray;
+ CFX_MassArrayTemplate<IFDE_CSSRule*> m_RuleArray;
CFX_WideString m_szUrl;
- CFDE_CSSSelectorArray m_Selectors;
+ CFX_ArrayTemplate<CFDE_CSSSelector*> m_Selectors;
std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache;
};
diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp
index 4595396c13..c2b0265a6e 100644
--- a/xfa/fde/css/fde_csssyntax.cpp
+++ b/xfa/fde/css/fde_csssyntax.cpp
@@ -25,11 +25,14 @@ CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser()
m_iTextDatLen(0),
m_dwCheck((uint32_t)-1),
m_eMode(FDE_CSSSYNTAXMODE_RuleSet),
- m_eStatus(FDE_CSSSYNTAXSTATUS_None) {}
+ m_eStatus(FDE_CSSSYNTAXSTATUS_None),
+ m_ModeStack(100) {}
+
CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() {
m_TextData.Reset();
m_TextPlane.Reset();
}
+
FX_BOOL CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream,
int32_t iCSSPlaneSize,
int32_t iTextDataSize,