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

Side by Side Diff: fpdfsdk/fpdf_structtree.cpp

Issue 2640923006: Cleanup CPDF_StructElement. (Closed)
Patch Set: Make CPDF_StructKid private Created 3 years, 11 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/tagged_int.h ('k') | no next file » | 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 #include "public/fpdf_structtree.h" 5 #include "public/fpdf_structtree.h"
6 6
7 #include "core/fpdfapi/page/cpdf_page.h" 7 #include "core/fpdfapi/page/cpdf_page.h"
8 #include "core/fpdfapi/parser/cpdf_dictionary.h" 8 #include "core/fpdfapi/parser/cpdf_dictionary.h"
9 #include "core/fpdfdoc/fpdf_tagged.h" 9 #include "core/fpdfdoc/fpdf_tagged.h"
10 #include "fpdfsdk/fsdk_define.h" 10 #include "fpdfsdk/fsdk_define.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return elem ? elem->CountKids() : -1; 76 return elem ? elem->CountKids() : -1;
77 } 77 }
78 78
79 DLLEXPORT FPDF_STRUCTELEMENT STDCALL 79 DLLEXPORT FPDF_STRUCTELEMENT STDCALL
80 FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, 80 FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
81 int index) { 81 int index) {
82 IPDF_StructElement* elem = ToStructTreeElement(struct_element); 82 IPDF_StructElement* elem = ToStructTreeElement(struct_element);
83 if (!elem || index < 0 || index >= elem->CountKids()) 83 if (!elem || index < 0 || index >= elem->CountKids())
84 return nullptr; 84 return nullptr;
85 85
86 CPDF_StructKid kid = elem->GetKid(index); 86 return elem->GetKidIfElement(index);
87 return kid.m_Type == CPDF_StructKid::Element ? kid.m_Element.m_pElement
88 : nullptr;
89 } 87 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/tagged_int.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698