Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: xfa/fde/css/fde_csscache.cpp

Issue 1911843002: Remove IFDE_CSSTagProvider. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fde/css/fde_csscache.h ('k') | xfa/fde/css/fde_cssstyleselector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/css/fde_csscache.cpp
diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp
index 511c69798bd428ff5b5f7875097aaed0f56d8a3a..683cc539574b92b9da7c092ec64be1e7ef1f0538 100644
--- a/xfa/fde/css/fde_csscache.cpp
+++ b/xfa/fde/css/fde_csscache.cpp
@@ -9,35 +9,42 @@
#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);
+ FXSYS_assert(pTag);
Tom Sepez 2016/04/21 20:21:56 not needed, given line 38
dsinclair 2016/04/21 20:46:34 Done.
+
+ 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 +54,7 @@ FDE_CSSTagCache::FDE_CSSTagCache(FDE_CSSTagCache* parent,
}
}
}
+
FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it)
: pTag(it.pTag),
pParent(it.pParent),
@@ -54,16 +62,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();
« no previous file with comments | « xfa/fde/css/fde_csscache.h ('k') | xfa/fde/css/fde_cssstyleselector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698