OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |