diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-16 16:05:17 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-16 21:38:39 +0000 |
commit | 6efd0d7464e1f02ef3cd4f1abe5c6f8e5283fbbb (patch) | |
tree | b99dd792d1a36c1a0175dd89e18d95e286613ff3 /xfa/fde/css/fde_cssstylesheet.cpp | |
parent | cfb856c4744a9e0ff0f0db5602d0a13c835570ce (diff) | |
download | pdfium-6efd0d7464e1f02ef3cd4f1abe5c6f8e5283fbbb.tar.xz |
Replace remaining CSS interfaces with concrete classes
This Cl moves IFDE_CSSValue and IFDE_CSSRule to concrete classes and moves the
holding of the type into the base class.
Change-Id: Iea29cc55256dd2183b60ca8711367d5dc8daaa24
Reviewed-on: https://pdfium-review.googlesource.com/2178
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/fde_cssstylesheet.cpp')
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index a3783c3756..a5ac0c07cc 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -27,7 +27,7 @@ CFDE_CSSStyleSheet::~CFDE_CSSStyleSheet() { void CFDE_CSSStyleSheet::Reset() { for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) { - IFDE_CSSRule* pRule = m_RuleArray.GetAt(i); + CFDE_CSSRule* pRule = m_RuleArray.GetAt(i); switch (pRule->GetType()) { case FDE_CSSRuleType::Style: static_cast<CFDE_CSSStyleRule*>(pRule)->~CFDE_CSSStyleRule(); @@ -76,7 +76,7 @@ int32_t CFDE_CSSStyleSheet::CountRules() const { return m_RuleArray.GetSize(); } -IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { +CFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } @@ -164,7 +164,7 @@ FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadMediaRule( FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadStyleRule( CFDE_CSSSyntaxParser* pSyntax, - CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray) { + CFX_MassArrayTemplate<CFDE_CSSRule*>& ruleArray) { m_Selectors.RemoveAt(0, m_Selectors.GetSize()); CFDE_CSSStyleRule* pStyleRule = nullptr; const FX_WCHAR* pszValue = nullptr; @@ -232,7 +232,7 @@ FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadStyleRule( FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadFontFaceRule( CFDE_CSSSyntaxParser* pSyntax, - CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray) { + CFX_MassArrayTemplate<CFDE_CSSRule*>& ruleArray) { CFDE_CSSFontFaceRule* pFontFaceRule = nullptr; const FX_WCHAR* pszValue = nullptr; int32_t iValueLen = 0; @@ -315,11 +315,9 @@ FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::SkipRuleSet( } CFDE_CSSStyleRule::CFDE_CSSStyleRule() - : m_ppSelector(nullptr), m_iSelectors(0) {} - -FDE_CSSRuleType CFDE_CSSStyleRule::GetType() const { - return FDE_CSSRuleType::Style; -} + : CFDE_CSSRule(FDE_CSSRuleType::Style), + m_ppSelector(nullptr), + m_iSelectors(0) {} int32_t CFDE_CSSStyleRule::CountSelectorLists() const { return m_iSelectors; @@ -345,11 +343,13 @@ void CFDE_CSSStyleRule::SetSelector( } CFDE_CSSMediaRule::CFDE_CSSMediaRule(uint32_t dwMediaList) - : m_dwMediaList(dwMediaList), m_RuleArray(100) {} + : CFDE_CSSRule(FDE_CSSRuleType::Media), + m_dwMediaList(dwMediaList), + m_RuleArray(100) {} CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) { - IFDE_CSSRule* pRule = m_RuleArray.GetAt(i); + CFDE_CSSRule* pRule = m_RuleArray.GetAt(i); switch (pRule->GetType()) { case FDE_CSSRuleType::Style: static_cast<CFDE_CSSStyleRule*>(pRule)->~CFDE_CSSStyleRule(); @@ -361,10 +361,6 @@ CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { } } -FDE_CSSRuleType CFDE_CSSMediaRule::GetType() const { - return FDE_CSSRuleType::Media; -} - uint32_t CFDE_CSSMediaRule::GetMediaList() const { return m_dwMediaList; } @@ -373,7 +369,7 @@ int32_t CFDE_CSSMediaRule::CountRules() const { return m_RuleArray.GetSize(); } -IFDE_CSSRule* CFDE_CSSMediaRule::GetRule(int32_t index) { +CFDE_CSSRule* CFDE_CSSMediaRule::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } @@ -524,6 +520,7 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( return pPseudoFirst; } -FDE_CSSRuleType CFDE_CSSFontFaceRule::GetType() const { - return FDE_CSSRuleType::FontFace; -} +CFDE_CSSFontFaceRule::CFDE_CSSFontFaceRule() + : CFDE_CSSRule(FDE_CSSRuleType::FontFace) {} + +CFDE_CSSFontFaceRule::~CFDE_CSSFontFaceRule() {} |