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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

Issue 1638493002: Remove unused IsContentUsedElsewhere() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Revert to PS2. Created 4 years, 10 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
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 "core/include/fpdfapi/fpdf_parser.h" 7 #include "core/include/fpdfapi/fpdf_parser.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return 0; 303 return 0;
304 } 304 }
305 if (!pPages->KeyExist("Kids")) { 305 if (!pPages->KeyExist("Kids")) {
306 return 1; 306 return 1;
307 } 307 }
308 std::set<CPDF_Dictionary*> visited_pages; 308 std::set<CPDF_Dictionary*> visited_pages;
309 visited_pages.insert(pPages); 309 visited_pages.insert(pPages);
310 return CountPages(pPages, &visited_pages); 310 return CountPages(pPages, &visited_pages);
311 } 311 }
312 312
313 FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum,
314 CPDF_Dictionary* pThisPageDict) {
315 for (int i = 0; i < m_PageList.GetSize(); i++) {
316 CPDF_Dictionary* pPageDict = GetPage(i);
317 if (pPageDict == pThisPageDict) {
318 continue;
319 }
320 CPDF_Object* pContents =
321 pPageDict ? pPageDict->GetElement("Contents") : NULL;
322 if (!pContents) {
323 continue;
324 }
325 if (pContents->GetDirectType() == PDFOBJ_ARRAY) {
326 CPDF_Array* pArray = pContents->GetDirect()->AsArray();
327 for (FX_DWORD j = 0; j < pArray->GetCount(); j++) {
328 CPDF_Reference* pRef = ToReference(pArray->GetElement(j));
329 if (pRef && pRef->GetRefObjNum() == objnum)
330 return TRUE;
331 }
332 } else if (pContents->GetObjNum() == objnum) {
333 return TRUE;
334 }
335 }
336 return FALSE;
337 }
338 FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { 313 FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
339 if (!m_pParser) { 314 if (!m_pParser) {
340 return (FX_DWORD)-1; 315 return (FX_DWORD)-1;
341 } 316 }
342 return m_pParser->GetPermissions(bCheckRevision); 317 return m_pParser->GetPermissions(bCheckRevision);
343 } 318 }
319
344 FX_BOOL CPDF_Document::IsOwner() const { 320 FX_BOOL CPDF_Document::IsOwner() const {
345 return !m_pParser || m_pParser->IsOwner(); 321 return !m_pParser || m_pParser->IsOwner();
346 } 322 }
323
347 FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { 324 FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
348 auto it = m_IndirectObjs.find(objnum); 325 auto it = m_IndirectObjs.find(objnum);
349 if (it != m_IndirectObjs.end()) { 326 if (it != m_IndirectObjs.end()) {
350 CPDF_Stream* pStream = it->second->AsStream(); 327 CPDF_Stream* pStream = it->second->AsStream();
351 bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form"; 328 bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form";
352 return TRUE; 329 return TRUE;
353 } 330 }
354 if (!m_pParser) { 331 if (!m_pParser) {
355 bForm = FALSE; 332 bForm = FALSE;
356 return TRUE; 333 return TRUE;
357 } 334 }
358 return m_pParser->IsFormStream(objnum, bForm); 335 return m_pParser->IsFormStream(objnum, bForm);
359 } 336 }
337
360 void CPDF_Document::ClearPageData() { 338 void CPDF_Document::ClearPageData() {
361 if (m_pDocPage) { 339 if (m_pDocPage)
362 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 340 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
363 }
364 } 341 }
342
365 void CPDF_Document::ClearRenderData() { 343 void CPDF_Document::ClearRenderData() {
366 if (m_pDocRender) { 344 if (m_pDocRender)
367 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 345 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
368 }
369 } 346 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698