diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-23 15:38:28 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-24 14:28:24 +0000 |
commit | 1339133720c3b8bce77e970b479ec179160f30b5 (patch) | |
tree | 5927042eab27eaa4a96cf4276dec54d3e8a44a23 /xfa/fde/css/cfde_cssstyleselector.cpp | |
parent | 3d328767f9c0c04b62173aac03c35aab3fb87ffe (diff) | |
download | pdfium-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_cssstyleselector.cpp')
-rw-r--r-- | xfa/fde/css/cfde_cssstyleselector.cpp | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/xfa/fde/css/cfde_cssstyleselector.cpp b/xfa/fde/css/cfde_cssstyleselector.cpp index c4156c4d49..b7275fca93 100644 --- a/xfa/fde/css/cfde_cssstyleselector.cpp +++ b/xfa/fde/css/cfde_cssstyleselector.cpp @@ -38,8 +38,6 @@ const T* ToValue(const CFDE_CSSValue* val) { } // namespace -#define FDE_CSSUNIVERSALHASH ('*') - CFDE_CSSStyleSelector::CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr) : m_pFontMgr(pFontMgr), m_fDefFontSize(12.0f) {} @@ -87,15 +85,8 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations( if (m_UARules.CountSelectors() == 0) return 0; - MatchRules(pCache, m_UARules.GetUniversalRuleData()); - if (pCache->HashTag()) { + 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())); - } std::sort(m_MatchedRules.begin(), m_MatchedRules.end(), [](const CFDE_CSSRuleCollection::Data* p1, @@ -126,31 +117,16 @@ bool CFDE_CSSStyleSelector::MatchSelector(CFDE_CSSTagCache* pCache, case FDE_CSSSelectorType::Descendant: dwHash = pSel->GetNameHash(); while ((pCache = pCache->GetParent()) != nullptr) { - if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { + if (dwHash != pCache->HashTag()) continue; - } - if (MatchSelector(pCache, pSel->GetNextSelector())) { + if (MatchSelector(pCache, pSel->GetNextSelector())) return true; - } } return false; - case FDE_CSSSelectorType::ID: - dwHash = pCache->HashID(); - if (dwHash != pSel->GetNameHash()) { - return false; - } - break; - case FDE_CSSSelectorType::Class: - dwHash = pCache->HashClass(); - if (dwHash != pSel->GetNameHash()) { - return false; - } - break; case FDE_CSSSelectorType::Element: dwHash = pSel->GetNameHash(); - if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { + if (dwHash != pCache->HashTag()) return false; - } break; default: ASSERT(false); |