summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
AgeCommit message (Collapse)Author
2018-04-25Fix slight type inconsistencies discovered with strict FPDF API types.Tom Sepez
Moved to an independent CL from https://pdfium-review.googlesource.com/c/pdfium/+/31296 Change-Id: Ia76e5609dc09bb7b483e092b10d9f8522e2dc175 Reviewed-on: https://pdfium-review.googlesource.com/31297 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-23Revert "Change CFX_XML Save to take a write stream"dsinclair
This reverts commit 9a3a7709103a872037dcea1f3cf0b7785a3da191. Reason for revert: Gerrit did not do what I expected.... Original change's description: > Change CFX_XML Save to take a write stream > > This CL changes CFX_XML to use an IFX_SeekableWriteStream instead of the more > generic IFX_SeekableStream. > > Change-Id: I6e4def380c43eca755d91ad5cb6146c2dfdaee10 > Reviewed-on: https://pdfium-review.googlesource.com/30877 > Commit-Queue: dsinclair <dsinclair@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> TBR=tsepez@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org Change-Id: I137e53bf93285b88ade6832dedefca66e3b61e13 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/31211 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-23Change CFX_XML Save to take a write streamDan Sinclair
This CL changes CFX_XML to use an IFX_SeekableWriteStream instead of the more generic IFX_SeekableStream. Change-Id: I6e4def380c43eca755d91ad5cb6146c2dfdaee10 Reviewed-on: https://pdfium-review.googlesource.com/30877 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-17Convert CFX_XMLParser to take a IFX_SeekableStreamdan sinclair
This CL changes the CFX_XMLParser to accept an IFX_SeekableStream intead of a CFX_SeekableStreamProxy. Change-Id: I3534288a8a00095acd78a60bf6b925c6a0357892 Reviewed-on: https://pdfium-review.googlesource.com/30856 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-17Add constants for PDF 1.7 spec, table 3.4.Lei Zhang
Add constants/stream_dict_common.h. The header lists all the constants in the table in the same order. Constants that are not used at all are commented out. BUG=pdfium:1049 Change-Id: I6539090e0ad56319ea628883e388aeacef044e52 Reviewed-on: https://pdfium-review.googlesource.com/29090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-16Merge CFX_XMLElement and CFX_XMLAttributeNodedan sinclair
CFX_XMLElement is the only subclass of CFX_XMLAttributeNode. This CL merges the two classes together. The {Set|Get}String method has been renamed to {Set|Get}Attribute to make it clearer what you're retrieving. Change-Id: I158c961d4d8c5f563d937a3e7a35321a33622562 Reviewed-on: https://pdfium-review.googlesource.com/30710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Put prototypes of PDF_NameEncode/Decode in fpdf_parser_utility.hTom Sepez
Because the implementations are in fpdf_parser_utility.cpp Add unit test for both. Change-Id: Ibae90ecbe625a035c450614ddbe7f5969f9f92aa Reviewed-on: https://pdfium-review.googlesource.com/30793 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Remove CPWL_Edit rich text supportdan sinclair
This CL removes the code which attempts to provide rich text support for CPWL_Edit. The code, as written, doesn't actually work well. If you have tags under the <p> tag we will just lose the content (so <p><b>foo</b></p> would end up being a blank string). Multiple <p> tags get concatenated together with a \n, but we subsequently lose the \n later when we store the content into the VariableText object (so <p>foo</p><p>bar</p> becomes foobar instead of foo\nbar). We never read the "RV" field from the dictionary. The RV field is what actually stores the rich text value. So, we never set a rich text value into the text edit. Change-Id: Idc1d65e1b5d75380dd28c45bcbf9137a2a4cea9a Reviewed-on: https://pdfium-review.googlesource.com/30690 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-16Use CFX_XML instead of CXML in CPDF_Metadatadan sinclair
This CL converts CPDF_Metadata to use the CFX_XML classes instead of CXML classes. This also moves the CFX_XML classes from being XFA only to being used everywhere. Change-Id: Idb784f8aaa0bc843d8a3415ba5262ccf4949308a Reviewed-on: https://pdfium-review.googlesource.com/30650 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Add CPDF_Metadata unittestsdan sinclair
Add unittests for the CPDF_Metadata class. Change-Id: I1afeb0ab1434a1ebeb4f92bb91032a0f662e750d Reviewed-on: https://pdfium-review.googlesource.com/30630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Move SharedForm check to CPDF_Metadata classdan sinclair
This CL moves code related to shared form detection into the CPDF_Metadata class. This allows us to hide the usage of CXML inside CPDF_Metadata. Change-Id: I547471a2bcc119221565c415a58211c1500cbb3c Reviewed-on: https://pdfium-review.googlesource.com/30370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Add index parameter to quadpoints getter and setter.Ralf Sippl
This is needed for working with multiline text markup annotations. Based on https://pdfium-review.googlesource.com/12012. Bug: pdfium:1045 Change-Id: Ifb105996b8b950bb2d5fceaf754b4f571155aef4 Reviewed-on: https://pdfium-review.googlesource.com/29150 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-09Use pdfium::span<> in CFX_BitStream, CPDF_SimpleParser.Tom Sepez
Get bounds checks in parsers automatically when using spans. Change-Id: I71fbe7b838435d455376db2f89817d807a9cdcfd Reviewed-on: https://pdfium-review.googlesource.com/29830 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-03Remove DefaultAppearance HasColor and return an optional insteadDan Sinclair
This CL converts CPDF_DefaultAppearance to return Optional<CFX_Color:Type> items instead of having a HasColor. This saves the double parse of the appearance stream. Change-Id: Ib3c136da6e2adfb559e495de1d299cce0b4ad25f Reviewed-on: https://pdfium-review.googlesource.com/29630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-03Use Optional to determine if appearance stream as fontchromium/3388Dan Sinclair
This CL changes the CPDF_DefaultAppearance code to remove the HasFont method and change GetFont to return an Optional. This forces all the call sites to verify a font was returned correctly and removes the need for the duplicate appearance stream parsing. Bug: chromium:827430 Change-Id: If09e0a7d3f7dd63ad77b97a5a388127e4a02da61 Reviewed-on: https://pdfium-review.googlesource.com/29610 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-28Remove CPDF_DefaultAppearance reference paramsDan Sinclair
This CL converts the CPDF_DefaultAppearance::GetColor methods to return instead of using reference parameters. Change-Id: I9ba6bf060a536290a83d3c9ce6e115511f28664c Reviewed-on: https://pdfium-review.googlesource.com/29410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-03-28Use CPDF_DefaultAppearance instead of custom parsingDan Sinclair
This CL moves code over to using CPDF_DefaultAppearance instead of calling the CPDF_SimpleParser directly. This means the code for finding a specific tag start can move into CPDF_DefaultAppearance directly. Change-Id: I1dc64e54aedd03d059b963121d466f3eb75c17db Reviewed-on: https://pdfium-review.googlesource.com/28410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-28Remove ByteString PDF_NameDecodeDan Sinclair
This CL removes the ByteString version of PDF_NameDecode and forces the callers to use the ByteStringView variant. Change-Id: I5a955d8e909e2045ee45843af54b23e98abe00ed Reviewed-on: https://pdfium-review.googlesource.com/29350 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-22Consolidate QuadPoints reading code in fpdfsdk.chromium/3380chromium/3379Lei Zhang
Also fix nits in QuadPoints code in cpdf_annot.cpp. Change-Id: I7852b673d3dca906e6d250cb3cfa305f8ea7e742 Reviewed-on: https://pdfium-review.googlesource.com/28893 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-03-21Change FXSYS_RGB() to FXSYS_BGR().Lei Zhang
Also change it from a macro to a constexpr function. Change-Id: I8b2bb42c45a23da6db136abdaee24132db4471c6 Reviewed-on: https://pdfium-review.googlesource.com/28579 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-19Calculate AP for multi-line markup annotations correctlyRalf Sippl
Currently, when constructing AP for multi-line markup annotations, we only take into account the first set of quadpoints, resulting in only the first line of the annotation being displayed if the annotation spans multiple lines. This CL, initially written by Jane Liu <janeliulwq@google.com> (https://pdfium-review.googlesource.com/12010) takes into account all the quadpoints, so multi-line annotations can be displayed correctly. BUG=pdfium:876 Change-Id: I8be10ee38e01eb6525ddef556df1b727189455c7 Reviewed-on: https://pdfium-review.googlesource.com/28590 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-03-15Add a CFX_PathData::AppendRect() variant.chromium/3372Lei Zhang
One that takes a CFX_FloatRect instead of LBRT floats. Use it where appropriate. Change-Id: I8ba19e86c61c91d8b4ef685b5cb65c8fb717f013 Reviewed-on: https://pdfium-review.googlesource.com/28581 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-03-14Fix blend mode in generated APRalf Sippl
When adding an annotation, an appearance stream (AP) is generated. According to the PDF spec, the Subtype, Type and BM entries it contains should be names rather than strings. Type should be set to XObject. BUG=pdfium:1038 Change-Id: I0131eec33c257ab3a3a48c7e0dfeac5ca8dfbe2b Reviewed-on: https://pdfium-review.googlesource.com/28550 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-03-09Cleanup CPDF_DefaultAppearancedan sinclair
Minor cleanups and refactoring of the CPDF_DefaultAppearance class. Change-Id: I7b3de021e8a6a1e9ca1d70ae413f3c433627f3fd Reviewed-on: https://pdfium-review.googlesource.com/28390 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-09Remove default params from CPDF_DefaultAppearance methodschromium/3368chromium/3367dan sinclair
This CL removes default params from CPDF_DefaultAppearance methods. Change-Id: Iaeebc7b35ebb6140850f3f0e0828c3ae9e3c5548 Reviewed-on: https://pdfium-review.googlesource.com/28350 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-03-09Remove unused methods from CPDF_DefaultAppearancedan sinclair
Methods unused. Removed. Change-Id: I059b1e321b7d57f631368b77ace1d62cb75596c8 Reviewed-on: https://pdfium-review.googlesource.com/28310 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-08CPDF_InterForm::ResetForm always returns truedan sinclair
This method always returns true, so remove the return value. Change-Id: I3da93fc5face39a53b589787873839c06c9fcfab Reviewed-on: https://pdfium-review.googlesource.com/28210 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-08Convert Before{Selection|Value}Change to return a boolchromium/3366dan sinclair
Both of these IPDF_FormNotify methods return {-1, 0, 1} but all callsites only care about < 0 and >= 0. Convert to return a bool that treats the 0 and 1 case as the same. This also makse sense in terms of the API because false means validation failure. The case where 0 was used was a place holder for we didn't try for this field type, which also implicitly means validation passed. Change-Id: I0950c678191b83caffd755d4a87b2f0efee71c89 Reviewed-on: https://pdfium-review.googlesource.com/28192 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-08Remove BeforeFormImportData and BeforeFormResetdan sinclair
Both of these IPDF_FormNotify callbacks have empty implementations which just return 0. Removed. Change-Id: I3324113222f19d2f7a2323ab5086e446d2064451 Reviewed-on: https://pdfium-review.googlesource.com/28191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-08Remove uncalled AfterFormImportDatadan sinclair
The IPDF_FormNotify::AfterFormImportData method is never called. Removed. Change-Id: I0c436193a0af7bc94077bb719e48682bbf7a9b2b Reviewed-on: https://pdfium-review.googlesource.com/28190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-26Add some more missing consts.chromium/3356Tom Sepez
Get things out of the .data section. Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683 Reviewed-on: https://pdfium-review.googlesource.com/27130 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-10Renable -Wimplicit-fallthrough for PDFium.Nico Weber
Didn't find any bugs, but also doesn't require much boilerplate. Bug: TODO Change-Id: I5f30183c55216f1333c79fcb46476d281720873e Reviewed-on: https://pdfium-review.googlesource.com/26210 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
2018-02-01Deprecate FPDFDest_GetPageIndex and create a fixed version.Henrique Nakashima
FPDFDest_GetDestPageIndex() has a well defined return value for errors (-1). Keeping FPDFDest_GetPageIndex() to avoid changing behavior of the old API for whoever relies on it. Bug: pdfium:938 Change-Id: Iad528923cb156e957a419540c262a65f45cb777d Reviewed-on: https://pdfium-review.googlesource.com/24811 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-01-30Use unsigned for char widthchromium/3335Nicolas Pena
Bug: 806612 Change-Id: I22bd9046dd37a1b596762c46a6b29a323d6e9fa1 Reviewed-on: https://pdfium-review.googlesource.com/24410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-01-29Remove redundant checks in CPVT_WordRange::Intersect().Lei Zhang
BUG=chromium:805881 Change-Id: I5ff76067fb26198df13482e6c475138142b3f6c5 Reviewed-on: https://pdfium-review.googlesource.com/24192 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-29Fix identical if/else blocks.Lei Zhang
The CPWL_EditImpl::Backspace() instance occurred in commit 671a799. The other two instances where known cases. BUG=chromium:805881 Change-Id: Iae7cb8534e85342069d8753ced88543dad751e92 Reviewed-on: https://pdfium-review.googlesource.com/24050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-18Remove more unneeded includes and code from headers.Lei Zhang
Change-Id: I0a07dbc9850bef2184ed35ff04b08385fc1bdd17 Reviewed-on: https://pdfium-review.googlesource.com/22891 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-16Add support for XFA specific FormField typesRyan Harrison
This adds to form field types specific types for XFA form fields to be used instead of the generic XFA value when possible. BUG=pdfium:952,chromium:763129,chromium:592758 Change-Id: I8d1cff6a280d71db348b7c31a251cbe2e398ec79 Reviewed-on: https://pdfium-review.googlesource.com/22677 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-01-12Use enum for tracking form field typesRyan Harrison
Within PDFium use enum class for better type safety when working with form field types. These values will still be converted to ints as part of the public API, since that is the existing API. This work is preperation for extending the number of form field types to have more specific entries for XFA. BUG=pdfium:952,chromium:763129,chromium:592758 Change-Id: Ie6c29f02ae22be782ff36eb87d27f1a4bf2c099e Reviewed-on: https://pdfium-review.googlesource.com/22742 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-11Add jumbo build support for fdrm, fpdfdoc and fxcrt.Lei Zhang
BUG=pdfium:964 Change-Id: Ifde885861aeafac803948bd537de826e2a3fddca Reviewed-on: https://pdfium-review.googlesource.com/22732 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-10Remove unused parameter from FPDFDest_GetView().Lei Zhang
Fix a bunch of nits as well. Change-Id: I874f9b1d4676823635aad8986fcf23a11ae6efd9 Reviewed-on: https://pdfium-review.googlesource.com/22473 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-10Add FPDFAnnot_GetAP to public API.Henrique Nakashima
The matching FPDFAnnot_SetAP will be added in a subsequent CL. Change-Id: If567e02c6c56138d218498879cb4a8ee91dff080 Reviewed-on: https://pdfium-review.googlesource.com/22450 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-08Style fixes in FPDFDOC_GetAnnotAPchromium/3316Henrique Nakashima
Change-Id: Iac18632ab1da7e30958278fd7769d5d7090e4242 Reviewed-on: https://pdfium-review.googlesource.com/22490 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-05Remove unused code from CPDF_InterFormRyan Harrison
Change-Id: I8be34dc4bc5ace65f5f56eb062b53faf4c1a6986 Reviewed-on: https://pdfium-review.googlesource.com/22311 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-01-05Convert CPDF_PageLabel::GetLabel to return Optional<WideString>Ryan Harrison
Change-Id: I53b91aa89c0fd1e7ab766f6d3c27a0fc7573c360 Reviewed-on: https://pdfium-review.googlesource.com/22290 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-04Open FPDFDest_GetView API.Henrique Nakashima
FPDFDest_GetView returns the view fit type and the parameters of the view for a given destination. This is useful to have more precise internal links and bookmarks that are able to manipulate the viewport position and zoom level to focus on the part of the PDF that it links to. Bug: 55776, 535978, 748852 Change-Id: Ibf7df40a852030d75ec78cec7662380319569850 Reviewed-on: https://pdfium-review.googlesource.com/21790 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-03Remove unused methods from CPDF_VariableTextNicolas Pena
Change-Id: Id8012a5769df68d29da5c58cc821c71ca93240e1 Reviewed-on: https://pdfium-review.googlesource.com/22111 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-12-20Add comments for CPDF_AAction types.Lei Zhang
Change-Id: I7beca1aec8fe2dcd07a7bff7d173d2a5b39fa7b9 Reviewed-on: https://pdfium-review.googlesource.com/21830 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-12Remove non-const refs in CPDF_NameTree functions.Lei Zhang
Change-Id: Ic3dbc07ac80ad48fd670c090027cc151afc61e7f Reviewed-on: https://pdfium-review.googlesource.com/20890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-11Remove default arguments to CPDF_StreamAcc::LoadAllData().Lei Zhang
Add LoadAllDataFiltered() and LoadAllDataRaw() and update callers. Change-Id: I9b80ee34a358db204968acdc8b1adc9db0b6b83f Reviewed-on: https://pdfium-review.googlesource.com/20810 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>