* Get inheritable name value from field hierarchy.
( dict: PdfDict, key: string, registry: ObjectRegistry, )
| 66 | * Get inheritable name value from field hierarchy. |
| 67 | */ |
| 68 | function getInheritableFieldName( |
| 69 | dict: PdfDict, |
| 70 | key: string, |
| 71 | registry: ObjectRegistry, |
| 72 | ): string | null { |
| 73 | let current: PdfDict | null = dict; |
| 74 | const visited = new Set<PdfDict>(); |
| 75 | const resolve = registry.resolve.bind(registry); |
| 76 | |
| 77 | while (current) { |
| 78 | if (visited.has(current)) { |
| 79 | break; |
| 80 | } |
| 81 | |
| 82 | visited.add(current); |
| 83 | |
| 84 | const value = current.getName(key, resolve); |
| 85 | |
| 86 | if (value) { |
| 87 | return value.value; |
| 88 | } |
| 89 | |
| 90 | const parent = current.getDict("Parent", resolve); |
| 91 | |
| 92 | if (!parent) { |
| 93 | break; |
| 94 | } |
| 95 | |
| 96 | current = parent; |
| 97 | } |
| 98 | |
| 99 | return null; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Get inheritable number value from field hierarchy. |
no test coverage detected