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

Side by Side Diff: xfa/fde/css/fde_csscache.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/javascript/cjs_runtime.cpp ('k') | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fde/css/fde_csscache.h" 7 #include "xfa/fde/css/fde_csscache.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 IFDE_CSSTagProvider* tag) 101 IFDE_CSSTagProvider* tag)
102 : pTag(tag), 102 : pTag(tag),
103 pParent(parent), 103 pParent(parent),
104 dwIDHash(0), 104 dwIDHash(0),
105 dwTagHash(0), 105 dwTagHash(0),
106 iClassIndex(0), 106 iClassIndex(0),
107 dwClassHashs(1) { 107 dwClassHashs(1) {
108 FXSYS_assert(pTag != NULL); 108 FXSYS_assert(pTag != NULL);
109 CFX_WideStringC wsValue, wsName = pTag->GetTagName(); 109 CFX_WideStringC wsValue, wsName = pTag->GetTagName();
110 dwTagHash = 110 dwTagHash =
111 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength(), TRUE); 111 FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength(), TRUE);
112 FX_POSITION pos = pTag->GetFirstAttribute(); 112 FX_POSITION pos = pTag->GetFirstAttribute();
113 while (pos != NULL) { 113 while (pos != NULL) {
114 pTag->GetNextAttribute(pos, wsName, wsValue); 114 pTag->GetNextAttribute(pos, wsName, wsValue);
115 uint32_t dwNameHash = 115 uint32_t dwNameHash =
116 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength(), TRUE); 116 FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength(), TRUE);
117 static const uint32_t s_dwIDHash = FX_HashCode_String_GetW(L"id", 2, TRUE); 117 static const uint32_t s_dwIDHash = FX_HashCode_String_GetW(L"id", 2, TRUE);
118 static const uint32_t s_dwClassHash = 118 static const uint32_t s_dwClassHash =
119 FX_HashCode_String_GetW(L"class", 5, TRUE); 119 FX_HashCode_String_GetW(L"class", 5, TRUE);
120 if (dwNameHash == s_dwClassHash) { 120 if (dwNameHash == s_dwClassHash) {
121 uint32_t dwHash = 121 uint32_t dwHash =
122 FX_HashCode_String_GetW(wsValue.GetPtr(), wsValue.GetLength()); 122 FX_HashCode_String_GetW(wsValue.raw_str(), wsValue.GetLength());
123 dwClassHashs.Add(dwHash); 123 dwClassHashs.Add(dwHash);
124 } else if (dwNameHash == s_dwIDHash) { 124 } else if (dwNameHash == s_dwIDHash) {
125 dwIDHash = FX_HashCode_String_GetW(wsValue.GetPtr(), wsValue.GetLength()); 125 dwIDHash =
126 FX_HashCode_String_GetW(wsValue.raw_str(), wsValue.GetLength());
126 } 127 }
127 } 128 }
128 } 129 }
129 FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it) 130 FDE_CSSTagCache::FDE_CSSTagCache(const FDE_CSSTagCache& it)
130 : pTag(it.pTag), 131 : pTag(it.pTag),
131 pParent(it.pParent), 132 pParent(it.pParent),
132 dwIDHash(it.dwIDHash), 133 dwIDHash(it.dwIDHash),
133 dwTagHash(it.dwTagHash), 134 dwTagHash(it.dwTagHash),
134 iClassIndex(0), 135 iClassIndex(0),
135 dwClassHashs(1) { 136 dwClassHashs(1) {
136 if (it.dwClassHashs.GetSize() > 0) { 137 if (it.dwClassHashs.GetSize() > 0) {
137 dwClassHashs.Copy(it.dwClassHashs); 138 dwClassHashs.Copy(it.dwClassHashs);
138 } 139 }
139 } 140 }
140 void CFDE_CSSAccelerator::OnEnterTag(IFDE_CSSTagProvider* pTag) { 141 void CFDE_CSSAccelerator::OnEnterTag(IFDE_CSSTagProvider* pTag) {
141 FDE_CSSTagCache* pTop = GetTopElement(); 142 FDE_CSSTagCache* pTop = GetTopElement();
142 FDE_CSSTagCache item(pTop, pTag); 143 FDE_CSSTagCache item(pTop, pTag);
143 m_Stack.Push(item); 144 m_Stack.Push(item);
144 } 145 }
145 void CFDE_CSSAccelerator::OnLeaveTag(IFDE_CSSTagProvider* pTag) { 146 void CFDE_CSSAccelerator::OnLeaveTag(IFDE_CSSTagProvider* pTag) {
146 FXSYS_assert(m_Stack.GetTopElement()); 147 FXSYS_assert(m_Stack.GetTopElement());
147 FXSYS_assert(m_Stack.GetTopElement()->GetTag() == pTag); 148 FXSYS_assert(m_Stack.GetTopElement()->GetTag() == pTag);
148 m_Stack.Pop(); 149 m_Stack.Pop();
149 } 150 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/cjs_runtime.cpp ('k') | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698