external: update pdfium to 4380
Allows dropping 5 upstreamed patches. Change-Id: I5f77502c5a2d11288b060956e69fd7767f52ab97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109195 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
@@ -212,8 +212,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
|
||||
export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
|
||||
export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
|
||||
export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
|
||||
export PDFIUM_SHA256SUM := eca406d47ac7e2a84dcc86f93c08f96e591d409589e881477fa75e488e4851d8
|
||||
export PDFIUM_TARBALL := pdfium-4306.tar.bz2
|
||||
export PDFIUM_SHA256SUM := 7676aba84cb064e5e6f3a5173284087372761d1f704b0626570fce0445de520e
|
||||
export PDFIUM_TARBALL := pdfium-4380.tar.bz2
|
||||
export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
|
||||
export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
|
||||
export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
|
||||
|
@@ -1,89 +0,0 @@
|
||||
From 305d2ed186c9e1e7c3d0f914235e926e27b35a9f Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Tue, 15 Dec 2020 17:28:49 +0000
|
||||
Subject: [PATCH] Add FPDFAnnot_GetBorder() API
|
||||
|
||||
This is similar to FPDFAnnot_GetLine(), but a /Border key is valid for
|
||||
all annotation types.
|
||||
|
||||
The array can have an optional 4th element, but that itself doesn't have
|
||||
a fixed size, so it's not exposed by this API -- could be done by a
|
||||
separate function.
|
||||
|
||||
Change-Id: I796c2ea17be1f039a6c6129dbde0b0a22276e19a
|
||||
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/77010
|
||||
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
||||
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
||||
---
|
||||
fpdfsdk/fpdf_annot.cpp | 23 +++++++++++++++++
|
||||
fpdfsdk/fpdf_annot_embeddertest.cpp | 40 +++++++++++++++++++++++++++++
|
||||
fpdfsdk/fpdf_view_c_api_test.c | 1 +
|
||||
public/fpdf_annot.h | 16 ++++++++++++
|
||||
testing/resources/line_annot.in | 2 ++
|
||||
testing/resources/line_annot.pdf | 6 +++--
|
||||
6 files changed, 86 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
|
||||
index 85f86e547..eee3567d4 100644
|
||||
--- a/fpdfsdk/fpdf_annot.cpp
|
||||
+++ b/fpdfsdk/fpdf_annot.cpp
|
||||
@@ -913,6 +913,29 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetLine(FPDF_ANNOTATION annot,
|
||||
return true;
|
||||
}
|
||||
|
||||
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
|
||||
+FPDFAnnot_GetBorder(FPDF_ANNOTATION annot,
|
||||
+ float* horizontal_radius,
|
||||
+ float* vertical_radius,
|
||||
+ float* border_width) {
|
||||
+ if (!horizontal_radius || !vertical_radius || !border_width)
|
||||
+ return false;
|
||||
+
|
||||
+ CPDF_Dictionary* annot_dict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
+ if (!annot_dict)
|
||||
+ return false;
|
||||
+
|
||||
+ CPDF_Array* border = annot_dict->GetArrayFor(pdfium::annotation::kBorder);
|
||||
+ if (!border || border->size() < 3)
|
||||
+ return false;
|
||||
+
|
||||
+ *horizontal_radius = border->GetNumberAt(0);
|
||||
+ *vertical_radius = border->GetNumberAt(1);
|
||||
+ *border_width = border->GetNumberAt(2);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot,
|
||||
FPDF_BYTESTRING key) {
|
||||
CPDF_Dictionary* pAnnotDict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
|
||||
index 6c8a237e7..2b708af13 100644
|
||||
--- a/public/fpdf_annot.h
|
||||
+++ b/public/fpdf_annot.h
|
||||
@@ -452,6 +452,22 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetLine(FPDF_ANNOTATION annot,
|
||||
FS_POINTF* start,
|
||||
FS_POINTF* end);
|
||||
|
||||
+// Experimental API.
|
||||
+// Get the characteristics of the annotation's border (rounded rectangle).
|
||||
+//
|
||||
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
|
||||
+// horizontal_radius - horizontal corner radius, in default user space units
|
||||
+// vertical_radius - vertical corner radius, in default user space units
|
||||
+// border_width - border width, in default user space units
|
||||
+//
|
||||
+// Returns true if |horizontal_radius|, |vertical_radius| and |border_width| are
|
||||
+// not NULL, false otherwise.
|
||||
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
|
||||
+FPDFAnnot_GetBorder(FPDF_ANNOTATION annot,
|
||||
+ float* horizontal_radius,
|
||||
+ float* vertical_radius,
|
||||
+ float* border_width);
|
||||
+
|
||||
// Experimental API.
|
||||
// Check if |annot|'s dictionary has |key| as a key.
|
||||
//
|
||||
--
|
||||
2.26.2
|
||||
|
260
external/pdfium/AnnotationInkAndVertices.patch.1
vendored
260
external/pdfium/AnnotationInkAndVertices.patch.1
vendored
@@ -1,260 +0,0 @@
|
||||
From 09ecef60e8292457d9e78a2242f5efec953c2c25 Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Tue, 10 Nov 2020 21:50:38 +0000
|
||||
Subject: [PATCH] Add FPDFAnnot_GetVertices() API
|
||||
|
||||
This follows the same pattern as FPDF_GetTrailerEnds(), so the client
|
||||
has to call this function twice, but allocation of the buffer happens
|
||||
outside pdfium.
|
||||
|
||||
Change-Id: Ic733083eba0b110310d6bbdc48f874bac4c7f2d6
|
||||
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/76050
|
||||
Commit-Queue: Miklos V <vmiklos@collabora.co.uk>
|
||||
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
||||
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
||||
---
|
||||
constants/annotation_common.h | 3 ++
|
||||
fpdfsdk/fpdf_annot.cpp | 28 ++++++++++++
|
||||
fpdfsdk/fpdf_annot_embeddertest.cpp | 67 +++++++++++++++++++++++++++++
|
||||
fpdfsdk/fpdf_view_c_api_test.c | 1 +
|
||||
public/fpdf_annot.h | 16 +++++++
|
||||
testing/resources/polygon_annot.in | 48 +++++++++++++++++++++
|
||||
testing/resources/polygon_annot.pdf | 60 ++++++++++++++++++++++++++
|
||||
7 files changed, 223 insertions(+)
|
||||
create mode 100644 testing/resources/polygon_annot.in
|
||||
create mode 100644 testing/resources/polygon_annot.pdf
|
||||
|
||||
diff --git a/constants/annotation_common.h b/constants/annotation_common.h
|
||||
index 471d24407..6f96e623a 100644
|
||||
--- a/constants/annotation_common.h
|
||||
+++ b/constants/annotation_common.h
|
||||
@@ -26,6 +26,9 @@ constexpr char kC[] = "C";
|
||||
constexpr char kStructParent[] = "StructParent";
|
||||
constexpr char kOC[] = "OC";
|
||||
|
||||
+// Entries for polygon and polyline annotations.
|
||||
+constexpr char kVertices[] = "Vertices";
|
||||
+
|
||||
} // namespace annotation
|
||||
} // namespace pdfium
|
||||
|
||||
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
|
||||
index 28dbe145d..13c73f6aa 100644
|
||||
--- a/fpdfsdk/fpdf_annot.cpp
|
||||
+++ b/fpdfsdk/fpdf_annot.cpp
|
||||
@@ -809,6 +809,34 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetRect(FPDF_ANNOTATION annot,
|
||||
return true;
|
||||
}
|
||||
|
||||
+FPDF_EXPORT unsigned long FPDF_CALLCONV
|
||||
+FPDFAnnot_GetVertices(FPDF_ANNOTATION annot,
|
||||
+ FS_POINTF* buffer,
|
||||
+ unsigned long length) {
|
||||
+ FPDF_ANNOTATION_SUBTYPE subtype = FPDFAnnot_GetSubtype(annot);
|
||||
+ if (subtype != FPDF_ANNOT_POLYGON && subtype != FPDF_ANNOT_POLYLINE)
|
||||
+ return 0;
|
||||
+
|
||||
+ CPDF_Dictionary* annot_dict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
+ if (!annot_dict)
|
||||
+ return 0;
|
||||
+
|
||||
+ CPDF_Array* vertices = annot_dict->GetArrayFor(pdfium::annotation::kVertices);
|
||||
+ if (!vertices)
|
||||
+ return 0;
|
||||
+
|
||||
+ // Truncate to an even number.
|
||||
+ unsigned long points_len = vertices->size() / 2;
|
||||
+ if (buffer && length >= points_len) {
|
||||
+ for (unsigned long i = 0; i < points_len; ++i) {
|
||||
+ buffer[i].x = vertices->GetNumberAt(i * 2);
|
||||
+ buffer[i].y = vertices->GetNumberAt(i * 2 + 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return points_len;
|
||||
+}
|
||||
+
|
||||
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot,
|
||||
FPDF_BYTESTRING key) {
|
||||
CPDF_Dictionary* pAnnotDict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
|
||||
index 93064561b..7159602db 100644
|
||||
--- a/public/fpdf_annot.h
|
||||
+++ b/public/fpdf_annot.h
|
||||
@@ -395,6 +395,22 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetRect(FPDF_ANNOTATION annot,
|
||||
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetRect(FPDF_ANNOTATION annot,
|
||||
FS_RECTF* rect);
|
||||
|
||||
+// Experimental API.
|
||||
+// Get the vertices of a polygon or polyline annotation. |buffer| is an array of
|
||||
+// points of the annotation. If |length| is less than the returned length, or
|
||||
+// |annot| or |buffer| is NULL, |buffer| will not be modified.
|
||||
+//
|
||||
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
|
||||
+// buffer - buffer for holding the points.
|
||||
+// length - length of the buffer in points.
|
||||
+//
|
||||
+// Returns the number of points if the annotation is of type polygon or
|
||||
+// polyline, 0 otherwise.
|
||||
+FPDF_EXPORT unsigned long FPDF_CALLCONV
|
||||
+FPDFAnnot_GetVertices(FPDF_ANNOTATION annot,
|
||||
+ FS_POINTF* buffer,
|
||||
+ unsigned long length);
|
||||
+
|
||||
// Experimental API.
|
||||
// Check if |annot|'s dictionary has |key| as a key.
|
||||
//
|
||||
--
|
||||
2.26.2
|
||||
|
||||
From 8f7b1aed53e31eda9870146cb97602f03a8f23c4 Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Tue, 17 Nov 2020 16:53:14 +0000
|
||||
Subject: [PATCH] Add FPDFAnnot_GetInkListPath() API
|
||||
|
||||
This is somewhat similar to FPDFAnnot_GetVertices(), but this is for ink
|
||||
annotations and here the value is an array of paths.
|
||||
|
||||
So first add an FPDFAnnot_GetInkListCount() to get the number of paths,
|
||||
then FPDFAnnot_GetInkListPath() can be used to get the individual paths.
|
||||
|
||||
Change-Id: I204a5a53e949fdbb7b264711c27107fe62c9f2be
|
||||
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/76350
|
||||
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
||||
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
||||
---
|
||||
constants/annotation_common.h | 3 +
|
||||
fpdfsdk/fpdf_annot.cpp | 50 ++++++++++++++++
|
||||
fpdfsdk/fpdf_annot_embeddertest.cpp | 91 ++++++++++++++++++++++++++++-
|
||||
fpdfsdk/fpdf_view_c_api_test.c | 2 +
|
||||
public/fpdf_annot.h | 28 +++++++++
|
||||
testing/resources/ink_annot.in | 48 +++++++++++++++
|
||||
testing/resources/ink_annot.pdf | 60 +++++++++++++++++++
|
||||
7 files changed, 281 insertions(+), 1 deletion(-)
|
||||
create mode 100644 testing/resources/ink_annot.in
|
||||
create mode 100644 testing/resources/ink_annot.pdf
|
||||
|
||||
diff --git a/constants/annotation_common.h b/constants/annotation_common.h
|
||||
index 6f96e623a..be6420651 100644
|
||||
--- a/constants/annotation_common.h
|
||||
+++ b/constants/annotation_common.h
|
||||
@@ -29,6 +29,9 @@ constexpr char kOC[] = "OC";
|
||||
// Entries for polygon and polyline annotations.
|
||||
constexpr char kVertices[] = "Vertices";
|
||||
|
||||
+// Entries for ink annotations
|
||||
+constexpr char kInkList[] = "InkList";
|
||||
+
|
||||
} // namespace annotation
|
||||
} // namespace pdfium
|
||||
|
||||
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
|
||||
index 13c73f6aa..51b4332c2 100644
|
||||
--- a/fpdfsdk/fpdf_annot.cpp
|
||||
+++ b/fpdfsdk/fpdf_annot.cpp
|
||||
@@ -296,6 +296,18 @@ CPDFSDK_Widget* GetRadioButtonOrCheckBoxWidget(FPDF_FORMHANDLE hHandle,
|
||||
return pFormControl ? pForm->GetWidget(pFormControl) : nullptr;
|
||||
}
|
||||
|
||||
+CPDF_Array* GetInkList(FPDF_ANNOTATION annot) {
|
||||
+ FPDF_ANNOTATION_SUBTYPE subtype = FPDFAnnot_GetSubtype(annot);
|
||||
+ if (subtype != FPDF_ANNOT_INK)
|
||||
+ return 0;
|
||||
+
|
||||
+ CPDF_Dictionary* annot_dict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
+ if (!annot_dict)
|
||||
+ return 0;
|
||||
+
|
||||
+ return annot_dict->GetArrayFor(pdfium::annotation::kInkList);
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
|
||||
@@ -837,6 +849,44 @@ FPDFAnnot_GetVertices(FPDF_ANNOTATION annot,
|
||||
return points_len;
|
||||
}
|
||||
|
||||
+FPDF_EXPORT unsigned long FPDF_CALLCONV
|
||||
+FPDFAnnot_GetInkListCount(FPDF_ANNOTATION annot) {
|
||||
+ CPDF_Array* ink_list = GetInkList(annot);
|
||||
+ if (!ink_list)
|
||||
+ return 0;
|
||||
+
|
||||
+ return ink_list->size();
|
||||
+}
|
||||
+
|
||||
+FPDF_EXPORT unsigned long FPDF_CALLCONV
|
||||
+FPDFAnnot_GetInkListPath(FPDF_ANNOTATION annot,
|
||||
+ unsigned long path_index,
|
||||
+ FS_POINTF* buffer,
|
||||
+ unsigned long length) {
|
||||
+ unsigned long path_count = FPDFAnnot_GetInkListCount(annot);
|
||||
+ if (path_index >= path_count)
|
||||
+ return 0;
|
||||
+
|
||||
+ CPDF_Array* ink_list = GetInkList(annot);
|
||||
+ if (!ink_list)
|
||||
+ return 0;
|
||||
+
|
||||
+ CPDF_Array* path = ink_list->GetArrayAt(path_index);
|
||||
+ if (!path)
|
||||
+ return 0;
|
||||
+
|
||||
+ // Truncate to an even number.
|
||||
+ unsigned long points_len = path->size() / 2;
|
||||
+ if (buffer && length >= points_len) {
|
||||
+ for (unsigned long i = 0; i < points_len; ++i) {
|
||||
+ buffer[i].x = path->GetNumberAt(i * 2);
|
||||
+ buffer[i].y = path->GetNumberAt(i * 2 + 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return points_len;
|
||||
+}
|
||||
+
|
||||
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot,
|
||||
FPDF_BYTESTRING key) {
|
||||
CPDF_Dictionary* pAnnotDict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
|
||||
index 7159602db..d121344f7 100644
|
||||
--- a/public/fpdf_annot.h
|
||||
+++ b/public/fpdf_annot.h
|
||||
@@ -411,6 +411,34 @@ FPDFAnnot_GetVertices(FPDF_ANNOTATION annot,
|
||||
FS_POINTF* buffer,
|
||||
unsigned long length);
|
||||
|
||||
+// Experimental API.
|
||||
+// Get the number of paths in the ink list of an ink annotation.
|
||||
+//
|
||||
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
|
||||
+//
|
||||
+// Returns the number of paths in the ink list if the annotation is of type ink,
|
||||
+// 0 otherwise.
|
||||
+FPDF_EXPORT unsigned long FPDF_CALLCONV
|
||||
+FPDFAnnot_GetInkListCount(FPDF_ANNOTATION annot);
|
||||
+
|
||||
+// Experimental API.
|
||||
+// Get a path in the ink list of an ink annotation. |buffer| is an array of
|
||||
+// points of the path. If |length| is less than the returned length, or |annot|
|
||||
+// or |buffer| is NULL, |buffer| will not be modified.
|
||||
+//
|
||||
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
|
||||
+// path_index - index of the path
|
||||
+// buffer - buffer for holding the points.
|
||||
+// length - length of the buffer in points.
|
||||
+//
|
||||
+// Returns the number of points of the path if the annotation is of type ink, 0
|
||||
+// otherwise.
|
||||
+FPDF_EXPORT unsigned long FPDF_CALLCONV
|
||||
+FPDFAnnot_GetInkListPath(FPDF_ANNOTATION annot,
|
||||
+ unsigned long path_index,
|
||||
+ FS_POINTF* buffer,
|
||||
+ unsigned long length);
|
||||
+
|
||||
// Experimental API.
|
||||
// Check if |annot|'s dictionary has |key| as a key.
|
||||
//
|
||||
--
|
||||
2.26.2
|
||||
|
103
external/pdfium/AnnotationLineStartAndEnd.patch.1
vendored
103
external/pdfium/AnnotationLineStartAndEnd.patch.1
vendored
@@ -1,103 +0,0 @@
|
||||
From 30f45a6f043fc1bbd19eb4820261c45ad68cf1cc Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Fri, 4 Dec 2020 19:12:31 +0000
|
||||
Subject: [PATCH] Add FPDFAnnot_GetLine() API
|
||||
|
||||
This is similar to FPDFAnnot_GetVertices() for polygon/polyline
|
||||
annotations, but this one is for line annotations and the point list has
|
||||
a fixed size of 2.
|
||||
|
||||
Change-Id: If910caaef8c41a9965f2ba47f87c34ea33355f99
|
||||
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/76730
|
||||
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
||||
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
||||
---
|
||||
constants/annotation_common.h | 3 ++
|
||||
fpdfsdk/fpdf_annot.cpp | 26 +++++++++++++
|
||||
fpdfsdk/fpdf_annot_embeddertest.cpp | 45 ++++++++++++++++++++++
|
||||
fpdfsdk/fpdf_view_c_api_test.c | 1 +
|
||||
public/fpdf_annot.h | 13 +++++++
|
||||
testing/resources/line_annot.in | 48 +++++++++++++++++++++++
|
||||
testing/resources/line_annot.pdf | 60 +++++++++++++++++++++++++++++
|
||||
7 files changed, 196 insertions(+)
|
||||
create mode 100644 testing/resources/line_annot.in
|
||||
create mode 100644 testing/resources/line_annot.pdf
|
||||
|
||||
diff --git a/constants/annotation_common.h b/constants/annotation_common.h
|
||||
index be6420651..656842bb5 100644
|
||||
--- a/constants/annotation_common.h
|
||||
+++ b/constants/annotation_common.h
|
||||
@@ -32,6 +32,9 @@ constexpr char kVertices[] = "Vertices";
|
||||
// Entries for ink annotations
|
||||
constexpr char kInkList[] = "InkList";
|
||||
|
||||
+// Entries for line annotations
|
||||
+constexpr char kL[] = "L";
|
||||
+
|
||||
} // namespace annotation
|
||||
} // namespace pdfium
|
||||
|
||||
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
|
||||
index 51b4332c2..85f86e547 100644
|
||||
--- a/fpdfsdk/fpdf_annot.cpp
|
||||
+++ b/fpdfsdk/fpdf_annot.cpp
|
||||
@@ -887,6 +887,32 @@ FPDFAnnot_GetInkListPath(FPDF_ANNOTATION annot,
|
||||
return points_len;
|
||||
}
|
||||
|
||||
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetLine(FPDF_ANNOTATION annot,
|
||||
+ FS_POINTF* start,
|
||||
+ FS_POINTF* end) {
|
||||
+ if (!start || !end)
|
||||
+ return false;
|
||||
+
|
||||
+ FPDF_ANNOTATION_SUBTYPE subtype = FPDFAnnot_GetSubtype(annot);
|
||||
+ if (subtype != FPDF_ANNOT_LINE)
|
||||
+ return false;
|
||||
+
|
||||
+ CPDF_Dictionary* annot_dict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
+ if (!annot_dict)
|
||||
+ return false;
|
||||
+
|
||||
+ CPDF_Array* line = annot_dict->GetArrayFor(pdfium::annotation::kL);
|
||||
+ if (!line || line->size() < 4)
|
||||
+ return false;
|
||||
+
|
||||
+ start->x = line->GetNumberAt(0);
|
||||
+ start->y = line->GetNumberAt(1);
|
||||
+ end->x = line->GetNumberAt(2);
|
||||
+ end->y = line->GetNumberAt(3);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot,
|
||||
FPDF_BYTESTRING key) {
|
||||
CPDF_Dictionary* pAnnotDict = GetAnnotDictFromFPDFAnnotation(annot);
|
||||
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
|
||||
index d121344f7..6c8a237e7 100644
|
||||
--- a/public/fpdf_annot.h
|
||||
+++ b/public/fpdf_annot.h
|
||||
@@ -439,6 +439,19 @@ FPDFAnnot_GetInkListPath(FPDF_ANNOTATION annot,
|
||||
FS_POINTF* buffer,
|
||||
unsigned long length);
|
||||
|
||||
+// Experimental API.
|
||||
+// Get the starting and ending coordinates of a line annotation.
|
||||
+//
|
||||
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
|
||||
+// start - starting point
|
||||
+// end - ending point
|
||||
+//
|
||||
+// Returns true if the annotation is of type line, |start| and |end| are not
|
||||
+// NULL, false otherwise.
|
||||
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetLine(FPDF_ANNOTATION annot,
|
||||
+ FS_POINTF* start,
|
||||
+ FS_POINTF* end);
|
||||
+
|
||||
// Experimental API.
|
||||
// Check if |annot|'s dictionary has |key| as a key.
|
||||
//
|
||||
--
|
||||
2.26.2
|
||||
|
@@ -1,55 +0,0 @@
|
||||
From c10d17dee78d48d5e56da965e0cd02d28fd513a5 Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Wed, 9 Dec 2020 17:42:53 +0000
|
||||
Subject: [PATCH] FPDF_GetTrailerEnds: make this not depend on whitespace
|
||||
|
||||
PDF-1.7 calls out no bytes other than whitespace when specifying what
|
||||
can occur between endstream and endobj, so whitespace needs to be
|
||||
handled. When CPDF_SyntaxParser::ReadStream() reads the stream, it reads
|
||||
'endobj', and then resets the position back to the end of 'endstream'.
|
||||
This mechanism is disabled in case there is whitespace between the
|
||||
tokens and the newline, see the end of the function.
|
||||
|
||||
This results in reporting no trailer ends, as the parsing fails, as the
|
||||
next token is expected to be 'endobj', but it's the ID of the next
|
||||
object instead.
|
||||
|
||||
Fix the problem by handling whitespace in
|
||||
CPDF_SyntaxParser::ReadStream() where it was looking for \ntoken\n, not
|
||||
allowing whitespace between the token and the following newline.
|
||||
|
||||
Change-Id: I7048e8d081af04af3dd08d957212c885b7982b5e
|
||||
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/76850
|
||||
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
||||
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
||||
---
|
||||
core/fpdfapi/parser/cpdf_syntax_parser.cpp | 8 ++
|
||||
fpdfsdk/fpdf_view_embeddertest.cpp | 14 +++
|
||||
.../resources/trailer_end_trailing_space.in | 86 ++++++++++++++++
|
||||
.../resources/trailer_end_trailing_space.pdf | 99 +++++++++++++++++++
|
||||
4 files changed, 207 insertions(+)
|
||||
create mode 100644 testing/resources/trailer_end_trailing_space.in
|
||||
create mode 100644 testing/resources/trailer_end_trailing_space.pdf
|
||||
|
||||
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
|
||||
index 06389bccc..5318efdc1 100644
|
||||
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
|
||||
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
|
||||
@@ -795,6 +795,14 @@ RetainPtr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
|
||||
memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1);
|
||||
GetNextWordInternal(nullptr);
|
||||
|
||||
+ // Allow whitespace after endstream and before a newline.
|
||||
+ unsigned char ch = 0;
|
||||
+ while (GetNextChar(ch)) {
|
||||
+ if (!PDFCharIsWhitespace(ch) || PDFCharIsLineEnding(ch))
|
||||
+ break;
|
||||
+ }
|
||||
+ SetPos(GetPos() - 1);
|
||||
+
|
||||
int numMarkers = ReadEOLMarkers(GetPos());
|
||||
if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) &&
|
||||
numMarkers != 0 &&
|
||||
--
|
||||
2.26.2
|
||||
|
345
external/pdfium/SignatureGetDocMDPPermission.patch.1
vendored
345
external/pdfium/SignatureGetDocMDPPermission.patch.1
vendored
@@ -1,345 +0,0 @@
|
||||
From f63c9650bca285932fb4dced804f9eec7e40b5ff Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Tue, 3 Nov 2020 16:32:12 +0000
|
||||
Subject: [PATCH] Add FPDFSignatureObj_GetDocMDPPermission()
|
||||
|
||||
A document is OK to not contain any explicit markup for this, in which
|
||||
case 0 is returned. If a permission parameter is found, then the
|
||||
returned level of 1, 2 or 3 controls if no incremental updates are
|
||||
allowed (1) or incremental updates are OK, but annotations are not
|
||||
allowed (2) or even annotations are allowed (3).
|
||||
|
||||
Note how there is a difference between omitting just the /P key
|
||||
(implicitly means 2) and omitting the more of this markup, which will
|
||||
return 0.
|
||||
|
||||
This API is meant to be used in combination with the
|
||||
FPDF_GetTrailerEnds() API, which allows detecting additional incremental
|
||||
updates after a signature. For example, if a comment is added after
|
||||
signing, then Permission=1 would result in an invalid signature, while
|
||||
Permission=3 just results in a partial signature.
|
||||
|
||||
Change-Id: I911e9ddaff3a687729e7fe610c013b2ce3283d36
|
||||
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75910
|
||||
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
||||
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
||||
---
|
||||
fpdfsdk/fpdf_signature.cpp | 41 ++++++++++
|
||||
fpdfsdk/fpdf_signature_embeddertest.cpp | 13 +++
|
||||
fpdfsdk/fpdf_view_c_api_test.c | 1 +
|
||||
public/fpdf_signature.h | 11 +++
|
||||
testing/resources/docmdp.in | 88 ++++++++++++++++++++
|
||||
testing/resources/docmdp.pdf | 102 ++++++++++++++++++++++++
|
||||
6 files changed, 256 insertions(+)
|
||||
create mode 100644 testing/resources/docmdp.in
|
||||
create mode 100644 testing/resources/docmdp.pdf
|
||||
|
||||
diff --git a/fpdfsdk/fpdf_signature.cpp b/fpdfsdk/fpdf_signature.cpp
|
||||
index b438b8f6a..975c2522e 100644
|
||||
--- a/fpdfsdk/fpdf_signature.cpp
|
||||
+++ b/fpdfsdk/fpdf_signature.cpp
|
||||
@@ -157,3 +157,44 @@ FPDFSignatureObj_GetTime(FPDF_SIGNATURE signature,
|
||||
|
||||
return NulTerminateMaybeCopyAndReturnLength(obj->GetString(), buffer, length);
|
||||
}
|
||||
+
|
||||
+FPDF_EXPORT unsigned int FPDF_CALLCONV
|
||||
+FPDFSignatureObj_GetDocMDPPermission(FPDF_SIGNATURE signature) {
|
||||
+ int permission = 0;
|
||||
+ CPDF_Dictionary* signature_dict = CPDFDictionaryFromFPDFSignature(signature);
|
||||
+ if (!signature_dict)
|
||||
+ return permission;
|
||||
+
|
||||
+ CPDF_Dictionary* value_dict = signature_dict->GetDictFor("V");
|
||||
+ if (!value_dict)
|
||||
+ return permission;
|
||||
+
|
||||
+ CPDF_Array* references = value_dict->GetArrayFor("Reference");
|
||||
+ if (!references)
|
||||
+ return permission;
|
||||
+
|
||||
+ CPDF_ArrayLocker locker(references);
|
||||
+ for (auto& reference : locker) {
|
||||
+ CPDF_Dictionary* reference_dict = reference->GetDict();
|
||||
+ if (!reference_dict)
|
||||
+ continue;
|
||||
+
|
||||
+ ByteString transform_method = reference_dict->GetNameFor("TransformMethod");
|
||||
+ if (transform_method != "DocMDP")
|
||||
+ continue;
|
||||
+
|
||||
+ CPDF_Dictionary* transform_params =
|
||||
+ reference_dict->GetDictFor("TransformParams");
|
||||
+ if (!transform_params)
|
||||
+ continue;
|
||||
+
|
||||
+ // Valid values are 1, 2 and 3; 2 is the default.
|
||||
+ permission = transform_params->GetIntegerFor("P", 2);
|
||||
+ if (permission < 1 || permission > 3)
|
||||
+ permission = 0;
|
||||
+
|
||||
+ return permission;
|
||||
+ }
|
||||
+
|
||||
+ return permission;
|
||||
+}
|
||||
diff --git a/fpdfsdk/fpdf_signature_embeddertest.cpp b/fpdfsdk/fpdf_signature_embeddertest.cpp
|
||||
index d2fd9c663..e91d9c221 100644
|
||||
--- a/fpdfsdk/fpdf_signature_embeddertest.cpp
|
||||
+++ b/fpdfsdk/fpdf_signature_embeddertest.cpp
|
||||
@@ -187,3 +187,16 @@ TEST_F(FPDFSignatureEmbedderTest, GetTime) {
|
||||
EXPECT_EQ('x', time_buffer[0]);
|
||||
EXPECT_EQ('\0', time_buffer[1]);
|
||||
}
|
||||
+
|
||||
+TEST_F(FPDFSignatureEmbedderTest, GetDocMDPPermission) {
|
||||
+ ASSERT_TRUE(OpenDocument("docmdp.pdf"));
|
||||
+ FPDF_SIGNATURE signature = FPDF_GetSignatureObject(document(), 0);
|
||||
+ ASSERT_NE(nullptr, signature);
|
||||
+
|
||||
+ // FPDFSignatureObj_GetDocMDPPermission() positive testing.
|
||||
+ unsigned int permission = FPDFSignatureObj_GetDocMDPPermission(signature);
|
||||
+ EXPECT_EQ(1U, permission);
|
||||
+
|
||||
+ // FPDFSignatureObj_GetDocMDPPermission() negative testing.
|
||||
+ EXPECT_EQ(0U, FPDFSignatureObj_GetDocMDPPermission(nullptr));
|
||||
+}
|
||||
diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c
|
||||
index 7708cbab9..1142725d6 100644
|
||||
--- a/fpdfsdk/fpdf_view_c_api_test.c
|
||||
+++ b/fpdfsdk/fpdf_view_c_api_test.c
|
||||
@@ -320,6 +320,7 @@ int CheckPDFiumCApi() {
|
||||
// fpdf_signature.h
|
||||
CHK(FPDFSignatureObj_GetByteRange);
|
||||
CHK(FPDFSignatureObj_GetContents);
|
||||
+ CHK(FPDFSignatureObj_GetDocMDPPermission);
|
||||
CHK(FPDFSignatureObj_GetReason);
|
||||
CHK(FPDFSignatureObj_GetSubFilter);
|
||||
CHK(FPDFSignatureObj_GetTime);
|
||||
diff --git a/public/fpdf_signature.h b/public/fpdf_signature.h
|
||||
index f20d9add3..702b67bae 100644
|
||||
--- a/public/fpdf_signature.h
|
||||
+++ b/public/fpdf_signature.h
|
||||
@@ -137,6 +137,17 @@ FPDFSignatureObj_GetTime(FPDF_SIGNATURE signature,
|
||||
char* buffer,
|
||||
unsigned long length);
|
||||
|
||||
+// Experimental API.
|
||||
+// Function: FPDFSignatureObj_GetDocMDPPermission
|
||||
+// Get the DocMDP permission of a signature object.
|
||||
+// Parameters:
|
||||
+// signature - Handle to the signature object. Returned by
|
||||
+// FPDF_GetSignatureObject().
|
||||
+// Return value:
|
||||
+// Returns the permission (1, 2 or 3) on success, 0 on error.
|
||||
+FPDF_EXPORT unsigned int FPDF_CALLCONV
|
||||
+FPDFSignatureObj_GetDocMDPPermission(FPDF_SIGNATURE signature);
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
diff --git a/testing/resources/docmdp.in b/testing/resources/docmdp.in
|
||||
new file mode 100644
|
||||
index 000000000..a8fe28373
|
||||
--- /dev/null
|
||||
+++ b/testing/resources/docmdp.in
|
||||
@@ -0,0 +1,88 @@
|
||||
+{{header}}
|
||||
+{{object 1 0}} <<
|
||||
+ /Type /Catalog
|
||||
+ /Pages 2 0 R
|
||||
+ /AcroForm <<
|
||||
+ /Fields [7 0 R]
|
||||
+ /SigFlags 3
|
||||
+ >>
|
||||
+>>
|
||||
+endobj
|
||||
+endobj
|
||||
+{{object 2 0}} <<
|
||||
+ /Type /Pages
|
||||
+ /MediaBox [0 0 200 300]
|
||||
+ /Count 1
|
||||
+ /Kids [3 0 R]
|
||||
+>>
|
||||
+endobj
|
||||
+{{object 3 0}} <<
|
||||
+ /Type /Page
|
||||
+ /Parent 2 0 R
|
||||
+ /Contents 4 0 R
|
||||
+ /Annots [7 0 R]
|
||||
+>>
|
||||
+endobj
|
||||
+{{object 4 0}} <<
|
||||
+ {{streamlen}}
|
||||
+>>
|
||||
+stream
|
||||
+q
|
||||
+0 0 0 rg
|
||||
+0 290 10 10 re B*
|
||||
+10 150 50 30 re B*
|
||||
+0 0 1 rg
|
||||
+190 290 10 10 re B*
|
||||
+70 232 50 30 re B*
|
||||
+0 1 0 rg
|
||||
+190 0 10 10 re B*
|
||||
+130 150 50 30 re B*
|
||||
+1 0 0 rg
|
||||
+0 0 10 10 re B*
|
||||
+70 67 50 30 re B*
|
||||
+Q
|
||||
+endstream
|
||||
+endobj
|
||||
+{{object 5 0}} <<
|
||||
+ /Type /Sig
|
||||
+ /Reference [
|
||||
+ <<
|
||||
+ /Type /SigRef
|
||||
+ /TransformMethod /DocMDP
|
||||
+ /TransformParams <<
|
||||
+ /Type /TransformParams
|
||||
+ /P 1
|
||||
+ /V /1.2
|
||||
+ >>
|
||||
+ >>
|
||||
+ ]
|
||||
+>>
|
||||
+endobj
|
||||
+{{object 6 0}} <<
|
||||
+ /Type /XObject
|
||||
+ /Subtype /Form
|
||||
+ /BBox [0 0 0 0]
|
||||
+ /Length 0
|
||||
+>>
|
||||
+stream
|
||||
+endstream
|
||||
+endobj
|
||||
+{{object 7 0}} <<
|
||||
+ /Type /Annot
|
||||
+ /Subtype /Widget
|
||||
+ /FT /Sig
|
||||
+ /F 132
|
||||
+ /Rect [0 0 0 0]
|
||||
+ /P 3 0 R
|
||||
+ /T (Signature1)
|
||||
+ /V 5 0 R
|
||||
+ /DV 5 0 R
|
||||
+ /AP <<
|
||||
+ /N 6 0 R
|
||||
+ >>
|
||||
+>>
|
||||
+endobj
|
||||
+{{xref}}
|
||||
+{{trailer}}
|
||||
+{{startxref}}
|
||||
+%%EOF
|
||||
diff --git a/testing/resources/docmdp.pdf b/testing/resources/docmdp.pdf
|
||||
new file mode 100644
|
||||
index 000000000..0191a0029
|
||||
--- /dev/null
|
||||
+++ b/testing/resources/docmdp.pdf
|
||||
@@ -0,0 +1,102 @@
|
||||
+%PDF-1.7
|
||||
+%<25><><EFBFBD><EFBFBD>
|
||||
+1 0 obj <<
|
||||
+ /Type /Catalog
|
||||
+ /Pages 2 0 R
|
||||
+ /AcroForm <<
|
||||
+ /Fields [7 0 R]
|
||||
+ /SigFlags 3
|
||||
+ >>
|
||||
+>>
|
||||
+endobj
|
||||
+endobj
|
||||
+2 0 obj <<
|
||||
+ /Type /Pages
|
||||
+ /MediaBox [0 0 200 300]
|
||||
+ /Count 1
|
||||
+ /Kids [3 0 R]
|
||||
+>>
|
||||
+endobj
|
||||
+3 0 obj <<
|
||||
+ /Type /Page
|
||||
+ /Parent 2 0 R
|
||||
+ /Contents 4 0 R
|
||||
+ /Annots [7 0 R]
|
||||
+>>
|
||||
+endobj
|
||||
+4 0 obj <<
|
||||
+ /Length 188
|
||||
+>>
|
||||
+stream
|
||||
+q
|
||||
+0 0 0 rg
|
||||
+0 290 10 10 re B*
|
||||
+10 150 50 30 re B*
|
||||
+0 0 1 rg
|
||||
+190 290 10 10 re B*
|
||||
+70 232 50 30 re B*
|
||||
+0 1 0 rg
|
||||
+190 0 10 10 re B*
|
||||
+130 150 50 30 re B*
|
||||
+1 0 0 rg
|
||||
+0 0 10 10 re B*
|
||||
+70 67 50 30 re B*
|
||||
+Q
|
||||
+endstream
|
||||
+endobj
|
||||
+5 0 obj <<
|
||||
+ /Type /Sig
|
||||
+ /Reference [
|
||||
+ <<
|
||||
+ /Type /SigRef
|
||||
+ /TransformMethod /DocMDP
|
||||
+ /TransformParams <<
|
||||
+ /Type /TransformParams
|
||||
+ /P 1
|
||||
+ /V /1.2
|
||||
+ >>
|
||||
+ >>
|
||||
+ ]
|
||||
+>>
|
||||
+endobj
|
||||
+6 0 obj <<
|
||||
+ /Type /XObject
|
||||
+ /Subtype /Form
|
||||
+ /BBox [0 0 0 0]
|
||||
+ /Length 0
|
||||
+>>
|
||||
+stream
|
||||
+endstream
|
||||
+endobj
|
||||
+7 0 obj <<
|
||||
+ /Type /Annot
|
||||
+ /Subtype /Widget
|
||||
+ /FT /Sig
|
||||
+ /F 132
|
||||
+ /Rect [0 0 0 0]
|
||||
+ /P 3 0 R
|
||||
+ /T (Signature1)
|
||||
+ /V 5 0 R
|
||||
+ /DV 5 0 R
|
||||
+ /AP <<
|
||||
+ /N 6 0 R
|
||||
+ >>
|
||||
+>>
|
||||
+endobj
|
||||
+xref
|
||||
+0 8
|
||||
+0000000000 65535 f
|
||||
+0000000015 00000 n
|
||||
+0000000131 00000 n
|
||||
+0000000220 00000 n
|
||||
+0000000307 00000 n
|
||||
+0000000547 00000 n
|
||||
+0000000760 00000 n
|
||||
+0000000862 00000 n
|
||||
+trailer <<
|
||||
+ /Root 1 0 R
|
||||
+ /Size 8
|
||||
+>>
|
||||
+startxref
|
||||
+1034
|
||||
+%%EOF
|
||||
--
|
||||
2.26.2
|
||||
|
11
external/pdfium/UnpackedTarball_pdfium.mk
vendored
11
external/pdfium/UnpackedTarball_pdfium.mk
vendored
@@ -14,17 +14,6 @@ pdfium_patches += build.patch.1
|
||||
# Avoids Windows 8 build dependency.
|
||||
pdfium_patches += windows7.patch.1
|
||||
pdfium_patches += c++20-comparison.patch
|
||||
# Backport of <https://pdfium-review.googlesource.com/c/pdfium/+/76050> and
|
||||
# <https://pdfium-review.googlesource.com/c/pdfium/+/76350>.
|
||||
pdfium_patches += AnnotationInkAndVertices.patch.1
|
||||
# Backport of <https://pdfium-review.googlesource.com/c/pdfium/+/76730>.
|
||||
pdfium_patches += AnnotationLineStartAndEnd.patch.1
|
||||
# Backport of <https://pdfium-review.googlesource.com/c/pdfium/+/77010>.
|
||||
pdfium_patches += AnnotationBorderProperties.patch.1
|
||||
# Backport of <https://pdfium-review.googlesource.com/c/pdfium/+/75910>.
|
||||
pdfium_patches += SignatureGetDocMDPPermission.patch.1
|
||||
# Backport of <https://pdfium-review.googlesource.com/c/pdfium/+/76850>.
|
||||
pdfium_patches += FPDF_GetTrailerEnds-make-this-not-depend-on-whitespa.patch.1
|
||||
|
||||
# Work around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94141> "c++20 rewritten operator==
|
||||
# recursive call mixing friend and external operators for template class" in GCC with
|
||||
|
Reference in New Issue
Block a user