summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_cssstyleselector.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-23 15:37:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-24 13:59:50 +0000
commite73fea598f088151213fb11100798c615543ca2f (patch)
tree6d44f161ad24c7705443be0eed802fac5151f9f9 /xfa/fde/css/cfde_cssstyleselector.cpp
parent35a89dde15007d28c6796926708e8f0b5ee60d74 (diff)
downloadpdfium-e73fea598f088151213fb11100798c615543ca2f.tar.xz
Remove CSS Pseudo parsing
We always match against the pseudo type NONE when matching selectors, so we never end up using any pseudo selectors. This CL removes the pseudo selector parsing code. Change-Id: I7831d12dfff3a6f1dc98ff8e1d63c1090775562c Reviewed-on: https://pdfium-review.googlesource.com/2294 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssstyleselector.cpp')
-rw-r--r--xfa/fde/css/cfde_cssstyleselector.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/xfa/fde/css/cfde_cssstyleselector.cpp b/xfa/fde/css/cfde_cssstyleselector.cpp
index fb2a1e2fbb..c4156c4d49 100644
--- a/xfa/fde/css/cfde_cssstyleselector.cpp
+++ b/xfa/fde/css/cfde_cssstyleselector.cpp
@@ -77,8 +77,7 @@ void CFDE_CSSStyleSelector::UpdateStyleIndex() {
int32_t CFDE_CSSStyleSelector::MatchDeclarations(
CXFA_CSSTagProvider* pTag,
- CFX_ArrayTemplate<CFDE_CSSDeclaration*>& matchedDecls,
- FDE_CSSPseudo ePseudoType) {
+ CFX_ArrayTemplate<CFDE_CSSDeclaration*>& matchedDecls) {
ASSERT(pTag);
CFDE_CSSTagCache* pCache = m_pAccelerator->top();
ASSERT(pCache && pCache->GetTag() == pTag);
@@ -88,21 +87,15 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations(
if (m_UARules.CountSelectors() == 0)
return 0;
- if (ePseudoType == FDE_CSSPseudo::NONE) {
- MatchRules(pCache, m_UARules.GetUniversalRuleData(), ePseudoType);
- if (pCache->HashTag()) {
- MatchRules(pCache, m_UARules.GetTagRuleData(pCache->HashTag()),
- ePseudoType);
+ MatchRules(pCache, m_UARules.GetUniversalRuleData());
+ if (pCache->HashTag()) {
+ MatchRules(pCache, m_UARules.GetTagRuleData(pCache->HashTag()));
}
int32_t iCount = pCache->CountHashClass();
for (int32_t i = 0; i < iCount; i++) {
pCache->SetClassIndex(i);
- MatchRules(pCache, m_UARules.GetClassRuleData(pCache->HashClass()),
- ePseudoType);
+ MatchRules(pCache, m_UARules.GetClassRuleData(pCache->HashClass()));
}
- } else {
- MatchRules(pCache, m_UARules.GetPseudoRuleData(), ePseudoType);
- }
std::sort(m_MatchedRules.begin(), m_MatchedRules.end(),
[](const CFDE_CSSRuleCollection::Data* p1,
@@ -117,18 +110,16 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations(
}
void CFDE_CSSStyleSelector::MatchRules(CFDE_CSSTagCache* pCache,
- CFDE_CSSRuleCollection::Data* pList,
- FDE_CSSPseudo ePseudoType) {
+ CFDE_CSSRuleCollection::Data* pList) {
while (pList) {
- if (MatchSelector(pCache, pList->pSelector, ePseudoType))
+ if (MatchSelector(pCache, pList->pSelector))
m_MatchedRules.push_back(pList);
pList = pList->pNext;
}
}
bool CFDE_CSSStyleSelector::MatchSelector(CFDE_CSSTagCache* pCache,
- CFDE_CSSSelector* pSel,
- FDE_CSSPseudo ePseudoType) {
+ CFDE_CSSSelector* pSel) {
uint32_t dwHash;
while (pSel && pCache) {
switch (pSel->GetType()) {
@@ -138,7 +129,7 @@ bool CFDE_CSSStyleSelector::MatchSelector(CFDE_CSSTagCache* pCache,
if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) {
continue;
}
- if (MatchSelector(pCache, pSel->GetNextSelector(), ePseudoType)) {
+ if (MatchSelector(pCache, pSel->GetNextSelector())) {
return true;
}
}
@@ -161,12 +152,6 @@ bool CFDE_CSSStyleSelector::MatchSelector(CFDE_CSSTagCache* pCache,
return false;
}
break;
- case FDE_CSSSelectorType::Pseudo:
- dwHash = FDE_GetCSSPseudoByEnum(ePseudoType)->dwHash;
- if (dwHash != pSel->GetNameHash()) {
- return false;
- }
- break;
default:
ASSERT(false);
break;