diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-23 15:37:39 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-24 13:59:50 +0000 |
commit | e73fea598f088151213fb11100798c615543ca2f (patch) | |
tree | 6d44f161ad24c7705443be0eed802fac5151f9f9 /xfa/fde/css/cfde_cssselector.cpp | |
parent | 35a89dde15007d28c6796926708e8f0b5ee60d74 (diff) | |
download | pdfium-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_cssselector.cpp')
-rw-r--r-- | xfa/fde/css/cfde_cssselector.cpp | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp index 4d32bd1cfa..bd800c0fa5 100644 --- a/xfa/fde/css/cfde_cssselector.cpp +++ b/xfa/fde/css/cfde_cssselector.cpp @@ -16,19 +16,6 @@ bool IsCSSChar(FX_WCHAR wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } -int32_t GetCSSPseudoLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { - ASSERT(*psz == ':'); - const FX_WCHAR* pStart = psz; - while (psz < pEnd) { - FX_WCHAR wch = *psz; - if (IsCSSChar(wch) || wch == ':') - ++psz; - else - break; - } - return psz - pStart; -} - int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { const FX_WCHAR* pStart = psz; while (psz < pEnd) { @@ -88,8 +75,6 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( std::unique_ptr<CFDE_CSSSelector> pFirst = nullptr; CFDE_CSSSelector* pLast = nullptr; - std::unique_ptr<CFDE_CSSSelector> pPseudoFirst = nullptr; - CFDE_CSSSelector* pPseudoLast = nullptr; for (psz = pStart; psz < pEnd;) { FX_WCHAR wch = *psz; @@ -134,29 +119,11 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( pFirst = std::move(p); pLast = pFirst.get(); psz += iNameLen; - } else if (wch == ':') { - int32_t iNameLen = GetCSSPseudoLen(psz, pEnd); - if (iNameLen == 0) - return nullptr; - - auto p = pdfium::MakeUnique<CFDE_CSSSelector>(FDE_CSSSelectorType::Pseudo, - psz, iNameLen, true); - CFDE_CSSSelector* ptr = p.get(); - if (pPseudoFirst) - pPseudoLast->SetNext(std::move(p)); - else - pPseudoFirst = std::move(p); - pPseudoLast = ptr; - psz += iNameLen; } else if (wch == ' ') { psz++; } else { return nullptr; } } - if (!pPseudoFirst) - return pFirst; - - pPseudoLast->SetNext(std::move(pFirst)); - return pPseudoFirst; + return pFirst; } |