summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-17 21:23:40 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-12-21 10:07:06 +0100
commit77329f71fbeba4ca2f8f5a7bfde004e6a3941cd2 (patch)
tree4104828e458c99f88e6077dec8f3098ea8036be5
parent998d42ac58e5532e2a07cc10204d9804ff3411cb (diff)
pdfium: update to 3471
Allows dropping 4 API patches + the one that allows building against system ICU. (cherry picked from commit 1445d84cdc906fabf6cc7a59f3c94b4049477701) Conflicts: external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 external/pdfium/UnpackedTarball_pdfium.mk [ Also split up edit.patch.1 which as done when forward-porting from cp-6.0 to cp-6.2, so not something that could be backported explicitly. ] Change-Id: Ib5c63ba7daf51b320c07b24486f7398bf71bcfbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107340 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--download.lst4
-rw-r--r--external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.282
-rw-r--r--external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.258
-rw-r--r--external/pdfium/0004-svx-support-PDF-text-color.patch.2119
-rw-r--r--external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2100
-rw-r--r--external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.294
-rw-r--r--external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.275
-rw-r--r--external/pdfium/0012-svx-import-processed-PDF-text.patch.2148
-rw-r--r--external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.283
-rw-r--r--external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.277
-rw-r--r--external/pdfium/Library_pdfium.mk4
-rw-r--r--external/pdfium/UnpackedTarball_pdfium.mk11
-rw-r--r--external/pdfium/build.patch.153
-rw-r--r--external/pdfium/edit.patch.1757
-rw-r--r--external/pdfium/icu.patch.113
-rw-r--r--svx/source/svdraw/svdpdf.cxx4
16 files changed, 891 insertions, 791 deletions
diff --git a/download.lst b/download.lst
index 3634e1958e9c..32af131027b1 100644
--- a/download.lst
+++ b/download.lst
@@ -214,8 +214,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 := 80331b48166501a192d65476932f17044eeb5f10faa6ea50f4f175169475c957
-export PDFIUM_TARBALL := pdfium-3426.tar.bz2
+export PDFIUM_SHA256SUM := 4acbc905fee1743e96169ca155347a81fb2b0f381281109c1860aa4408ec6c4f
+export PDFIUM_TARBALL := pdfium-3471.tar.bz2
export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
new file mode 100644
index 000000000000..ef6649b5f4cb
--- /dev/null
+++ b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
@@ -0,0 +1,82 @@
+From 5f83d0a3fac4f8ccef457c03b74433ffd7b12e2a Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:28:30 +0200
+Subject: [PATCH 02/14] svx: more accurate PDF text importing
+
+---
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 84 ++++++++++++++++++++++++++++++++++++++++
+ pdfium/public/fpdf_edit.h | 36 +++++++++++++++++
+ 2 files changed, 120 insertions(+)
+
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index 912df63..3244943 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -13,6 +13,7 @@
+
+ #include "constants/page_object.h"
+ #include "core/fpdfapi/edit/cpdf_pagecontentgenerator.h"
++#include "core/fpdfapi/font/cpdf_font.h"
+ #include "core/fpdfapi/page/cpdf_form.h"
+ #include "core/fpdfapi/page/cpdf_formobject.h"
+ #include "core/fpdfapi/page/cpdf_imageobject.h"
+@@ -440,6 +441,26 @@ FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
+ pPageObj->Transform(matrix);
+ }
+
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object)
++{
++ if (!text_object)
++ return 0;
++
++ CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
++ return pTxtObj->CountChars();
++}
++
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
++{
++ if (!text_object)
++ return 0;
++
++ CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
++ return pTxtObj->GetFontSize();
++}
++
+ FPDF_EXPORT void FPDF_CALLCONV
+ FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
+ FPDF_BYTESTRING blend_mode) {
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1107,6 +1107,26 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ FPDF_FONT font,
+ float font_size);
+
++// Get the number of characters from a text object.
++//
++// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
++// or FPDFPageObj_NewTextObjEx.
++// Return Value:
++// A character count in the text object.
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
++
++
++// Get the font size of a text object.
++//
++// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
++// or FPDFPageObj_NewTextObjEx.
++//
++// Return Value:
++// The value of the font size
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
++
+ #ifdef __cplusplus
+ } // extern "C"
+ #endif // __cplusplus
+--
+2.16.3
+
diff --git a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
new file mode 100644
index 000000000000..21c3d007fb3d
--- /dev/null
+++ b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
@@ -0,0 +1,58 @@
+From faeac63865eeb791501d7535f1e7a7c7fc807b04 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:29:15 +0200
+Subject: [PATCH 03/14] svx: import PDF images as BGRA
+
+---
+ pdfium/fpdfsdk/fpdf_editimg.cpp | 20 ++++++++++++++++++++
+ pdfium/public/fpdfview.h | 3 +++
+ 2 files changed, 23 insertions(+)
+
+diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp
+index fed1581..3f400c7 100644
+--- a/pdfium/fpdfsdk/fpdf_editimg.cpp
++++ b/pdfium/fpdfsdk/fpdf_editimg.cpp
+@@ -186,6 +186,26 @@ FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object) {
+ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
+ }
+
++FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
++FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
++ CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object);
++ if (!pObj || !pObj->IsImage())
++ return nullptr;
++
++ RetainPtr<CPDF_Image> pImg = pObj->AsImage()->GetImage();
++ if (!pImg)
++ return nullptr;
++
++ RetainPtr<CFX_DIBSource> pSource = pImg->LoadDIBSource();
++ if (!pSource)
++ return nullptr;
++
++ RetainPtr<CFX_DIBitmap> pBitmap;
++ pBitmap = pSource->CloneConvert(FXDIB_Argb);
++
++ return pBitmap.Leak();
++}
++
+ FPDF_EXPORT unsigned long FPDF_CALLCONV
+ FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
+ void* buffer,
+diff --git a/pdfium/public/fpdfview.h b/pdfium/public/fpdfview.h
+index 0ccd140..b451b9c 100644
+--- a/pdfium/public/fpdfview.h
++++ b/pdfium/public/fpdfview.h
+@@ -905,6 +905,9 @@ FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width,
+ // function; see the list of such formats above.
+ FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap);
+
++FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
++FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object);
++
+ // Function: FPDFBitmap_FillRect
+ // Fill a rectangle in a bitmap.
+ // Parameters:
+--
+2.16.3
+
diff --git a/external/pdfium/0004-svx-support-PDF-text-color.patch.2 b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
new file mode 100644
index 000000000000..a99f8f5966dd
--- /dev/null
+++ b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
@@ -0,0 +1,119 @@
+From 914467a56b9c4cd6a27cfa9b7ed61ebfb5a122d3 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:29:49 +0200
+Subject: [PATCH 04/14] svx: support PDF text color
+
+---
+ pdfium/fpdfsdk/cpdfsdk_helpers.h | 5 +++++
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 30 +++++++++++++++++++++++++-----
+ pdfium/public/fpdf_edit.h | 16 ++++++++++++++++
+ 3 files changed, 46 insertions(+), 5 deletions(-)
+
+diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+index d93ecfc..13362cf 100644
+--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
++++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+@@ -204,6 +204,11 @@ inline CPDF_TextPageFind* CPDFTextPageFindFromFPDFSchHandle(
+ return reinterpret_cast<CPDF_TextPageFind*>(handle);
+ }
+
++inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
++ FPDF_PAGEOBJECT page_object) {
++ return reinterpret_cast<CPDF_TextObject*>(page_object);
++}
++
+ ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
+
+ #ifdef PDF_ENABLE_XFA
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index 3244943..f8e2418 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -443,7 +443,7 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object)
+ if (!text_object)
+ return 0;
+
+- CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
++ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
+ return pTxtObj->CountChars();
+ }
+
+@@ -453,7 +453,7 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
+ if (!text_object)
+ return 0;
+
+- CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
++ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
+ return pTxtObj->GetFontSize();
+ }
+
+@@ -645,3 +645,23 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+ pPageObj->SetDirty(true);
+ return true;
+ }
++
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
++ unsigned int* R,
++ unsigned int* G,
++ unsigned int* B,
++ unsigned int* A)
++{
++ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
++ if (!pTxtObj || !R || !G || !B || !A)
++ return false;
++
++ const uint32_t strokeRGB = pTxtObj->m_ColorState.GetStrokeRGB();
++ *R = FXSYS_GetRValue(strokeRGB);
++ *G = FXSYS_GetGValue(strokeRGB);
++ *B = FXSYS_GetBValue(strokeRGB);
++ *A = static_cast<unsigned int>(
++ (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
++ return true;
++}
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+index 602849f..fa9902e 100644
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1016,6 +1016,22 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
+
++// Get the stroke RGBA of a text. Range of values: 0 - 255.
++//
++// path - the handle to the path object.
++// R - the red component of the path stroke color.
++// G - the green component of the path stroke color.
++// B - the blue component of the path stroke color.
++// A - the stroke alpha of the path.
++//
++// Returns TRUE on success.
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
++ unsigned int* R,
++ unsigned int* G,
++ unsigned int* B,
++ unsigned int* A);
++
+ #ifdef __cplusplus
+ } // extern "C"
+ #endif // __cplusplus
+diff --git a/pdfium/fpdfsdk/fpdf_edittext.cpp b/pdfium/fpdfsdk/fpdf_edittext.cpp
+index c38873faa..aa3287ef4 100644
+--- a/pdfium/fpdfsdk/fpdf_edittext.cpp
++++ b/pdfium/fpdfsdk/fpdf_edittext.cpp
+@@ -398,11 +398,6 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
+ return pDoc->LoadFont(fontDict);
+ }
+
+-CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
+- auto* obj = CPDFPageObjectFromFPDFPageObject(page_object);
+- return obj ? obj->AsText() : nullptr;
+-}
+-
+ } // namespace
+
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+--
+2.16.3
+
diff --git a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 b/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
new file mode 100644
index 000000000000..c141cc4b58ea
--- /dev/null
+++ b/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
@@ -0,0 +1,100 @@
+From 32ec9efddb8e1706085478fd8434dd2860840345 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:33:56 +0200
+Subject: [PATCH 09/14] svx: support color text for imported PDFs
+
+---
+ pdfium/core/fpdfapi/page/cpdf_imageobject.cpp | 2 +-
+ pdfium/core/fxge/cfx_pathdata.cpp | 4 +--
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 47 ++++++++++++++++++++++-----
+ pdfium/public/fpdf_edit.h | 10 +++---
+ 4 files changed, 46 insertions(+), 17 deletions(-)
+
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index 2249e8e..9c353a4 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -733,21 +733,50 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
+ }
+
+ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+-FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
+- unsigned int* R,
+- unsigned int* G,
+- unsigned int* B,
+- unsigned int* A)
++FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
++ unsigned int* R,
++ unsigned int* G,
++ unsigned int* B,
++ unsigned int* A)
+ {
+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
+ if (!pTxtObj || !R || !G || !B || !A)
+ return false;
+
+- const uint32_t strokeRGB = pTxtObj->m_ColorState.GetStrokeRGB();
+- *R = FXSYS_GetRValue(strokeRGB);
+- *G = FXSYS_GetGValue(strokeRGB);
+- *B = FXSYS_GetBValue(strokeRGB);
++ bool bFill = false;
++ bool bStroke = false;
++ CPDF_Font* pFont = pTxtObj->m_TextState.GetFont();
++ const TextRenderingMode text_render_mode = pTxtObj->m_TextState.GetTextMode();
++ switch (text_render_mode)
++ {
++ case TextRenderingMode::MODE_FILL:
++ case TextRenderingMode::MODE_FILL_CLIP:
++ bFill = true;
++ break;
++ case TextRenderingMode::MODE_STROKE:
++ case TextRenderingMode::MODE_STROKE_CLIP:
++ if (pFont->GetFace())
++ bStroke = true;
++ else
++ bFill = true;
++ break;
++ case TextRenderingMode::MODE_FILL_STROKE:
++ case TextRenderingMode::MODE_FILL_STROKE_CLIP:
++ bFill = true;
++ if (pFont->GetFace())
++ bStroke = true;
++ break;
++ case TextRenderingMode::MODE_INVISIBLE:
++ case TextRenderingMode::MODE_CLIP:
++ return false;
++ }
++
++ const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB();
++ *R = FXSYS_GetRValue(RGB);
++ *G = FXSYS_GetGValue(RGB);
++ *B = FXSYS_GetBValue(RGB);
+ *A = static_cast<unsigned int>(
+ (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
++
+ return true;
+ }
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+index fc906f4..4264ccd 100644
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1075,11 +1075,11 @@ FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
+ //
+ // Returns TRUE on success.
+ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+-FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
+- unsigned int* R,
+- unsigned int* G,
+- unsigned int* B,
+- unsigned int* A);
++FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
++ unsigned int* R,
++ unsigned int* G,
++ unsigned int* B,
++ unsigned int* A);
+
+ #ifdef __cplusplus
+ } // extern "C"
+--
+2.16.3
+
diff --git a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
new file mode 100644
index 000000000000..f0b09bbf7abf
--- /dev/null
+++ b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
@@ -0,0 +1,94 @@
+From 636f92aac24f0accfbce910c9153d5479e097e5f Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:34:38 +0200
+Subject: [PATCH 10/14] svx: support importing forms from PDFs
+
+---
+ pdfium/fpdfsdk/cpdfsdk_helpers.h | 5 +++++
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 30 ++++++++++++++++++++++++++++++
+ pdfium/public/fpdf_edit.h | 17 +++++++++++++++++
+ 3 files changed, 52 insertions(+)
+
+diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+index 13362cf..477bb74 100644
+--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
++++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+@@ -209,6 +209,11 @@ inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
+ return reinterpret_cast<CPDF_TextObject*>(page_object);
+ }
+
++inline CPDF_FormObject* CPDFFormObjectFromFPDFPageObject(
++ FPDF_PAGEOBJECT page_object) {
++ return reinterpret_cast<CPDF_FormObject*>(page_object);
++}
++
+ ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
+
+ #ifdef PDF_ENABLE_XFA
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index 9c353a4..bf68250 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -704,3 +704,31 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
+
+ return true;
+ }
++
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object)
++{
++ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
++ if (pFrmObj)
++ {
++ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
++ if (pObjectList)
++ return pObjectList->size();
++ }
++
++ return 0;
++}
++
++FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
++FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
++{
++ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
++ if (pFrmObj)
++ {
++ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
++ if (pObjectList)
++ return pObjectList->GetPageObjectByIndex(index);
++ }
++
++ return nullptr;
++}
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+index 4264ccd..ca76954 100644
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1081,6 +1081,23 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
+ unsigned int* B,
+ unsigned int* A);
+
++// Get number of page objects inside the form object.
++//
++// form_object - Handle to a form object. Returned by FPDFPage_GetObject.
++// Return value:
++// The number of the page objects.
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object);
++
++// Get the page object from a form object.
++//
++// form_object - Handle to a form object. Returned by FPDFPage_GetObject.
++// index - The index of a page object.
++// Return value:
++// The handle of the page object. Null for failed.
++FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
++FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index);
++
+ #ifdef __cplusplus
+ } // extern "C"
+ #endif // __cplusplus
+--
+2.16.3
+
diff --git a/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 b/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
new file mode 100644
index 000000000000..081840e20576
--- /dev/null
+++ b/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
@@ -0,0 +1,75 @@
+From c82f6e80d94f8598221009035c8f336f5f656333 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:35:14 +0200
+Subject: [PATCH 11/14] svx: correctly possition form objects from PDF
+
+---
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 25 +++++++++++++++++++++++++
+ pdfium/public/fpdf_edit.h | 18 ++++++++++++++++++
+ 2 files changed, 43 insertions(+)
+
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index bf68250..f4a1688 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -810,3 +810,28 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
+
+ return nullptr;
+ }
++
++FPDF_EXPORT void FPDF_CALLCONV
++FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
++ double* a,
++ double* b,
++ double* c,
++ double* d,
++ double* e,
++ double* f)
++{
++ if (!form_object || !a || !b || !c || !d || !e || !f)
++ return;
++
++ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
++ if (pFrmObj)
++ {
++ const CFX_Matrix& matrix = pFrmObj->form_matrix();
++ *a = matrix.a;
++ *b = matrix.b;
++ *c = matrix.c;
++ *d = matrix.d;
++ *e = matrix.e;
++ *f = matrix.f;
++ }
++}
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+index ca76954..f249e64 100644
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1098,6 +1098,24 @@ FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object);
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index);
+
++// Get the matrix of a particular form object.
++//
++// form_object - Handle of form object
++// a - Pointer to a double value receiving coefficient "a" of the matrix.
++// b - Pointer to a double value receiving coefficient "b" of the matrix.
++// c - Pointer to a double value receiving coefficient "c" of the matrix.
++// d - Pointer to a double value receiving coefficient "d" of the matrix.
++// e - Pointer to a double value receiving coefficient "e" of the matrix.
++// f - Pointer to a double value receiving coefficient "f" of the matrix.
++FPDF_EXPORT void FPDF_CALLCONV
++FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
++ double* a,
++ double* b,
++ double* c,
++ double* d,
++ double* e,
++ double* f);
++
+ #ifdef __cplusplus
+ } // extern "C"
+ #endif // __cplusplus
+--
+2.16.3
+
diff --git a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
new file mode 100644
index 000000000000..008c7047bdfa
--- /dev/null
+++ b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
@@ -0,0 +1,148 @@
+From 7e8ecec81f102993e3fe73256415dcf049c09e29 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:35:39 +0200
+Subject: [PATCH 12/14] svx: import processed PDF text
+
+---
+ pdfium/core/fpdftext/cpdf_textpage.cpp | 29 ++++++++++++++++++++++++
+ pdfium/core/fpdftext/cpdf_textpage.h | 2 ++
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 41 ++++++++++++++++++++++++++++++++++
+ pdfium/public/fpdf_edit.h | 13 +++++++++++
+ 4 files changed, 85 insertions(+)
+
+diff --git a/pdfium/core/fpdftext/cpdf_textpage.cpp b/pdfium/core/fpdftext/cpdf_textpage.cpp
+index 5690698..4d7c48a 100644
+--- a/pdfium/core/fpdftext/cpdf_textpage.cpp
++++ b/pdfium/core/fpdftext/cpdf_textpage.cpp
+@@ -1464,3 +1464,32 @@ Optional<PAGECHAR_INFO> CPDF_TextPage::GenerateCharInfo(wchar_t unicode) {
+ info.m_Origin.x, info.m_Origin.y);
+ return info;
+ }
++
++WideString CPDF_TextPage::GetTextObjectText(CPDF_TextObject* pTextObj)
++{
++ if (!m_bIsParsed)
++ return WideString();
++
++ float posy = 0;
++ bool IsContainPreChar = false;
++ bool IsAddLineFeed = false;
++ WideString strText;
++ for (const auto& charinfo : m_CharList) {
++ if (charinfo.m_pTextObj == pTextObj) {
++ IsContainPreChar = true;
++ IsAddLineFeed = false;
++ if (charinfo.m_Unicode)
++ strText += charinfo.m_Unicode;
++ } else if (charinfo.m_Unicode == 32) {
++ if (IsContainPreChar && charinfo.m_Unicode) {
++ strText += charinfo.m_Unicode;
++ IsContainPreChar = false;
++ IsAddLineFeed = false;
++ }
++ } else {
++ IsContainPreChar = false;
++ IsAddLineFeed = true;
++ }
++ }
++ return strText;
++}
+diff --git a/pdfium/core/fpdftext/cpdf_textpage.h b/pdfium/core/fpdftext/cpdf_textpage.h
+index 43a0312..7d5d5ec 100644
+--- a/pdfium/core/fpdftext/cpdf_textpage.h
++++ b/pdfium/core/fpdftext/cpdf_textpage.h
+@@ -105,6 +105,8 @@ class CPDF_TextPage {
+ WideString GetPageText(int start, int count) const;
+ WideString GetAllPageText() const { return GetPageText(0, CountChars()); }
+
++ WideString GetTextObjectText(CPDF_TextObject* pTextObj);
++
+ int CountRects(int start, int nCount);
+ bool GetRect(int rectIndex, CFX_FloatRect* pRect) const;
+
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index f4a1688..f34d3b5 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -26,6 +26,7 @@
+ #include "core/fpdfapi/parser/cpdf_string.h"
+ #include "core/fpdfdoc/cpdf_annot.h"
+ #include "core/fpdfdoc/cpdf_annotlist.h"
++#include "core/fpdftext/cpdf_textpage.h"
+ #include "fpdfsdk/cpdfsdk_helpers.h"
+ #include "public/fpdf_formfill.h"
+ #include "third_party/base/logging.h"
+@@ -656,6 +657,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+ return true;
+ }
+
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
++ FPDF_TEXTPAGE page,
++ int char_start,
++ int char_count,
++ unsigned short* result)
++{
++ if (!page || !text_object || char_start < 0 || char_count < 0 || !result)
++ return 0;
++
++ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
++ CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(page);
++ int char_available = textpage->CountChars() - char_start;
++ if (char_available <= 0)
++ return 0;
++
++ char_count = std::min(char_count, char_available);
++ if (char_count == 0) {
++ // Writing out "", which has a character count of 1 due to the NUL.
++ *result = '\0';
++ return 1;
++ }
++
++ WideString str = textpage->GetTextObjectText(pTxtObj);
++
++ if (str.GetLength() > static_cast<size_t>(char_count))
++ str = str.Left(static_cast<size_t>(char_count));
++
++ // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
++ // the number of items to stay the same.
++ ByteString byte_str = str.UTF16LE_Encode();
++ size_t byte_str_len = byte_str.GetLength();
++ constexpr size_t kBytesPerCharacter = sizeof(unsigned short);
++ int ret_count = byte_str_len / kBytesPerCharacter;
++
++ ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator.
++ memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
++ return ret_count;
++}
++
+ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
+ unsigned int* R,
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+index f249e64..e14b2a5 100644
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1088,6 +1088,19 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
+
++// Get the processed text of a text object.
++//
++// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
++// or FPDFPageObj_NewTextObjEx.
++// Return Value:
++// The number of characters (not bytes) written in result.
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
++ FPDF_TEXTPAGE page,
++ int char_start,
++ int char_count,
++ unsigned short* result);
++
+ // Get the stroke RGBA of a text. Range of values: 0 - 255.
+ //
+ // path - the handle to the path object.
+--
+2.16.3
+
diff --git a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
new file mode 100644
index 000000000000..d56c2ce69e70
--- /dev/null
+++ b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
@@ -0,0 +1,83 @@
+From f701ff3ce04a4e7e757a9f3ee62b4967749455dd Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 14:27:55 +0200
+Subject: [PATCH 14/14] svx: update PDFium patch and code
+
+---
+ pdfium/fpdfsdk/cpdfsdk_helpers.h | 2 ++
+ pdfium/fpdfsdk/fpdf_editimg.cpp | 2 +-
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 19 ++++++++++++-------
+ pdfium/public/fpdf_edit.h | 16 ++++++++--------
+ 4 files changed, 23 insertions(+), 16 deletions(-)
+
+diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+index 477bb74..c907ad8 100644
+--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
++++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+@@ -40,6 +40,8 @@ class CPDF_TextPage;
+ class CPDF_TextPageFind;
+ class IPDFSDK_PauseAdapter;
+ class FX_PATHPOINT;
++class CPDF_TextObject;
++class CPDF_FormObject;
+
+ #ifdef PDF_ENABLE_XFA
+ class CPDFXFA_Context;
+diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp
+index 3f400c7..968b84a 100644
+--- a/pdfium/fpdfsdk/fpdf_editimg.cpp
++++ b/pdfium/fpdfsdk/fpdf_editimg.cpp
+@@ -203,7 +203,7 @@ FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
+ RetainPtr<CFX_DIBitmap> pBitmap;
+ pBitmap = pSource->CloneConvert(FXDIB_Argb);
+
+- return pBitmap.Leak();
++ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
+ }
+
+ FPDF_EXPORT unsigned long FPDF_CALLCONV
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index 29c8b01..a52e1a9 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -693,7 +693,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
+ int ret_count = byte_str_len / kBytesPerCharacter;
+
+ ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator.
+- memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
++ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
+ return ret_count;
+ }
+
+@@ -736,10 +736,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
+ return false;
+ }
+
+- const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB();
+- *R = FXSYS_GetRValue(RGB);
+- *G = FXSYS_GetGValue(RGB);
+- *B = FXSYS_GetBValue(RGB);
++ const CPDF_Color* pColor = bStroke ? pTxtObj->m_ColorState.GetStrokeColor() : pTxtObj->m_ColorState.GetFillColor();
++ if (pColor == nullptr)
++ return false;
++
++ int r, g, b;
++ pColor->GetRGB(&r, &g, &b);
++ *R = r;
++ *G = g;
++ *B = b;
+ *A = static_cast<unsigned int>(
+ (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
+
+@@ -768,7 +773,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
+ {
+ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
+ if (pObjectList)
+- return pObjectList->GetPageObjectByIndex(index);
++ return FPDFPageObjectFromCPDFPageObject(pObjectList->GetPageObjectByIndex(index));
+ }
+
+ return nullptr;
+--
+2.16.3
+
diff --git a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
new file mode 100644
index 000000000000..8eb0bac1eed2
--- /dev/null
+++ b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
@@ -0,0 +1,77 @@
+From 04f9899ddf5f9691ffaca5091082183f167e95d3 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Wed, 6 Jun 2018 06:34:56 +0200
+Subject: [PATCH] svx: set the font name of imported PDF text
+
+---
+ pdfium/fpdfsdk/fpdf_editpage.cpp | 23 +++++++++++++++++++++++
+ pdfium/public/fpdf_edit.h | 11 +++++++++++
+ 2 files changed, 34 insertions(+)
+
+diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
+index a52e1a9..9daffc0 100644
+--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
+@@ -20,6 +20,7 @@
+ #include "core/fpdfapi/page/cpdf_pageobject.h"
+ #include "core/fpdfapi/page/cpdf_pathobject.h"
+ #include "core/fpdfapi/page/cpdf_shadingobject.h"
++#include "core/fpdfapi/page/cpdf_textobject.h"
+ #include "core/fpdfapi/parser/cpdf_array.h"
+ #include "core/fpdfapi/parser/cpdf_document.h"
+ #include "core/fpdfapi/parser/cpdf_number.h"
+@@ -458,6 +459,29 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
+ return pTxtObj->GetFontSize();
+ }
+
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result)
++{
++ if (!text_object)
++ return 0;
++
++ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
++ CPDF_Font* pPdfFont = pTxtObj->GetFont();
++ if (!pPdfFont)
++ return 0;
++
++ CFX_Font* pFont = pPdfFont->GetFont();
++ if (!pFont)
++ return 0;
++
++ ByteString byte_str = pFont->GetFamilyName();
++ const size_t byte_str_len = byte_str.GetLength();
++
++ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
++ result[byte_str_len] = '\0';
++ return byte_str_len;
++}
++
+ FPDF_EXPORT void FPDF_CALLCONV
+ FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
+ FPDF_BYTESTRING blend_mode) {
+diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+index 4351649..f858ab2 100644
+--- a/pdfium/public/fpdf_edit.h
++++ b/pdfium/public/fpdf_edit.h
+@@ -1068,6 +1068,17 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ FPDF_FONT font,
+ float font_size);
+
++// Get the font name of a text object.
++//
++// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
++// or FPDFPageObj_NewTextObjEx.
++// result - The result in ascii.
++//
++// Return Value:
++// The number of characters / bytes written in result.
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result);
++
+ // Get the number of characters from a text object.
+ //
+ // text_object - Handle of text object returned by FPDFPageObj_NewTextObj
+--
+2.16.3
+
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 5f845154203d..df6bd61af985 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_Library_add_defs,pdfium,\
-DUSE_SYSTEM_LCMS2 \
-DUSE_SYSTEM_LIBJPEG \
-DUSE_SYSTEM_ZLIB \
+ -DUSE_SYSTEM_ICUUC \
-DMEMORY_TOOL_REPLACES_ALLOCATOR \
-DUNICODE \
))
@@ -278,6 +279,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_avail \
UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_page_object_avail \
UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \
+ UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \
+ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transparency \
))
# fpdfdoc
@@ -343,7 +346,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_HtrdProc \
UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_HuffmanDecoder \
UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable \
- UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable_Standard \
UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_Image \
UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_PatternDict \
UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_PddProc \
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 6a20b8f7d590..dc1ad7b4e221 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -10,11 +10,18 @@
pdfium_patches :=
pdfium_patches += visibility.patch.1
pdfium_patches += ubsan.patch
-pdfium_patches += icu.patch.1
# Fixes build on our baseline.
pdfium_patches += build.patch.1
# Adds missing editing API
-pdfium_patches += edit.patch.1
+pdfium_patches += 0002-svx-more-accurate-PDF-text-importing.patch.2
+pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
+pdfium_patches += 0004-svx-support-PDF-text-color.patch.2
+pdfium_patches += 0009-svx-support-color-text-for-imported-PDFs.patch.2
+pdfium_patches += 0010-svx-support-importing-forms-from-PDFs.patch.2
+pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2
+pdfium_patches += 0012-svx-import-processed-PDF-text.patch.2
+pdfium_patches += 0014-svx-update-PDFium-patch-and-code.patch.2
+pdfium_patches += 0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
$(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 89d8e5e7d8d0..901edbbf4e56 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -19,20 +19,6 @@ index 8e01127b0..f4ce4d915 100644
if (m_Storer.GetBitmap()->IsAlphaMask()) {
CalcAlpha(cdata);
} else {
-diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
-index 05694cf24..101253814 100644
---- a/core/fxcrt/string_view_template.h
-+++ b/core/fxcrt/string_view_template.h
-@@ -231,9 +231,6 @@ inline bool operator<(const T* lhs, const StringViewTemplate<T>& rhs) {
- return rhs > lhs;
- }
-
--extern template class StringViewTemplate<char>;
--extern template class StringViewTemplate<wchar_t>;
--
- using ByteStringView = StringViewTemplate<char>;
- using WideStringView = StringViewTemplate<wchar_t>;
-
diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
index 323de4ffc..f11a0b0ad 100644
--- a/core/fpdfdoc/cpdf_metadata.cpp
@@ -122,3 +108,42 @@ index d3bf38d31..e8aea9707 100644
}
return FPDFPageObjectFromCPDFPageObject(
+diff --git a/third_party/base/span.h b/third_party/base/span.h
+index 0fb627ba8..dda1fc8bc 100644
+--- a/third_party/base/span.h
++++ b/third_party/base/span.h
+@@ -204,7 +204,7 @@ class span {
+ // size()|.
+ template <typename Container,
+ typename = internal::EnableIfSpanCompatibleContainer<Container, T>>
+- constexpr span(Container& container)
++ span(Container& container)
+ : span(container.data(), container.size()) {}
+ template <
+ typename Container,
+diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
+index 7f4eb86c0..5e227f86e 100644
+--- a/core/fpdfdoc/cpdf_dest.h
++++ b/core/fpdfdoc/cpdf_dest.h
+@@ -46,7 +46,7 @@ class CPDF_Dest {
+ float* pZoom) const;
+
+ private:
+- UnownedPtr<const CPDF_Array> const m_pObj;
++ UnownedPtr<const CPDF_Array> m_pObj;
+ };
+
+ #endif // CORE_FPDFDOC_CPDF_DEST_H_
+diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
+index 7050f695b..916afed8b 100644
+--- a/core/fpdfdoc/cpdf_filespec.h
++++ b/core/fpdfdoc/cpdf_filespec.h
+@@ -41,7 +41,7 @@ class CPDF_FileSpec {
+
+ private:
+ UnownedPtr<const CPDF_Object> const m_pObj;
+- UnownedPtr<CPDF_Object> const m_pWritableObj;
++ UnownedPtr<CPDF_Object> m_pWritableObj;
+ };
+
+ #endif // CORE_FPDFDOC_CPDF_FILESPEC_H_
diff --git a/external/pdfium/edit.patch.1 b/external/pdfium/edit.patch.1
deleted file mode 100644
index d0d7cb97060e..000000000000
--- a/external/pdfium/edit.patch.1
+++ /dev/null
@@ -1,757 +0,0 @@
-diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
-index 5690698..4d7c48a 100644
---- a/core/fpdftext/cpdf_textpage.cpp
-+++ b/core/fpdftext/cpdf_textpage.cpp
-@@ -1464,3 +1464,32 @@ Optional<PAGECHAR_INFO> CPDF_TextPage::GenerateCharInfo(wchar_t unicode) {
- info.m_Origin.x, info.m_Origin.y);
- return info;
- }
-+
-+WideString CPDF_TextPage::GetTextObjectText(CPDF_TextObject* pTextObj)
-+{
-+ if (!m_bIsParsed)
-+ return WideString();
-+
-+ float posy = 0;
-+ bool IsContainPreChar = false;
-+ bool IsAddLineFeed = false;
-+ WideString strText;
-+ for (const auto& charinfo : m_CharList) {
-+ if (charinfo.m_pTextObj == pTextObj) {
-+ IsContainPreChar = true;
-+ IsAddLineFeed = false;
-+ if (charinfo.m_Unicode)
-+ strText += charinfo.m_Unicode;
-+ } else if (charinfo.m_Unicode == 32) {
-+ if (IsContainPreChar && charinfo.m_Unicode) {
-+ strText += charinfo.m_Unicode;
-+ IsContainPreChar = false;
-+ IsAddLineFeed = false;
-+ }
-+ } else {
-+ IsContainPreChar = false;
-+ IsAddLineFeed = true;
-+ }
-+ }
-+ return strText;
-+}
-diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
-index 43a0312..7d5d5ec 100644
---- a/core/fpdftext/cpdf_textpage.h
-+++ b/core/fpdftext/cpdf_textpage.h
-@@ -105,6 +105,8 @@ class CPDF_TextPage {
- WideString GetPageText(int start, int count) const;
- WideString GetAllPageText() const { return GetPageText(0, CountChars()); }
-
-+ WideString GetTextObjectText(CPDF_TextObject* pTextObj);
-+
- int CountRects(int start, int nCount);
- bool GetRect(int rectIndex, CFX_FloatRect* pRect) const;
-
-diff --git a/fpdfsdk/cpdfsdk_helpers.h b/fpdfsdk/cpdfsdk_helpers.h
-index d93ecfc..c700592 100644
---- a/fpdfsdk/cpdfsdk_helpers.h
-+++ b/fpdfsdk/cpdfsdk_helpers.h
-@@ -40,7 +40,8 @@ class CPDF_TextPage;
- class CPDF_TextPageFind;
- class IPDFSDK_PauseAdapter;
- class FX_PATHPOINT;
--
-+class CPDF_TextObject;
-+class CPDF_FormObject;
- #ifdef PDF_ENABLE_XFA
- class CPDFXFA_Context;
- class CPDFXFA_Page;
-@@ -204,6 +205,16 @@ inline CPDF_TextPageFind* CPDFTextPageFindFromFPDFSchHandle(
- return reinterpret_cast<CPDF_TextPageFind*>(handle);
- }
-
-+inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
-+ FPDF_PAGEOBJECT page_object) {
-+ return reinterpret_cast<CPDF_TextObject*>(page_object);
-+}
-+
-+inline CPDF_FormObject* CPDFFormObjectFromFPDFPageObject(
-+ FPDF_PAGEOBJECT page_object) {
-+ return reinterpret_cast<CPDF_FormObject*>(page_object);
-+}
-+
- ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
-
- #ifdef PDF_ENABLE_XFA
-diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp
-index fed1581..968b84a 100644
---- a/fpdfsdk/fpdf_editimg.cpp
-+++ b/fpdfsdk/fpdf_editimg.cpp
-@@ -186,6 +186,26 @@ FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object) {
- return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
- }
-
-+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
-+FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
-+ CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object);
-+ if (!pObj || !pObj->IsImage())
-+ return nullptr;
-+
-+ RetainPtr<CPDF_Image> pImg = pObj->AsImage()->GetImage();
-+ if (!pImg)
-+ return nullptr;
-+
-+ RetainPtr<CFX_DIBSource> pSource = pImg->LoadDIBSource();
-+ if (!pSource)
-+ return nullptr;
-+
-+ RetainPtr<CFX_DIBitmap> pBitmap;
-+ pBitmap = pSource->CloneConvert(FXDIB_Argb);
-+
-+ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
-+}
-+
- FPDF_EXPORT unsigned long FPDF_CALLCONV
- FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
- void* buffer,
-diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
-index ec29891..9daffc0 100644
---- a/fpdfsdk/fpdf_editpage.cpp
-+++ b/fpdfsdk/fpdf_editpage.cpp
-@@ -12,12 +12,14 @@
- #include <vector>
-
- #include "core/fpdfapi/edit/cpdf_pagecontentgenerator.h"
-+#include "core/fpdfapi/font/cpdf_font.h"
- #include "core/fpdfapi/page/cpdf_form.h"
- #include "core/fpdfapi/page/cpdf_formobject.h"
- #include "core/fpdfapi/page/cpdf_imageobject.h"
- #include "core/fpdfapi/page/cpdf_page.h"
- #include "core/fpdfapi/page/cpdf_pageobject.h"
- #include "core/fpdfapi/page/cpdf_pathobject.h"
-+#include "core/fpdfapi/page/cpdf_textobject.h"
- #include "core/fpdfapi/page/cpdf_shadingobject.h"
- #include "core/fpdfapi/parser/cpdf_array.h"
- #include "core/fpdfapi/parser/cpdf_document.h"
-@@ -25,6 +27,7 @@
- #include "core/fpdfapi/parser/cpdf_string.h"
- #include "core/fpdfdoc/cpdf_annot.h"
- #include "core/fpdfdoc/cpdf_annotlist.h"
-+#include "core/fpdftext/cpdf_textpage.h"
- #include "fpdfsdk/cpdfsdk_helpers.h"
- #include "public/fpdf_formfill.h"
- #include "third_party/base/logging.h"
-@@ -624,3 +627,268 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
- pPageObj->SetDirty(true);
- return true;
- }
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object)
-+{
-+ if (!text_object)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ return pTxtObj->CountChars();
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
-+{
-+ if (!text_object)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ return pTxtObj->GetFontSize();
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result)
-+{
-+ if (!text_object)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ CPDF_Font* pPdfFont = pTxtObj->GetFont();
-+ if (!pPdfFont)
-+ return 0;
-+
-+ CFX_Font* pFont = pPdfFont->GetFont();
-+ if (!pFont)
-+ return 0;
-+
-+ ByteString byte_str = pFont->GetFamilyName();
-+ const size_t byte_str_len = byte_str.GetLength();
-+
-+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
-+ result[byte_str_len] = '\0';
-+ return byte_str_len;
-+}
-+
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d,
-+ double* e,
-+ double* f)
-+{
-+ if (!text_object || !a || !b || !c || !d || !e || !f)
-+ return;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ const CFX_Matrix& matrix = pTxtObj->GetTextMatrix();
-+ *a = matrix.a;
-+ *b = matrix.b;
-+ *c = matrix.c;
-+ *d = matrix.d;
-+ *e = matrix.e;
-+ *f = matrix.f;
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetUnicode(FPDF_PAGEOBJECT text_object, int index)
-+{
-+ if (!text_object || index < 0)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ if (index > pTxtObj->CountChars())
-+ return 0;
-+
-+ CPDF_TextObjectItem info;
-+ pTxtObj->GetCharInfo(index, &info);
-+ return info.m_CharCode;
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-+ int char_start,
-+ int char_count,
-+ unsigned short* result) {
-+ if (!text_object || char_start < 0 || char_count < 0 || !result)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ int char_available = pTxtObj->CountChars() - char_start;
-+ if (char_available <= 0)
-+ return 0;
-+
-+ char_count = std::min(char_count, char_available);
-+ if (char_count == 0) {
-+ // Writing out "", which has a character count of 1 due to the NUL.
-+ *result = '\0';
-+ return 1;
-+ }
-+
-+ CPDF_Font* pFont = pTxtObj->GetFont();
-+ WideString str;
-+ for (uint32_t charcode : pTxtObj->GetCharCodes()) {
-+ if (charcode != CPDF_Font::kInvalidCharCode)
-+ str += pFont->UnicodeFromCharCode(charcode);
-+ }
-+
-+ // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
-+ // the number of items to stay the same.
-+ ByteString byte_str = str.UTF16LE_Encode();
-+ size_t byte_str_len = byte_str.GetLength();
-+ int ret_count = byte_str_len / sizeof(unsigned short);
-+
-+ ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator.
-+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
-+ return ret_count;
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
-+ FPDF_TEXTPAGE page,
-+ int char_start,
-+ int char_count,
-+ unsigned short* result)
-+{
-+ if (!page || !text_object || char_start < 0 || char_count < 0 || !result)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(page);
-+ int char_available = textpage->CountChars() - char_start;
-+ if (char_available <= 0)
-+ return 0;
-+
-+ char_count = std::min(char_count, char_available);
-+ if (char_count == 0) {
-+ // Writing out "", which has a character count of 1 due to the NUL.
-+ *result = '\0';
-+ return 1;
-+ }
-+
-+ WideString str = textpage->GetTextObjectText(pTxtObj);
-+
-+ if (str.GetLength() > static_cast<size_t>(char_count))
-+ str = str.Left(static_cast<size_t>(char_count));
-+
-+ // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
-+ // the number of items to stay the same.
-+ ByteString byte_str = str.UTF16LE_Encode();
-+ size_t byte_str_len = byte_str.GetLength();
-+ constexpr size_t kBytesPerCharacter = sizeof(unsigned short);
-+ int ret_count = byte_str_len / kBytesPerCharacter;
-+
-+ ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator.
-+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
-+ return ret_count;
-+}
-+
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-+ unsigned int* R,
-+ unsigned int* G,
-+ unsigned int* B,
-+ unsigned int* A)
-+{
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+ if (!pTxtObj || !R || !G || !B || !A)
-+ return false;
-+
-+ bool bFill = false;
-+ bool bStroke = false;
-+ CPDF_Font* pFont = pTxtObj->m_TextState.GetFont();
-+ const TextRenderingMode text_render_mode = pTxtObj->m_TextState.GetTextMode();
-+ switch (text_render_mode)
-+ {
-+ case TextRenderingMode::MODE_FILL:
-+ case TextRenderingMode::MODE_FILL_CLIP:
-+ bFill = true;
-+ break;
-+ case TextRenderingMode::MODE_STROKE:
-+ case TextRenderingMode::MODE_STROKE_CLIP:
-+ if (pFont->GetFace())
-+ bStroke = true;
-+ else
-+ bFill = true;
-+ break;
-+ case TextRenderingMode::MODE_FILL_STROKE:
-+ case TextRenderingMode::MODE_FILL_STROKE_CLIP:
-+ bFill = true;
-+ if (pFont->GetFace())
-+ bStroke = true;
-+ break;
-+ case TextRenderingMode::MODE_INVISIBLE:
-+ case TextRenderingMode::MODE_CLIP:
-+ return false;
-+ }
-+
-+ const CPDF_Color* pColor = bStroke ? pTxtObj->m_ColorState.GetStrokeColor() : pTxtObj->m_ColorState.GetFillColor();
-+ if (pColor == nullptr)
-+ return false;
-+
-+ int r, g, b;
-+ pColor->GetRGB(&r, &g, &b);
-+ *R = r;
-+ *G = g;
-+ *B = b;
-+ *A = static_cast<unsigned int>(
-+ (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
-+
-+ return true;
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object)
-+{
-+ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
-+ if (pFrmObj)
-+ {
-+ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
-+ if (pObjectList)
-+ return pObjectList->size();
-+ }
-+
-+ return 0;
-+}
-+
-+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
-+FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
-+{
-+ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
-+ if (pFrmObj)
-+ {
-+ const CFX_Matrix& matrix = pFrmObj->form_matrix();
-+ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
-+ if (pObjectList)
-+ return FPDFPageObjectFromCPDFPageObject(pObjectList->GetPageObjectByIndex(index));
-+ }
-+
-+ return nullptr;
-+}
-+
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d,
-+ double* e,
-+ double* f)
-+{
-+ if (!form_object || !a || !b || !c || !d || !e || !f)
-+ return;
-+
-+ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
-+ if (pFrmObj)
-+ {
-+ const CFX_Matrix& matrix = pFrmObj->form_matrix();
-+ *a = matrix.a;
-+ *b = matrix.b;
-+ *c = matrix.c;
-+ *d = matrix.d;
-+ *e = matrix.e;
-+ *f = matrix.f;
-+ }
-+}
-diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp
-index aca2beb..017dbcd 100644
---- a/fpdfsdk/fpdf_editpath.cpp
-+++ b/fpdfsdk/fpdf_editpath.cpp
-@@ -117,6 +117,16 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width) {
- return true;
- }
-
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFPath_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width) {
-+ auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path);
-+ if (!pPathObj || !width)
-+ return false;
-+
-+ *width = pPathObj->m_GraphState.GetLineWidth();
-+ return true;
-+}
-+
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetFillColor(FPDF_PAGEOBJECT path,
- unsigned int R,
- unsigned int G,
-@@ -235,6 +245,25 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path,
- return true;
- }
-
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path,
-+ int* fillmode,
-+ FPDF_BOOL* stroke)
-+{
-+ auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path);
-+ if (!pPathObj || !fillmode || !stroke)
-+ return false;
-+
-+ if (pPathObj->m_FillType == FXFILL_ALTERNATE)
-+ *fillmode = FPDF_FILLMODE_ALTERNATE;
-+ else if (pPathObj->m_FillType == FXFILL_WINDING)
-+ *fillmode = FPDF_FILLMODE_WINDING;
-+ else
-+ *fillmode = 0; // no fill
-+
-+ *stroke = pPathObj->m_bStroke;
-+ return true;
-+}
-+
- FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineJoin(FPDF_PAGEOBJECT path,
- int line_join) {
- if (!path)
-@@ -268,6 +297,30 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineCap(FPDF_PAGEOBJECT path,
- }
-
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFPath_GetMatrix(FPDF_PAGEOBJECT path_object,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d,
-+ double* e,
-+ double* f)
-+{
-+ if (!path_object || !a || !b || !c || !d || !e || !f)
-+ return false;
-+
-+ CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path_object);
-+ const CFX_Matrix& pMatrix = pPathObj->m_Matrix;
-+ *a = pMatrix.a;
-+ *b = pMatrix.b;
-+ *c = pMatrix.c;
-+ *d = pMatrix.d;
-+ *e = pMatrix.e;
-+ *f = pMatrix.f;
-+
-+ return true;
-+}
-+
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
- FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y) {
- auto* pPathPoint = FXPathPointFromFPDFPathSegment(segment);
- if (!pPathPoint || !x || !y)
-diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
-index a1bbbb4..01b74c9 100644
---- a/fpdfsdk/fpdf_text.cpp
-+++ b/fpdfsdk/fpdf_text.cpp
-@@ -95,6 +95,28 @@ FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
- return charinfo.m_FontSize;
- }
-
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_TEXTPAGE text_page,
-+ int index,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d) {
-+ if (!text_page || index < 0)
-+ return false;
-+
-+ CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
-+ if (index >= textpage->CountChars())
-+ return false;
-+
-+ FPDF_CHAR_INFO charinfo;
-+ textpage->GetCharInfo(index, &charinfo);
-+ *a = charinfo.m_Matrix.a;
-+ *b = charinfo.m_Matrix.b;
-+ *c = charinfo.m_Matrix.c;
-+ *d = charinfo.m_Matrix.d;
-+ return true;
-+}
-+
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
- int index,
- double* left,
-diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
-index c0766a3..75381bb 100644
---- a/public/fpdf_edit.h
-+++ b/public/fpdf_edit.h
-@@ -660,6 +660,15 @@ FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object,
- unsigned int* B,
- unsigned int* A);
-
-+// Get the stroke width of a path.
-+//
-+// path - the handle to the path object.
-+// width - the width of the stroke.
-+//
-+// Returns TRUE on success
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFPath_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width);
-+
- // Set the stroke width of a path.
- //
- // path - the handle to the path object.
-@@ -898,6 +907,36 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path,
- int fillmode,
- FPDF_BOOL stroke);
-
-+// Get the drawing mode of a path.
-+//
-+// path - the handle to the path object.
-+// fillmode - the filling mode to be set: 0 for no fill, 1 for alternate, 2 for
-+// winding.
-+// stroke - a boolean specifying if the path should be stroked or not.
-+//
-+// Returns TRUE on success
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path,
-+ int* fillmode,
-+ FPDF_BOOL* stroke);
-+
-+// Get the matrix of a particular text object.
-+//
-+// path_object - Handle of path object returned by FPDFPath_NewPathObj
-+// a - Pointer to a double value receiving coefficient "a" of the matrix.
-+// b - Pointer to a double value receiving coefficient "b" of the matrix.
-+// c - Pointer to a double value receiving coefficient "c" of the matrix.
-+// d - Pointer to a double value receiving coefficient "d" of the matrix.
-+// e - Pointer to a double value receiving coefficient "e" of the matrix.
-+// f - Pointer to a double value receiving coefficient "f" of the matrix.
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFPath_GetMatrix(FPDF_PAGEOBJECT path_object,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d,
-+ double* e,
-+ double* f);
-+
- // Create a new text object using one of the standard PDF fonts.
- //
- // document - handle to the document.
-@@ -971,6 +1010,135 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
- FPDF_FONT font,
- float font_size);
-
-+// Get the number of characters from a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+// Return Value:
-+// A character count in the text object.
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
-+
-+// Get the font size of a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+//
-+// Return Value:
-+// The value of the font size
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
-+
-+// Get the font name of a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+// result - The result in ascii.
-+//
-+// Return Value:
-+// The number of characters / bytes written in result.
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result);
-+
-+// Get the matrix of a particular text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+// a - Pointer to a double value receiving coefficient "a" of the matrix.
-+// b - Pointer to a double value receiving coefficient "b" of the matrix.
-+// c - Pointer to a double value receiving coefficient "c" of the matrix.
-+// d - Pointer to a double value receiving coefficient "d" of the matrix.
-+// e - Pointer to a double value receiving coefficient "e" of the matrix.
-+// f - Pointer to a double value receiving coefficient "f" of the matrix.
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d,
-+ double* e,
-+ double* f);
-+
-+// Get the unicode of a special character in a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+// index - The index of the character to get the unicode.
-+// Return Value:
-+// The unicode value.
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetUnicode(FPDF_PAGEOBJECT text_object, int index);
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-+ int char_start,
-+ int char_count,
-+ unsigned short* result);
-+
-+// Get the processed text of a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+// Return Value:
-+// The number of characters (not bytes) written in result.
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
-+ FPDF_TEXTPAGE page,
-+ int char_start,
-+ int char_count,
-+ unsigned short* result);
-+
-+// Get the stroke RGBA of a text. Range of values: 0 - 255.
-+//
-+// path - the handle to the path object.
-+// R - the red component of the path stroke color.
-+// G - the green component of the path stroke color.
-+// B - the blue component of the path stroke color.
-+// A - the stroke alpha of the path.
-+//
-+// Returns TRUE on success.
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-+ unsigned int* R,
-+ unsigned int* G,
-+ unsigned int* B,
-+ unsigned int* A);
-+
-+// Get number of page objects inside the form object.
-+//
-+// form_object - Handle to a form object. Returned by FPDFPage_GetObject.
-+// Return value:
-+// The number of the page objects.
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object);
-+
-+// Get the page object from a form object.
-+//
-+// form_object - Handle to a form object. Returned by FPDFPage_GetObject.
-+// index - The index of a page object.
-+// Return value:
-+// The handle of the page object. Null for failed.
-+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
-+FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index);
-+
-+// Get the matrix of a particular form object.
-+//
-+// form_object - Handle of form object
-+// a - Pointer to a double value receiving coefficient "a" of the matrix.
-+// b - Pointer to a double value receiving coefficient "b" of the matrix.
-+// c - Pointer to a double value receiving coefficient "c" of the matrix.
-+// d - Pointer to a double value receiving coefficient "d" of the matrix.
-+// e - Pointer to a double value receiving coefficient "e" of the matrix.
-+// f - Pointer to a double value receiving coefficient "f" of the matrix.
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d,
-+ double* e,
-+ double* f);
-+
- #ifdef __cplusplus
- } // extern "C"
- #endif // __cplusplus
-diff --git a/public/fpdf_text.h b/public/fpdf_text.h
-index 3502337..6524cd3 100644
---- a/public/fpdf_text.h
-+++ b/public/fpdf_text.h
-@@ -342,6 +342,26 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
- //
- FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle);
-
-+// Get the matrix of a particular character.
-+//
-+// text_page - Handle to a text page information structure.
-+// Returned by FPDFText_LoadPage function.
-+// index - Zero-based index of the character
-+// a - Pointer to a double value receiving coefficient "a" of the matrix.
-+// b - Pointer to a double value receiving coefficient "b" of the matrix.
-+// c - Pointer to a double value receiving coefficient "c" of the matrix.
-+// d - Pointer to a double value receiving coefficient "d" of the matrix.
-+//
-+// Return Value:
-+// On success, return TRUE and fill in |a|, |b|, |c|, and |d|
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFText_GetMatrix(FPDF_TEXTPAGE text_page,
-+ int index,
-+ double* a,
-+ double* b,
-+ double* c,
-+ double* d);
-+
- // Function: FPDFLink_LoadWebLinks
- // Prepare information about weblinks in a page.
- // Parameters:
-diff --git a/public/fpdfview.h b/public/fpdfview.h
-index 0ccd140..b451b9c 100644
---- a/public/fpdfview.h
-+++ b/public/fpdfview.h
-@@ -905,6 +905,9 @@ FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width,
- // function; see the list of such formats above.
- FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap);
-
-+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
-+FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object);
-+
- // Function: FPDFBitmap_FillRect
- // Fill a rectangle in a bitmap.
- // Parameters:
diff --git a/external/pdfium/icu.patch.1 b/external/pdfium/icu.patch.1
deleted file mode 100644
index 85e837d9b99f..000000000000
--- a/external/pdfium/icu.patch.1
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/core/fxcrt/fx_extension.h b/core/fxcrt/fx_extension.h
-index ff96de0f7..0195bd06f 100644
---- a/core/fxcrt/fx_extension.h
-+++ b/core/fxcrt/fx_extension.h
-@@ -13,7 +13,7 @@
-
- #include "core/fxcrt/fx_string.h"
- #include "third_party/base/span.h"
--#include "third_party/icu/source/common/unicode/uchar.h"
-+#include <unicode/uchar.h>
-
- #define FX_INVALID_OFFSET static_cast<uint32_t>(-1)
-
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 64fbdb83dbf9..8e7d9e28f0eb 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -890,7 +890,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex
return;
double a, b, c, d, e, f;
- FPDFTextObj_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
+ FPDFText_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
Matrix aTextMatrix(mCurMatrix);
aTextMatrix.Transform(left, right, top, bottom);
@@ -1189,7 +1189,7 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int /*nPageObjectI
aPoly.transform(aTransform);
float fWidth = 1;
- FPDFPath_GetStrokeWidth(pPageObject, &fWidth);
+ FPDFPageObj_GetStrokeWidth(pPageObject, &fWidth);
const double dWidth = 0.5 * fabs(sqrt2(aPathMatrix.a(), aPathMatrix.c()) * fWidth);
mnLineWidth = lcl_ToLogic(lcl_PointToPixel(dWidth));