diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-21 13:37:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-21 13:37:10 -0700 |
commit | bc1cbabe8d8bfa74d25160c14afa30d5b40df335 (patch) | |
tree | bc8ba8fbf303f863ca62d71f0bad013bd622309a /xfa/fde/css/fde_csscache.cpp | |
parent | 5d9da0c1255a75dd9b7b2005f8b7d6ae4948feaf (diff) | |
download | pdfium-bc1cbabe8d8bfa74d25160c14afa30d5b40df335.tar.xz |
Remove IFDE_CSSTagProvider.
There is only one subsclass, use that instead. Remove the use of WideStringC
in the API.
BUG=pdfium:468
Review URL: https://codereview.chromium.org/1911843002
Diffstat (limited to 'xfa/fde/css/fde_csscache.cpp')
-rw-r--r-- | xfa/fde/css/fde_csscache.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp index 511c69798b..e23b4c6377 100644 --- a/xfa/fde/css/fde_csscache.cpp +++ b/xfa/fde/css/fde_csscache.cpp @@ -9,35 +9,40 @@ #include <algorithm> #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/app/xfa_textlayout.h" FDE_CSSCacheItem::FDE_CSSCacheItem(IFDE_CSSStyleSheet* p) : pStylesheet(p), dwActivity(0) { FXSYS_assert(pStylesheet); pStylesheet->AddRef(); } + FDE_CSSCacheItem::~FDE_CSSCacheItem() { pStylesheet->Release(); } FDE_CSSTagCache::FDE_CSSTagCache(FDE_CSSTagCache* parent, - IFDE_CSSTagProvider* tag) + CXFA_CSSTagProvider* tag) : pTag(tag), pParent(parent), dwIDHash(0), dwTagHash(0), iClassIndex(0), dwClassHashs(1) { - FXSYS_assert(pTag != NULL); - CFX_WideStringC wsValue, wsName = pTag->GetTagName(); - dwTagHash = FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength(), TRUE); - FX_POSITION pos = pTag->GetFirstAttribute(); - while (pos != NULL) { - pTag->GetNextAttribute(pos, wsName, wsValue); + static const uint32_t s_dwIDHash = FX_HashCode_String_GetW(L"id", 2, TRUE); + static const uint32_t s_dwClassHash = + FX_HashCode_String_GetW(L"class", 5, TRUE); + + CFX_WideString wsTag = pTag->GetTagName(); + dwTagHash = FX_HashCode_String_GetW(wsTag.c_str(), wsTag.GetLength(), TRUE); + + for (auto it : *pTag) { + CFX_WideString wsValue = it.first; + CFX_WideString wsName = it.second; + uint32_t dwNameHash = FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength(), TRUE); - static const uint32_t s_dwIDHash = FX_HashCode_String_GetW(L"id", 2, TRUE); - static const uint32_t s_dwClassHash = - FX_HashCode_String_GetW(L"class", 5, TRUE); + if (dwNameHash == s_dwClassHash) { uint32_t dwHash = FX_HashCode_String_GetW(wsValue.c_str(), wsValue.GetLength()); @@ -47,6 +52,7 @@ FDE_CSSTagCache::FDE_CSSTagCache(FDE_CSSTagCache* parent, } } } + FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it) : pTag(it.pTag), pParent(it.pParent), @@ -54,16 +60,17 @@ FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it) dwTagHash(it.dwTagHash), iClassIndex(0), dwClassHashs(1) { - if (it.dwClassHashs.GetSize() > 0) { + if (it.dwClassHashs.GetSize() > 0) dwClassHashs.Copy(it.dwClassHashs); - } } -void CFDE_CSSAccelerator::OnEnterTag(IFDE_CSSTagProvider* pTag) { + +void CFDE_CSSAccelerator::OnEnterTag(CXFA_CSSTagProvider* pTag) { FDE_CSSTagCache* pTop = GetTopElement(); FDE_CSSTagCache item(pTop, pTag); m_Stack.Push(item); } -void CFDE_CSSAccelerator::OnLeaveTag(IFDE_CSSTagProvider* pTag) { + +void CFDE_CSSAccelerator::OnLeaveTag(CXFA_CSSTagProvider* pTag) { FXSYS_assert(m_Stack.GetTopElement()); FXSYS_assert(m_Stack.GetTopElement()->GetTag() == pTag); m_Stack.Pop(); |