Skip to content

Sync S20: merge upstream PDFium up to 31e80351ba (Nov 25 2026) - #138

Merged
bobsingor merged 7 commits into
embedpdf/mainfrom
embedpdf/sync/31e80351ba
Nov 29, 2026
Merged

bobsingor merged 7 commits into
embedpdf/mainfrom
embedpdf/sync/31e80351ba

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

Release-gate sync: 6 upstream commits, bd217de to 31e8035 (upstream's tip, more than a day old). Report: docs/embedpdf/syncs/2026-11-30-31e80351ba.md.

  • Renderer and font-backend start-up made uniform (25ff9814ce): builds must define PDF_USE_AGG or PDF_USE_SKIA; ours defines PDF_USE_AGG, and our thread start-up still gets AGG.
  • Upstream's four new content generator unit tests (8952e43dcf, unbalanced q) now record our generator's output, rule faithful-content-rewrite: no default black in the header, colours in their own colour space (0 g 0 G), and a change to existing content writes every stream again, balanced. Where a pure append leaves the same gap as upstream, upstream's TODOs stay; where our rewrite already does what a TODO asks, our comment replaces it.
  • The display-list test driver records images now (31e80351ba); upstream updated the expectations it moved, none of ours moved. Upstream's drawing runner (not in our CI): 4 of 7 pass, the 3 XFA ones don't run; bug_547706 joins the two font-only differences from S19 (built-in Chrom Sans vs Arimo, a one-pixel narrower clip).
  • XFA hardening, not in our builds.
  • No conflicts, no DEPS changes, no layer-mode writer changes, no C API change, no likely security fixes.

Local checks (darwin-arm64): 1416 unit tests pass; embedder tests unchanged (the 12 known Mac golden failures); layer mode; tag, C API, globals and exports checks; every target's patches; wasm32 build. Not run locally: Linux and Windows builds, TSan soak, engine tests.

After this sync no upstream commit is missing.

If you run CI on this branch, let it finish before merging: merging deletes the branch, and build jobs that start afterwards fail at checkout. Merge with a merge commit, not squash.

tsepez and others added 7 commits November 23, 2026 15:33
Garbage-collected objects can outlive non-GC C++ objects if collection
is deferred or shares a heap across documents, so raw/unowned pointers
into C++ memory should self-null or be explicitly cleared. Using
observed ptrs should be relatively inexpensive following recent updates
to them.

None of these are issues today, but for defensive purposes:
- Make CFX_XMLNode inherit from Observable and convert
  CXFA_Node::xml_node_ to ObservedPtr.
- Convert CXFA_FFDoc::pdfdoc_ to ObservedPtr.
- Make CallbackIfaces become observable.

Change-Id: I7a20c6b15faef18e202dce0cf077d650946c60f1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165130
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add unit tests covering CPDF_PageContentGenerator::GenerateContent()
when existing page content streams do not start with a "q" operator,
contain unmatched "q" operators (with and without CTM changes), or lose
their leading stream during removal while a new object is added.

Document current behavior with TODO comments to be updated once graphics
state balancing is implemented in a follow-up CL.

This CL is AI generated.

Bug: 578639452
Change-Id: I8a469cdd63fc140df4e119bac4bc10ad9fb01ead
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164912
Commit-Queue: Andy Phan <andyphan@chromium.org>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Align CFX_GEModule::RendererType initialization and queries with the
FontBackend pattern and reduce #ifdef clutter:

- Alias CFX_GEModule::FontBackend to CFX_FontMgr::FontBackend so
  callers (fpdf_view.cpp, pdf_test_environment.cpp) depend only on
  CFX_GEModule instead of reaching into CFX_FontMgr.
- Remove RendererType::kDefault and handle AGG+Skia, Skia-only, and
  AGG-only builds explicitly with #error guards in fpdf_view.cpp and
  testing/pdf_test_environment.cpp, avoiding static_cast from
  FPDF_RENDERERTYPE_* values.
- Provide IsAggRenderer(), IsSkiaRenderer(), IsFontations(), and
  IsFreetype() across all valid build configurations, returning
  compile-time constants in single-backend builds.
- Store renderer_type_ and font_backend_ unconditionally on
  CFX_GEModule with [[maybe_unused]], and drop the redundant
  font_backend_ member from CFX_FontMgr.

Treating both renderer and font-backend selection symmetrically makes
single- vs. dual-backend #ifdefs explicit, prevents invalid build
configurations at compile time, and keeps public-to-internal enum
mapping type-safe.

Change-Id: I1ac728cf1524f9396cbef32755c9e69165b6c6a2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165370
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Dynamic XFA pages return nullptr from CPDFPageFromFPDFPage() because
CPDFXFA_Page::AsPDFPage() is null. DisplayListRenderer::Start()
rejected those pages and DisplayListRenderer::Finish() dereferenced
the null pointer.

Use IPDFPageFromFPDFPage() in both methods and only invoke
CPDFSDK_RenderPageWithContext() when AsPDFPage() is non-null.

Change-Id: Ia4bcf202d1145148304b4082bbf00ba2e34d8a61
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165451
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add tests (.in files) under testing/resources/drawing/xfa_specific to
exercise high-impact layout edge cases:
- xfa_maxw_maxh_autosize.in: Verifies that an auto-sizing subform
  containing smaller content auto-fits rather than expanding to
  maxW/maxH.
- xfa_minw_minh_floor.in: Verifies that an auto-sizing subform respects
  minW/minH floor dimensions.
- xfa_page_odd_even_break.in: Verifies that breakBefore targeting
  pageOdd advances pagination to an odd page, emitting a filler page.

Change-Id: I11694e985a4f4a697648c5f2772bf75c20bcc798
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164651
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Dynamic XFA pages do not have an underlying PDF page object. Hence,
DisplayListRenderer::Start() previously failed on all dynamic XFA
documents.

- Remove GetBitmap() calls when only dimensions are required.
- No longer CHECK() that readback is required for xfa images.

Change-Id: I41b544fd038305e5bd0b71d1cb63d46c0e9bb304
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164690
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Release-gate sync: 6 upstream commits, bd217de to 31e8035
(upstream's tip, more than a day old).
Report: docs/embedpdf/syncs/2026-11-30-31e80351ba.md.

- Renderer and font-backend start-up made uniform; our builds define
  PDF_USE_AGG and our thread start-up still gets AGG.
- Upstream's new content generator tests record our generator's
  output (rule faithful-content-rewrite): no default black, colours in
  their own colour space, and a change to existing content writes
  every stream again, balanced.
- The display-list test driver records images now; XFA hardening.
@bobsingor
bobsingor merged commit a0b1daa into embedpdf/main Nov 29, 2026
1 check failed
@bobsingor
bobsingor deleted the embedpdf/sync/31e80351ba branch November 29, 2026 23:24
bobsingor added a commit to embedpdf/embed-pdf-viewer that referenced this pull request Nov 30, 2026
The release has the runtime changes merged since 7f399f838:

- A redrawn form field gets a new appearance stream, where a text field,
  a dropdown and a list box were drawn into the one they had
  (embedpdf/runtime#135). An undo puts back the stream the widget named,
  so it brings the drawing back. The undo round trips this branch adds
  failed on the old pin and pass on both engines on this one.
- Asking where an annotation without a stored appearance draws reads its
  dictionary and no longer copies it into the document's changes
  (embedpdf/runtime#136).
- A font the form holds inline is made an object of its own before an
  appearance names it (embedpdf/runtime#134), and a redaction is applied
  at the place its mark has in a layer (embedpdf/runtime#137).
- The upstream sync to 31e80351b (Nov 25 2026, embedpdf/runtime#138).

The bindings generated from the release's headers don't change.
runtime-src moves to the pin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants