From 5a69fd3052bb638857f30a4cfd5913634275d23d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 9 Nov 2022 13:19:49 +0100 Subject: Update pdfium to 5408 - drop cg-instead-of-carbon.patch.1, no longer needed after https://pdfium-review.googlesource.com/c/pdfium/+/99753 - drop AndroidNDK19.patch.1, no longer needed after https://pdfium-review.googlesource.com/c/pdfium/+/96530 - drop gcc-c++20-comparison.patch, no longer needed after "Fix interaction between RetainPtr and transparent comparisons" since chromium/5321 Change-Id: I1f861dd8a3d490400bb39c108bd4e767a2f45d30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142474 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- ...t_GetFormAdditionalActionJavaScript-API.patch.1 | 103 --------------------- ...FPDFAnnot_GetFormFieldAlternateName-API.patch.1 | 70 -------------- external/pdfium/AndroidNDK19.patch.1 | 16 ---- external/pdfium/Library_pdfium.mk | 14 +-- external/pdfium/UnpackedTarball_pdfium.mk | 28 +----- external/pdfium/build.patch.1 | 13 --- external/pdfium/cg-instead-of-carbon.patch.1 | 23 ----- external/pdfium/gcc-c++20-comparison.patch | 18 ---- external/pdfium/inc/pch/precompiled_pdfium.hxx | 25 +---- 9 files changed, 11 insertions(+), 299 deletions(-) delete mode 100644 external/pdfium/Add-FPDFAnnot_GetFormAdditionalActionJavaScript-API.patch.1 delete mode 100644 external/pdfium/Add-FPDFAnnot_GetFormFieldAlternateName-API.patch.1 delete mode 100644 external/pdfium/AndroidNDK19.patch.1 delete mode 100644 external/pdfium/cg-instead-of-carbon.patch.1 delete mode 100644 external/pdfium/gcc-c++20-comparison.patch (limited to 'external') diff --git a/external/pdfium/Add-FPDFAnnot_GetFormAdditionalActionJavaScript-API.patch.1 b/external/pdfium/Add-FPDFAnnot_GetFormAdditionalActionJavaScript-API.patch.1 deleted file mode 100644 index a0629bfc8fef..000000000000 --- a/external/pdfium/Add-FPDFAnnot_GetFormAdditionalActionJavaScript-API.patch.1 +++ /dev/null @@ -1,103 +0,0 @@ -From f929f2ffbfdd92aea755ca1d3fd1a0bfe9e2827a Mon Sep 17 00:00:00 2001 -From: Miklos Vajna -Date: Fri, 16 Sep 2022 20:42:32 +0000 -Subject: [PATCH] Add FPDFAnnot_GetFormAdditionalActionJavaScript() API - -This is similar to FPDFAnnot_GetFormFieldType() and allows getting the -JavaScript of a given event. Such JavaScripts are used e.g. on a text -form which wants to accept dates. - -Bug: pdfium:1885 -Change-Id: Ieceb3042a309b9578e8a6751a60918c7e8d8f91d -Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/97950 -Reviewed-by: Tom Sepez -Commit-Queue: Lei Zhang -Reviewed-by: Lei Zhang ---- - -diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp -index 349348583..75bdf6cd4 100644 ---- a/fpdfsdk/fpdf_annot.cpp -+++ b/fpdfsdk/fpdf_annot.cpp -@@ -1223,6 +1238,28 @@ FPDFAnnot_GetFormFieldType(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot) { - return pFormField ? static_cast(pFormField->GetFieldType()) : -1; - } - -+FPDF_EXPORT unsigned long FPDF_CALLCONV -+FPDFAnnot_GetFormAdditionalActionJavaScript(FPDF_FORMHANDLE hHandle, -+ FPDF_ANNOTATION annot, -+ int event, -+ FPDF_WCHAR* buffer, -+ unsigned long buflen) { -+ const CPDF_FormField* pFormField = GetFormField(hHandle, annot); -+ if (!pFormField) -+ return 0; -+ -+ if (event < FPDF_ANNOT_AACTION_KEY_STROKE || -+ event > FPDF_ANNOT_AACTION_CALCULATE) { -+ return 0; -+ } -+ -+ auto type = static_cast(event); -+ CPDF_AAction additional_action = pFormField->GetAdditionalAction(); -+ CPDF_Action action = additional_action.GetAction(type); -+ return Utf16EncodeMaybeCopyAndReturnLength(action.GetJavaScript(), buffer, -+ buflen); -+} -+ - FPDF_EXPORT unsigned long FPDF_CALLCONV - FPDFAnnot_GetFormFieldValue(FPDF_FORMHANDLE hHandle, - FPDF_ANNOTATION annot, -diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h -index ccfbb0f1c..0c0302c65 100644 ---- a/public/fpdf_annot.h -+++ b/public/fpdf_annot.h -@@ -82,6 +82,16 @@ extern "C" { - #define FPDF_FORMFLAG_CHOICE_EDIT (1 << 18) - #define FPDF_FORMFLAG_CHOICE_MULTI_SELECT (1 << 21) - -+// Additional actions type of form field: -+// K, on key stroke, JavaScript action. -+// F, on format, JavaScript action. -+// V, on validate, JavaScript action. -+// C, on calculate, JavaScript action. -+#define FPDF_ANNOT_AACTION_KEY_STROKE 12 -+#define FPDF_ANNOT_AACTION_FORMAT 13 -+#define FPDF_ANNOT_AACTION_VALIDATE 14 -+#define FPDF_ANNOT_AACTION_CALCULATE 15 -+ - typedef enum FPDFANNOT_COLORTYPE { - FPDFANNOT_COLORTYPE_Color = 0, - FPDFANNOT_COLORTYPE_InteriorColor -@@ -494,6 +504,31 @@ FPDFAnnot_GetBorder(FPDF_ANNOTATION annot, - float* vertical_radius, - float* border_width); - -+// Experimental API. -+// Get the JavaScript of an event of the annotation's additional actions. -+// |buffer| is only modified if |buflen| is large enough to hold the whole -+// JavaScript string. If |buflen| is smaller, the total size of the JavaScript -+// is still returned, but nothing is copied. If there is no JavaScript for -+// |event| in |annot|, an empty string is written to |buf| and 2 is returned, -+// denoting the size of the null terminator in the buffer. On other errors, -+// nothing is written to |buffer| and 0 is returned. -+// -+// hHandle - handle to the form fill module, returned by -+// FPDFDOC_InitFormFillEnvironment(). -+// annot - handle to an interactive form annotation. -+// event - event type, one of the FPDF_ANNOT_AACTION_* values. -+// buffer - buffer for holding the value string, encoded in UTF-16LE. -+// buflen - length of the buffer in bytes. -+// -+// Returns the length of the string value in bytes, including the 2-byte -+// null terminator. -+FPDF_EXPORT unsigned long FPDF_CALLCONV -+FPDFAnnot_GetFormAdditionalActionJavaScript(FPDF_FORMHANDLE hHandle, -+ FPDF_ANNOTATION annot, -+ int event, -+ FPDF_WCHAR* buffer, -+ unsigned long buflen); -+ - // Experimental API. - // Check if |annot|'s dictionary has |key| as a key. - // diff --git a/external/pdfium/Add-FPDFAnnot_GetFormFieldAlternateName-API.patch.1 b/external/pdfium/Add-FPDFAnnot_GetFormFieldAlternateName-API.patch.1 deleted file mode 100644 index 7a72cf2e0439..000000000000 --- a/external/pdfium/Add-FPDFAnnot_GetFormFieldAlternateName-API.patch.1 +++ /dev/null @@ -1,70 +0,0 @@ -From 786e8f65d620aa4be7cdd40576de992331f05d04 Mon Sep 17 00:00:00 2001 -From: Miklos Vajna -Date: Thu, 22 Sep 2022 14:20:17 +0000 -Subject: [PATCH] Add FPDFAnnot_GetFormFieldAlternateName() API - -This is similar to FPDFAnnot_GetFormFieldName() and allows getting the -alternate name. Such names are used e.g. for accessibility purposes. - -Bug: pdfium:1892 -Change-Id: I95dc771af64d6091b742f1da21e50a99327e015b -Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98210 -Reviewed-by: Lei Zhang -Commit-Queue: Miklos V ---- - -diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp -index 28661ec00..9861b8158 100644 ---- a/fpdfsdk/fpdf_annot.cpp -+++ b/fpdfsdk/fpdf_annot.cpp -@@ -1263,6 +1263,19 @@ FPDFAnnot_GetFormAdditionalActionJavaScript(FPDF_FORMHANDLE hHandle, - buflen); - } - -+FPDF_EXPORT unsigned long FPDF_CALLCONV -+FPDFAnnot_GetFormFieldAlternateName(FPDF_FORMHANDLE hHandle, -+ FPDF_ANNOTATION annot, -+ FPDF_WCHAR* buffer, -+ unsigned long buflen) { -+ const CPDF_FormField* pFormField = GetFormField(hHandle, annot); -+ if (!pFormField) -+ return 0; -+ -+ return Utf16EncodeMaybeCopyAndReturnLength(pFormField->GetAlternateName(), -+ buffer, buflen); -+} -+ - FPDF_EXPORT unsigned long FPDF_CALLCONV - FPDFAnnot_GetFormFieldValue(FPDF_FORMHANDLE hHandle, - FPDF_ANNOTATION annot, -diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h -index 0c0302c65..333a6b23e 100644 ---- a/public/fpdf_annot.h -+++ b/public/fpdf_annot.h -@@ -721,6 +721,26 @@ FPDFAnnot_GetFormFieldName(FPDF_FORMHANDLE hHandle, - FPDF_WCHAR* buffer, - unsigned long buflen); - -+// Experimental API. -+// Gets the alternate name of |annot|, which is an interactive form annotation. -+// |buffer| is only modified if |buflen| is longer than the length of contents. -+// In case of error, nothing will be added to |buffer| and the return value will -+// be 0. Note that return value of empty string is 2 for "\0\0". -+// -+// hHandle - handle to the form fill module, returned by -+// FPDFDOC_InitFormFillEnvironment(). -+// annot - handle to an interactive form annotation. -+// buffer - buffer for holding the alternate name string, encoded in -+// UTF-16LE. -+// buflen - length of the buffer in bytes. -+// -+// Returns the length of the string value in bytes. -+FPDF_EXPORT unsigned long FPDF_CALLCONV -+FPDFAnnot_GetFormFieldAlternateName(FPDF_FORMHANDLE hHandle, -+ FPDF_ANNOTATION annot, -+ FPDF_WCHAR* buffer, -+ unsigned long buflen); -+ - // Experimental API. - // Gets the form field type of |annot|, which is an interactive form annotation. - // diff --git a/external/pdfium/AndroidNDK19.patch.1 b/external/pdfium/AndroidNDK19.patch.1 deleted file mode 100644 index f0d926f555d8..000000000000 --- a/external/pdfium/AndroidNDK19.patch.1 +++ /dev/null @@ -1,16 +0,0 @@ -diff -Naur pdfium.org/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h ---- pdfium.org/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h 2021-05-05 23:01:25.705057178 +0200 -+++ pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h 2021-05-05 23:06:52.194081762 +0200 -@@ -15,6 +15,12 @@ - #endif - #if BUILDFLAG(IS_ANDROID) - #include -+#ifndef PR_SET_VMA -+#define PR_SET_VMA 0x53564d41 -+#endif -+#ifndef PR_SET_VMA_ANON_NAME -+#define PR_SET_VMA_ANON_NAME 0 -+#endif - #endif - #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) - #include diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index c00a5f8f89e3..f137f851a0b2 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -244,9 +244,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fpdfapi/render/charposlist \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \ - UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imageloader \ + UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_imageloader \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagerenderer \ - UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercache \ + UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageimagecache \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_progressiverenderer \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendercontext \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_renderoptions \ @@ -566,17 +566,7 @@ endif # pdfium_base $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/page_allocator \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/spin_lock \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_alloc \ UnpackedTarball/pdfium/third_party/base/debug/alias \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/oom_callback \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_bucket \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_oom \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base \ - UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/random \ UnpackedTarball/pdfium/third_party/base/memory/aligned_memory \ )) diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index 3c82926acee1..46c7a45ee798 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -14,25 +14,15 @@ pdfium_patches += build.patch.1 # Avoids Windows 8 build dependency. pdfium_patches += windows7.patch.1 pdfium_patches += c++20-comparison.patch -# Use CoreGraphics.h instead of Carbon.h -pdfium_patches += cg-instead-of-carbon.patch.1 -# Android NDK 19 - that is known to work well - does not have 2 defines -pdfium_patches += AndroidNDK19.patch.1 - -# Work around "c++20 rewritten operator== -# recursive call mixing friend and external operators for template class" in GCC with -# --with-latest-c++: -pdfium_patches += gcc-c++20-comparison.patch +# Use CoreGraphics.h instead of Carbon.h -- https://pdfium-review.googlesource.com/c/pdfium/+/99753 +# pdfium_patches += cg-instead-of-carbon.patch.1 +# Android NDK 19 - that is known to work well - does not have 2 defines -- https://pdfium-review.googlesource.com/c/pdfium/+/96530 +# pdfium_patches += AndroidNDK19.patch.1 pdfium_patches += include.patch pdfium_patches += abseil-trivial.patch -# https://pdfium-review.googlesource.com/c/pdfium/+/97950 -pdfium_patches += Add-FPDFAnnot_GetFormAdditionalActionJavaScript-API.patch.1 -# https://pdfium-review.googlesource.com/c/pdfium/+/98210 -pdfium_patches += Add-FPDFAnnot_GetFormFieldAlternateName-API.patch.1 - pdfium_patches += constexpr-template.patch $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) @@ -50,17 +40,7 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\ mv third_party/bigint/BigIntegerUtils.cc third_party/bigint/BigIntegerUtils.cpp && \ mv third_party/bigint/BigUnsigned.cc third_party/bigint/BigUnsigned.cpp && \ mv third_party/bigint/BigUnsignedInABase.cc third_party/bigint/BigUnsignedInABase.cpp && \ - mv third_party/base/allocator/partition_allocator/address_space_randomization.cc third_party/base/allocator/partition_allocator/address_space_randomization.cpp && \ - mv third_party/base/allocator/partition_allocator/page_allocator.cc third_party/base/allocator/partition_allocator/page_allocator.cpp && \ - mv third_party/base/allocator/partition_allocator/partition_alloc.cc third_party/base/allocator/partition_allocator/partition_alloc.cpp && \ - mv third_party/base/allocator/partition_allocator/spin_lock.cc third_party/base/allocator/partition_allocator/spin_lock.cpp && \ mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp && \ - mv third_party/base/allocator/partition_allocator/oom_callback.cc third_party/base/allocator/partition_allocator/oom_callback.cpp && \ - mv third_party/base/allocator/partition_allocator/partition_bucket.cc third_party/base/allocator/partition_allocator/partition_bucket.cpp && \ - mv third_party/base/allocator/partition_allocator/partition_oom.cc third_party/base/allocator/partition_allocator/partition_oom.cpp && \ - mv third_party/base/allocator/partition_allocator/partition_page.cc third_party/base/allocator/partition_allocator/partition_page.cpp && \ - mv third_party/base/allocator/partition_allocator/partition_root_base.cc third_party/base/allocator/partition_allocator/partition_root_base.cpp && \ - mv third_party/base/allocator/partition_allocator/random.cc third_party/base/allocator/partition_allocator/random.cpp && \ mv third_party/base/memory/aligned_memory.cc third_party/base/memory/aligned_memory.cpp && \ mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \ mv third_party/libopenjpeg/opj_malloc.cc third_party/libopenjpeg/opj_malloc.cpp && \ diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1 index 35073e2c94d3..6f6a53a44ef3 100644 --- a/external/pdfium/build.patch.1 +++ b/external/pdfium/build.patch.1 @@ -158,16 +158,3 @@ index 29d3ee528..d5c7a1bc9 100644 OPJ_BOOL strict) { if (p_codec) { -diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp -index a17ec0353..3b024ac91 100644 ---- a/core/fpdfapi/parser/cpdf_data_avail.cpp -+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp -@@ -902,7 +902,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckResources( - CPDF_PageObjectAvail* resource_avail = - m_PagesResourcesAvail - .insert(std::make_pair( -- resources, -+ resources.Get(), - std::make_unique( - GetValidator(), m_pDocument.Get(), resources.Get()))) - .first->second.get(); diff --git a/external/pdfium/cg-instead-of-carbon.patch.1 b/external/pdfium/cg-instead-of-carbon.patch.1 deleted file mode 100644 index 055eac735307..000000000000 --- a/external/pdfium/cg-instead-of-carbon.patch.1 +++ /dev/null @@ -1,23 +0,0 @@ --*- Mode: Diff -*- ---- a/core/fxge/apple/fx_quartz_device.h -+++ b/core/fxge/apple/fx_quartz_device.h -@@ -7,7 +7,7 @@ - #ifndef CORE_FXGE_APPLE_FX_QUARTZ_DEVICE_H_ - #define CORE_FXGE_APPLE_FX_QUARTZ_DEVICE_H_ - --#include -+#include - #include - - #include "core/fxcrt/retain_ptr.h" ---- a/core/fpdfapi/font/cpdf_type1font.cpp -+++ b/core/fpdfapi/font/cpdf_type1font.cpp -@@ -19,7 +19,7 @@ - #include "core/fxge/fx_font.h" - - #if BUILDFLAG(IS_APPLE) --#include -+#include - #endif // BUILDFLAG(IS_APPLE) - - namespace { diff --git a/external/pdfium/gcc-c++20-comparison.patch b/external/pdfium/gcc-c++20-comparison.patch deleted file mode 100644 index bc7f2ed9538b..000000000000 --- a/external/pdfium/gcc-c++20-comparison.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- core/fxcrt/retain_ptr.h -+++ core/fxcrt/retain_ptr.h -@@ -135,6 +135,7 @@ - mutable intptr_t m_nRefCount = 0; - }; - -+#if __cplusplus < 202002L || (defined __clang__ && __clang_major__ >= 16) - template - inline bool operator==(const U* lhs, const RetainPtr& rhs) { - return rhs == lhs; -@@ -144,6 +144,7 @@ - inline bool operator!=(const U* lhs, const RetainPtr& rhs) { - return rhs != lhs; - } -+#endif - - } // namespace fxcrt - diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx b/external/pdfium/inc/pch/precompiled_pdfium.hxx index 21bc61f05fb3..315b5d81ec12 100644 --- a/external/pdfium/inc/pch/precompiled_pdfium.hxx +++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-09-21 15:21:21 using: + Generated on 2022-11-08 17:05:53 using: ./bin/update_pch external/pdfium pdfium --cutoff=1 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -127,11 +126,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -189,9 +190,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -309,6 +308,8 @@ #include #include #include +#include +#include #include #include #include @@ -461,22 +462,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include -- cgit