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

Side by Side Diff: core/fpdfdoc/cpdf_interform.cpp

Issue 2425783002: Revert "Make CPDF_Object containers hold objects via unique pointers." (Closed)
Patch Set: Created 4 years, 2 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 | « core/fpdfdoc/cpdf_formfield.cpp ('k') | fpdfsdk/formfiller/cba_fontmap.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 <vector> 7 #include <vector>
8 8
9 #include "core/fpdfapi/font/cpdf_font.h" 9 #include "core/fpdfapi/font/cpdf_font.h"
10 #include "core/fpdfapi/font/cpdf_fontencoding.h" 10 #include "core/fpdfapi/font/cpdf_fontencoding.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); 131 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
132 if (!pDR) 132 if (!pDR)
133 return nullptr; 133 return nullptr;
134 134
135 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); 135 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
136 if (!pFonts) 136 if (!pFonts)
137 return nullptr; 137 return nullptr;
138 138
139 for (const auto& it : *pFonts) { 139 for (const auto& it : *pFonts) {
140 const CFX_ByteString& csKey = it.first; 140 const CFX_ByteString& csKey = it.first;
141 CPDF_Object* pObj = it.second.get(); 141 CPDF_Object* pObj = it.second;
142 if (!pObj) 142 if (!pObj)
143 continue; 143 continue;
144 144
145 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); 145 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
146 if (!pElement) 146 if (!pElement)
147 continue; 147 continue;
148 if (pElement->GetStringFor("Type") != "Font") 148 if (pElement->GetStringFor("Type") != "Font")
149 continue; 149 continue;
150 CPDF_Font* pFind = pDocument->LoadFont(pElement); 150 CPDF_Font* pFind = pDocument->LoadFont(pElement);
151 if (!pFind) 151 if (!pFind)
(...skipping 20 matching lines...) Expand all
172 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); 172 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
173 if (!pDR) 173 if (!pDR)
174 return FALSE; 174 return FALSE;
175 175
176 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); 176 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
177 if (!pFonts) 177 if (!pFonts)
178 return FALSE; 178 return FALSE;
179 179
180 for (const auto& it : *pFonts) { 180 for (const auto& it : *pFonts) {
181 const CFX_ByteString& csKey = it.first; 181 const CFX_ByteString& csKey = it.first;
182 CPDF_Object* pObj = it.second.get(); 182 CPDF_Object* pObj = it.second;
183 if (!pObj) 183 if (!pObj)
184 continue; 184 continue;
185 185
186 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); 186 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
187 if (!pElement) 187 if (!pElement)
188 continue; 188 continue;
189 if (pElement->GetStringFor("Type") != "Font") 189 if (pElement->GetStringFor("Type") != "Font")
190 continue; 190 continue;
191 if (pFont->GetFontDict() == pElement) { 191 if (pFont->GetFontDict() == pElement) {
192 csNameTag = csKey; 192 csNameTag = csKey;
(...skipping 16 matching lines...) Expand all
209 return FALSE; 209 return FALSE;
210 210
211 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); 211 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
212 if (!pFonts) 212 if (!pFonts)
213 return FALSE; 213 return FALSE;
214 if (csFontName.GetLength() > 0) 214 if (csFontName.GetLength() > 0)
215 csFontName.Remove(' '); 215 csFontName.Remove(' ');
216 216
217 for (const auto& it : *pFonts) { 217 for (const auto& it : *pFonts) {
218 const CFX_ByteString& csKey = it.first; 218 const CFX_ByteString& csKey = it.first;
219 CPDF_Object* pObj = it.second.get(); 219 CPDF_Object* pObj = it.second;
220 if (!pObj) 220 if (!pObj)
221 continue; 221 continue;
222 222
223 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); 223 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
224 if (!pElement) 224 if (!pElement)
225 continue; 225 continue;
226 if (pElement->GetStringFor("Type") != "Font") 226 if (pElement->GetStringFor("Type") != "Font")
227 continue; 227 continue;
228 228
229 pFont = pDocument->LoadFont(pElement); 229 pFont = pDocument->LoadFont(pElement);
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 else if (iType == FIELDTYPE_LISTBOX) 1313 else if (iType == FIELDTYPE_LISTBOX)
1314 m_pFormNotify->AfterSelectionChange(pField); 1314 m_pFormNotify->AfterSelectionChange(pField);
1315 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) 1315 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD)
1316 m_pFormNotify->AfterValueChange(pField); 1316 m_pFormNotify->AfterValueChange(pField);
1317 } 1317 }
1318 } 1318 }
1319 1319
1320 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { 1320 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) {
1321 m_pFormNotify = pNotify; 1321 m_pFormNotify = pNotify;
1322 } 1322 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.cpp ('k') | fpdfsdk/formfiller/cba_fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698