Skip to content

Update the structure tree when flattening annotations (bug 2075337) - #22447

Open
calixteman wants to merge 3 commits into
mozilla:masterfrom
calixteman:flatten-struct-tree
Open

calixteman wants to merge 3 commits into
mozilla:masterfrom
calixteman:flatten-struct-tree

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

In a flat parent tree, replace the OBJR of a flattened annotation with a marked-content reference to its drawing in the page content. For other readable parent trees, only remove the OBJR.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Viewer preview

Commit a75b355 (build logs).

Viewer Build Preview
Modern (gulp generic) ✅ viewer.html
Legacy (gulp generic-legacy) ✅ viewer.html

Previews are removed when the PR closes and may be pruned after 30 days without an update.

sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 4, 2026
@codecov-commenter

codecov-commenter commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.93114% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.63%. Comparing base (b600aec) to head (a75b355).

Files with missing lines Patch % Lines
src/core/flattener.js 95.45% 25 Missing ⚠️
src/core/core_utils.js 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22447      +/-   ##
==========================================
+ Coverage   90.57%   90.63%   +0.05%     
==========================================
  Files         276      277       +1     
  Lines       68671    69280     +609     
==========================================
+ Hits        62197    62790     +593     
- Misses       6474     6490      +16     
Flag Coverage Δ
fonttest 9.09% <0.00%> (-0.01%) ⬇️
unittest 64.10% <95.93%> (+1.00%) ⬆️
unittestcli 61.75% <95.93%> (+1.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 18.33%

⚡ 1 improved benchmark
✅ 87 untouched benchmarks
⏩ 174 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ PartialEvaluator.buildPath: lines (bug1743245.pdf) 17.2 ms 14.5 ms +18.33%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing calixteman:flatten-struct-tree (a75b355) with master (b600aec)

Open in CodSpeed

Footnotes

  1. 174 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Add flatten and intent options to draw supported annotation appearances
into page content. Use print or display visibility. Keep the widgets and
the interactive annotations.

Android 14's PdfRenderer calls PDFium without FPDF_ANNOT [1].

[1] https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/libs/hwui/jni/pdf/PdfRenderer.cpp
With `flatten: true`, also draw the widgets, generating their appearances
from the stored values, and remove the ones hidden for the intent. Prune
the removed fields from the AcroForm, and remove it when no page widget
remains, unless it declares signatures. Add a "non-forms" value to keep the
form fields.
In a flat parent tree, replace the OBJR of a flattened annotation with a
marked-content reference to its drawing in the page content. For other
readable parent trees, only remove the OBJR.
sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants