[rust png] Add `pdf_enable_rust_png` GN arg.
This CL just adds a `pdf_enable_rust_png` GN arg. At this point the
new arg doesn't do/control anything - this will change in follow-up CLs
listed below:
* https://crrev.com/c/7004443: This CL will start setting the new flag
on PDFium bots like `linux_skia_rust` or `win_xfa_skia_rust`.
Initially this will also result in no changes.
* https://pdfium-review.googlesource.com/135630 and
https://pdfium-review.googlesource.com/135730 will actually change
PDFium behavior when the new GN arg is set to true.
Bug: 444045690
Change-Id: Ic5d1ece39d6ff63d143f8772396876b634107a69
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/136410
Commit-Queue: Ćukasz Anforowicz <lukasza@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/build_overrides/pdfium.gni b/build_overrides/pdfium.gni
index 809f94a..b3ab580 100644
--- a/build_overrides/pdfium.gni
+++ b/build_overrides/pdfium.gni
@@ -38,3 +38,11 @@
# library is selectable at runtime.
# The default is to use FreeType when `pdf_enable_fontations_override` is false.
pdf_enable_fontations_override = false
+
+# Build PDFium with Rust-based PNG decoder and encoder.
+# If enabled, it ensures that PDFium doesn't depend on `libpng`.
+# Note that `pdf_enable_rust_png` requires Skia and Rust support.
+#
+# TODO(https://crbug.com/444045690): Actually use Rust PNG when this GN arg is
+# enabled.
+pdf_enable_rust_png_override = false
diff --git a/pdfium.gni b/pdfium.gni
index 9c8b63f..f25ac4b 100644
--- a/pdfium.gni
+++ b/pdfium.gni
@@ -62,6 +62,14 @@
# Note that Fontations requires Skia and Rust support.
pdf_enable_fontations = pdf_enable_fontations_override
+ # Build PDFium with Rust-based PNG decoder and encoder.
+ # If enabled, it ensures that PDFium doesn't depend on `libpng`.
+ # Note that `pdf_enable_rust_png` requires Skia and Rust support.
+ #
+ # TODO(https://crbug.com/444045690): Actually use Rust PNG when this GN arg
+ # is enabled.
+ pdf_enable_rust_png = pdf_enable_rust_png_override
+
# Build PDFium standalone. Now only controls whether the test binaries
# are built. Most logic is conditioned by build_with_chromium.
pdf_is_standalone = false
@@ -94,3 +102,7 @@
assert(
!pdf_enable_fontations || (enable_rust && enable_rust_cxx && pdf_use_skia),
"pdf_enable_fontations=true requires enable_rust=true, enable_rust_cxx=true, and pdf_use_skia=true")
+
+assert(
+ !pdf_enable_rust_png || (enable_rust && enable_rust_cxx && pdf_use_skia),
+ "pdf_enable_rust_png=true requires enable_rust=true, enable_rust_cxx=true, and pdf_use_skia=true")