summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_cssrulecollection.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-23 15:38:28 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-24 14:28:24 +0000
commit1339133720c3b8bce77e970b479ec179160f30b5 (patch)
tree5927042eab27eaa4a96cf4276dec54d3e8a44a23 /xfa/fde/css/cfde_cssrulecollection.cpp
parent3d328767f9c0c04b62173aac03c35aab3fb87ffe (diff)
downloadpdfium-1339133720c3b8bce77e970b479ec179160f30b5.tar.xz
Remove ID, Class and Universal selector code
The UA style defined in CXFA_TextParser does not specify any ID, Class or Universal selectors. Remove related code. Change-Id: I9f2d760ee86f309a9cfa8a0f1f3e3dd7a15ef4c8 Reviewed-on: https://pdfium-review.googlesource.com/2295 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssrulecollection.cpp')
-rw-r--r--xfa/fde/css/cfde_cssrulecollection.cpp40
1 files changed, 3 insertions, 37 deletions
diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp
index db3342cfc6..c140c8e682 100644
--- a/xfa/fde/css/cfde_cssrulecollection.cpp
+++ b/xfa/fde/css/cfde_cssrulecollection.cpp
@@ -17,18 +17,12 @@
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/cfde_csstagcache.h"
-#define FDE_CSSUNIVERSALHASH ('*')
-
void CFDE_CSSRuleCollection::Clear() {
- m_IDRules.clear();
m_TagRules.clear();
- m_ClassRules.clear();
- m_pUniversalRules = nullptr;
m_iSelectors = 0;
}
-CFDE_CSSRuleCollection::CFDE_CSSRuleCollection()
- : m_pUniversalRules(nullptr), m_iSelectors(0) {}
+CFDE_CSSRuleCollection::CFDE_CSSRuleCollection() : m_iSelectors(0) {}
CFDE_CSSRuleCollection::~CFDE_CSSRuleCollection() {
Clear();
@@ -48,31 +42,7 @@ void CFDE_CSSRuleCollection::AddRulesFrom(const CFDE_CSSStyleSheet* pStyleSheet,
int32_t iSelectors = pStyleRule->CountSelectorLists();
for (int32_t i = 0; i < iSelectors; ++i) {
CFDE_CSSSelector* pSelector = pStyleRule->GetSelectorList(i);
- if (pSelector->GetNameHash() != FDE_CSSUNIVERSALHASH) {
- AddRuleTo(&m_TagRules, pSelector->GetNameHash(), pSelector, pDeclaration);
- continue;
- }
- CFDE_CSSSelector* pNext = pSelector->GetNextSelector();
- if (!pNext) {
- Data* pData = NewRuleData(pSelector, pDeclaration);
- AddRuleTo(&m_pUniversalRules, pData);
- continue;
- }
- switch (pNext->GetType()) {
- case FDE_CSSSelectorType::ID:
- AddRuleTo(&m_IDRules, pNext->GetNameHash(), pSelector, pDeclaration);
- break;
- case FDE_CSSSelectorType::Class:
- AddRuleTo(&m_ClassRules, pNext->GetNameHash(), pSelector, pDeclaration);
- break;
- case FDE_CSSSelectorType::Descendant:
- case FDE_CSSSelectorType::Element:
- AddRuleTo(&m_pUniversalRules, NewRuleData(pSelector, pDeclaration));
- break;
- default:
- ASSERT(false);
- break;
- }
+ AddRuleTo(&m_TagRules, pSelector->GetNameHash(), pSelector, pDeclaration);
}
}
@@ -112,10 +82,6 @@ CFDE_CSSRuleCollection::Data::Data(CFDE_CSSSelector* pSel,
static const uint32_t s_Specific[5] = {0x00010000, 0x00010000, 0x00100000,
0x00100000, 0x01000000};
for (; pSel; pSel = pSel->GetNextSelector()) {
- FDE_CSSSelectorType eType = pSel->GetType();
- if (eType > FDE_CSSSelectorType::Descendant ||
- pSel->GetNameHash() != FDE_CSSUNIVERSALHASH) {
- dwPriority += s_Specific[static_cast<int>(eType)];
- }
+ dwPriority += s_Specific[static_cast<int>(pSel->GetType())];
}
}