Remove explicit xref usage in the ScreenAnnotation.prototype.#renditionActions method

Rather than fetching "raw" dictionary-data and then manually resolving any references, we can simply use `Dict.prototype.get` and `Dict`-iteration to access the needed data *directly* instead.
This commit is contained in:
Jonas Jenwald 2026-06-24 10:39:12 +02:00
parent 15d93e1f34
commit 44e637a064

View File

@ -5686,7 +5686,7 @@ class ScreenAnnotation extends MediaAnnotation {
* } | null} * } | null}
*/ */
static #findAsset(dict, xref) { static #findAsset(dict, xref) {
for (const action of this.#renditionActions(dict, xref)) { for (const action of this.#renditionActions(dict)) {
const asset = this.#findRenditionAsset( const asset = this.#findRenditionAsset(
action.get("R"), action.get("R"),
xref, xref,
@ -5699,10 +5699,10 @@ class ScreenAnnotation extends MediaAnnotation {
return null; return null;
} }
static *#renditionActions(dict, xref) { static *#renditionActions(dict) {
// The rendition action may be the activation action (/A) or one of the // The rendition action may be the activation action (/A) or one of the
// additional actions (/AA), e.g. page-open. // additional actions (/AA), e.g. page-open.
const action = xref.fetchIfRef(dict.getRaw("A")); const action = dict.get("A");
if ( if (
action instanceof Dict && action instanceof Dict &&
isName(action.get("S"), "Rendition") && isName(action.get("S"), "Rendition") &&
@ -5712,8 +5712,7 @@ class ScreenAnnotation extends MediaAnnotation {
} }
const additionalActions = dict.get("AA"); const additionalActions = dict.get("AA");
if (additionalActions instanceof Dict) { if (additionalActions instanceof Dict) {
for (const key of additionalActions.getKeys()) { for (const [, aa] of additionalActions) {
const aa = xref.fetchIfRef(additionalActions.getRaw(key));
if ( if (
aa instanceof Dict && aa instanceof Dict &&
isName(aa.get("S"), "Rendition") && isName(aa.get("S"), "Rendition") &&