summaryrefslogtreecommitdiff
path: root/fpdfsdk
AgeCommit message (Collapse)Author
2017-06-19Fix code in fpdf_flatten.cpp that does no make sense.Lei Zhang
Fix some nits and simplify code as well. Change-Id: I77c88f211b9ce32f38221d04c067f73818e0e970 Reviewed-on: https://pdfium-review.googlesource.com/6674 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-19Converting CFX_ByteTextBuf to ostringstream in cpdfsdk_widget.cpp.Henrique Nakashima
Bug: pdfium:731 Change-Id: I8926f3a3b5c41b144a1f890b6892b67d25bcf5ac Reviewed-on: https://pdfium-review.googlesource.com/6690 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-19Added public API FPDFPath_GetStrokeColorJane Liu
There is already public APIs for SetFillColor, GetFillColor, and SetStrokeColor; this is the only one missing. This function is helpful to have when extracting path information from annotations. Change-Id: I2bf80a1dc5433e65bbb1d005c0e609d01c9133be Reviewed-on: https://pdfium-review.googlesource.com/6710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-19Mark more CPDFSDK_FormFillEnvironment methods as const.Lei Zhang
Change-Id: Ie7bd4ec567ce932c8010bae744ba42cf40706b79 Reviewed-on: https://pdfium-review.googlesource.com/6678 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-19Move JS time conversion code into an anonymous namespace.Lei Zhang
Change-Id: Idcbff7db2f9cf0d6698702ca007be5a8b44c7760 Reviewed-on: https://pdfium-review.googlesource.com/6673 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-16Avoid a crash inside wcsftime() on Windows.chromium/3135chromium/3134chromium/3133Lei Zhang
BUG=chromium:733245 Change-Id: Ic9347e2cc245831c0b71fac1d531c33c5646ab3f Reviewed-on: https://pdfium-review.googlesource.com/6671 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-16Simplify code in the JS printf/printd implementations.Lei Zhang
Change-Id: Iec6749044796945e77cee57e74ab6611f82fa813 Reviewed-on: https://pdfium-review.googlesource.com/6672 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-15Change some CFFL classes to use early returns.chromium/3132Lei Zhang
Also switch C-style casts to the appropriate C++ casts, and add helper functions in some cases. Change-Id: I73f1ab36c6c89ced9d2b7b98393805142661dcac Reviewed-on: https://pdfium-review.googlesource.com/6650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-15Improve ObserverPtr usage in CFFL_InteractiveFormFiller.Lei Zhang
BUG=chromium:732322 Change-Id: I479f3edf48fcb2cac32d7fcb76651f9ad1246483 Reviewed-on: https://pdfium-review.googlesource.com/6553 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-15Check for destroyed annotations in CPDFSDK_WidgetHandler::OnLoad().Lei Zhang
BUG=chromium:732039 Change-Id: I0bc6b24cb41f093eae7bd0a96bcdd441ec8322d7 Reviewed-on: https://pdfium-review.googlesource.com/6531 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-15Add more checks for destroyed annotations in CFFL_FormFiller.Lei Zhang
CFFL_FormFiller::CommitData() should check more rigorously and so should its callers. BUG=chromium:732051 Change-Id: If0cee8fb61de10dc7678dad89c330d75bee55aa4 Reviewed-on: https://pdfium-review.googlesource.com/6530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Reenabled a flaky testchromium/3131Jane Liu
Reenabling since can't reproduce failure any more. Bug=pdfium:747 Change-Id: I347a994e0a6b389d39162075f7d5d94ae0048984 Reviewed-on: https://pdfium-review.googlesource.com/6590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Fix crash when inserting empty pathNicolas Pena
The path creation method begins with an open MoveTo point. If nothing else is added, CFX_PathData::GetBoundingBox will try an OOB access in its m_Points. This CL adds a check similar to the one in CPDF_StreamContentParser::AddPathObject. Change-Id: Iec7cfe3379253c021ba7d5f276306a66009f84e2 Reviewed-on: https://pdfium-review.googlesource.com/6593 Commit-Queue: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Add blend to GraphicsDataNicolas Pena
CL [1] added the ability to set the blend mode for a page object. This CL adds the corresponding component to GraphicsData since the blend mode is part of ExtGSState. In addition, a test using the SetBlendMode method is added. [1] https://pdfium-review.googlesource.com/c/5953/ Bug: pdfium:720 Change-Id: I49120284345185c200a45cc3b37ec59f0658e2dc Reviewed-on: https://pdfium-review.googlesource.com/6510 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Fix a buffer overflow in FPDFPage_Flatten().Lei Zhang
BUG=chromium:732661 Change-Id: Ie11a7d97db97ac969fb6230956efbf21c2ed3d87 Reviewed-on: https://pdfium-review.googlesource.com/6555 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Fix some nits in CFFL_InteractiveFormFiller.Lei Zhang
Change-Id: I4c8ce920a4802b5b2ce3dc684cef271fc185feb0 Reviewed-on: https://pdfium-review.googlesource.com/6554 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Remove deprecated FPDPage_HasFormFieldAtPoint().Lei Zhang
It has been deprecated for 2 years now. Use FPDFPage_HasFormFieldAtPoint() instead. Change-Id: I1a5f88b404fbda40f491f9d2001ef3e7788e95a0 Reviewed-on: https://pdfium-review.googlesource.com/6551 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-13Allow zero length streams when parsing.chromium/3130Dan Sinclair
It's possible to create a stream of length 0 in a PDF document. Currently the code will early exit and return a nullptr. This causes issues when you want to print the given PDF as the FPDF_ImportPages code ends up only generating up to the zero length object. This CL allows creating streams with length 0 and updates the PDF saving code to output a blank stream. Bug: chromium:732380 Change-Id: I44182ba4aaac7c51284b002ba01bbc34b6bcf9e0 Reviewed-on: https://pdfium-review.googlesource.com/6490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-13Implement CPWL_ComboBox::OnDestroy() to manage unowned pointers.Lei Zhang
CPWL_ComboBox's unowned pointers to other CPWL_Wnds need to be released at the right time. Also release the unowned pointer for CPWL_Wnd's vertical scroll bar at the right time. BUG=729041 Change-Id: I06a1da35fcb18dae8faf9cd4fbc0b75d38f115b0 Reviewed-on: https://pdfium-review.googlesource.com/6418 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-09Fix types for FT_ULong chars in fpdfedittextchromium/3128chromium/3127Nicolas Pena
FXFT_Get_First(Next)_Char can return large unsigned values. This CL avoids integer overflow and adds some missing checks regarding the ranges of the values returned by those methods. Bug: chromium:727086 Change-Id: Ice7bbb3759e384b7174680a82a2a9380c3611382 Reviewed-on: https://pdfium-review.googlesource.com/6436 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-09Minor changes/addons for annotation APIsJane Liu
As per Lei's comments while looking back at annotation API CLs to attempt to fix Bug 747. Bug=pdfium:737 Change-Id: I96369bf8dcc7afdf49e9a137e7bcba4ff1aeef67 Reviewed-on: https://pdfium-review.googlesource.com/6431 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-09Simplify CPDF_Array::RemoveAt(index, size).Lei Zhang
Instead of one general RemoveAt() method, split it into: - RemoveAt(index) - Truncate(nNewSize) - Clear() Update callers, which are now easier to understand. Update existing unit tests and add new tests. Change-Id: I38fe40146ce8f2479677b2caadd20a1756678768 Reviewed-on: https://pdfium-review.googlesource.com/6417 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-09Disable a new flaky testJane Liu
Bug=pdfium:747 Change-Id: I51656750e5e5e7f7cecefc5244a66333a0213f19 Reviewed-on: https://pdfium-review.googlesource.com/6433 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-07Fixing FPDFPage_TransformAnnotsJane Liu
Came across this error in FPDFPage_TransformAnnots, where SetNewAt() would fail on a bound assertion when a newly created array calls it. This CL contains a fix in the function and adds an embedder test for this. Bug=pdfium:745 Change-Id: I569f225598d956d270ef8f11ee3225acf48aadc7 Reviewed-on: https://pdfium-review.googlesource.com/6353 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-07Basic APIs and tests for creating annotationsJane Liu
1. Added API for adding annotations and modifying common annotation properties * Added three embedder tests covering all of the API functions. Bug=pdfium:737 Change-Id: I369d9e17f589f896f9e8c672382f082e524ae534 Reviewed-on: https://pdfium-review.googlesource.com/6351 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-07Fix EmptyCreation testNicolas Pena
The Contents stream of a page is optional per PDF spec 1.7 Table 3.27. This CL fixes the empty creation test to acknowledge that. Change-Id: I1e59a1fedbf00eafabe87962830d62d8883a5e1f Reviewed-on: https://pdfium-review.googlesource.com/6311 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-05Add missing static asserts for line cap and line join values.chromium/3122chromium/3121wileyrya
Change-Id: Idd04530986a78370459c4361197a5500ae5347f3 Reviewed-on: https://pdfium-review.googlesource.com/6210 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-03Add a basic embedder test for CPWL_Edit.Lei Zhang
Change-Id: Ib381423b81e718410cb1d199aadbf396ee08b29a Reviewed-on: https://pdfium-review.googlesource.com/6251 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-02Rename PWL_FooBar files to cpwl_foo_bar.Lei Zhang
Change-Id: I7ed0ba0acbbee291e285555974ebf50c0073668f Reviewed-on: https://pdfium-review.googlesource.com/6250 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-02Remove unused bits from PWL_Edit headers.chromium/3120Lei Zhang
Change-Id: Ic2e1639ab003f0a4981be0c61714ca9cd0b04c5f Reviewed-on: https://pdfium-review.googlesource.com/6230 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-02Split timer classes out of PWL_Wnd.hLei Zhang
Rename CPWL_TimerHandler and simplify CPWL_Wnd. Change-Id: Ib3850570fc5afdc2fa30f47a5b8754fea3cbf3e6 Reviewed-on: https://pdfium-review.googlesource.com/6175 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-02Remove dead CPDFSDK_Annot code.chromium/3119Lei Zhang
Change-Id: Ied77912f0f657ebc8e36469365de230e552e4956 Reviewed-on: https://pdfium-review.googlesource.com/6233 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-02Clean up CFFL formfiller classes.Lei Zhang
- Consolidate assertions for m_pFormFillEnv. - Remove check for m_pFormFillEnv being NULL. - Pass in a CPDFSDK_Widget* instead of an Annot* and then casting. - Remove unused LoadPopupMenuString() method. Change-Id: Ic22e75c9e41eb54002be812945a3ee80debeca8b Reviewed-on: https://pdfium-review.googlesource.com/6232 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-02Remove unused parameter from CFFL_FormFiller::NewPDFWindow().Lei Zhang
Change-Id: I27164e023c622d5c0d9490aa2b09ac4e66dda0fb Reviewed-on: https://pdfium-review.googlesource.com/6231 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-02Remove explicit CFX_Matrix identity matrix instantiations.Lei Zhang
Change-Id: I96c3429dbe2c572ed409706adfe3707b8b9bf51b Reviewed-on: https://pdfium-review.googlesource.com/6176 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-01Basic APIs and tests for extracting annotationsJane Liu
1. Added API for extracting annotation properties: * Added testing flag "--annot" that outputs the annotation properties into a .txt file. * Added two embedder tests covering all the API functions. Bug=pdfium:737 Change-Id: I95943a9b2b3d5d431bc8a74a31b27b4f4b521026 Reviewed-on: https://pdfium-review.googlesource.com/6092 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-01Simplify code in fpdfformfill.cpp.Lei Zhang
Change-Id: I934150415e5ba515fddd37dab6e028d016052ab8 Reviewed-on: https://pdfium-review.googlesource.com/6173 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-01Clarify IPWL_Filler_Notify::QueryWherePopup() parameters.Lei Zhang
Update implementation and caller, and clean up surrounding code. Change-Id: I40975f79a5d4f560d6a7ee0d327b2e97241d29bd Reviewed-on: https://pdfium-review.googlesource.com/6172 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-01Replace some repeated code with existing CFXJS_Engine::NewString() helper.Tom Sepez
In turn, fix type information for New*() return values. In turn, resolve some ambiguity in a ? operator expression. Change-Id: I45c31d81f815b11590b46dacc8060d8e489dde5c Reviewed-on: https://pdfium-review.googlesource.com/6131 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-01Be less trusting of MaybeLocal<> return types from V8 To* methods.Tom Sepez
Calling ToLocalChecked() will crash otherwise. Bug: 707673 Change-Id: I66a5b36d8cf1710a725e30c2d14a195d08ef25a4 Reviewed-on: https://pdfium-review.googlesource.com/6130 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-06-01Fix content generation to only generate dirty page objects.wileyrya
BUG=pdfium:717 R=dsinclair@chromium.org,thestig@chromium.org Change-Id: I7e0e6fd301d40f9b5341d40cf11167b7748af243 Reviewed-on: https://pdfium-review.googlesource.com/6071 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-31Add missing public APIs to API test.wileyrya
Change-Id: Ia65dab9fa12f2c7645f05651565446fe85330fbc Reviewed-on: https://pdfium-review.googlesource.com/6132 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-31CFXJS_Engine::GetObjDefnID is a static methodTom Sepez
So call it as such. Fix two places where we're invoking it off of an intance. Change-Id: I08712fa27dbdf85c9195cedcc62d7d741b0ad091 Reviewed-on: https://pdfium-review.googlesource.com/6110 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-31Fix OnDestroy method for scroll barsTom Sepez
Bug: 727048 Change-Id: Ib2ce898eeb814f17fca852bcf670678f734d905f Reviewed-on: https://pdfium-review.googlesource.com/6083 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-26Eliminate unneeded calls to FPDFPage_GenerateContentchromium/3115chromium/3114Nicolas Pena
The generating method is not needed for just inserting and rendering. Its purpose seems to be for usage when an already inserted image has been modified or when a copy of the PDF will be saved. Change-Id: I72250b3ba8c53b75249b4ef9ca1bef2d1231288d Reviewed-on: https://pdfium-review.googlesource.com/6091 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-26Fix CPDF_PageRenderContext cleanupTom Sepez
Make CFX_RenderDevice, which owns the IFX_RenderDeviceDriver, responsible for restoring driver state as part of its destruction so that its callers don't have to do so out of turn. Then re-order CPDF_PageRenderContext destruction order so that the progressive renderer is destroyed before the device, and the device destroyed before the options because of unowned pointers to objects owned by these. Bug: 726755 Change-Id: I9a6f23da12140b2758b86e6f33f715ad1c679c3f Reviewed-on: https://pdfium-review.googlesource.com/6073 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-26Add public API for setting the blend mode on a page object.wileyrya
BUG=pdfium:720 R=npm@chromium.org Change-Id: I2a43b34da6946265ca06502b9ff19ad352fd18cb Reviewed-on: https://pdfium-review.googlesource.com/5953 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-26Add public API for getting the bounds of a page object.wileyrya
BUG=pdfium:721 R=npm@chromium.org Change-Id: I71b6281346b3ed67f6b8703eccd7794588559819 Reviewed-on: https://pdfium-review.googlesource.com/6013 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-26Add public API for setting the fill color on a text objectwileyrya
BUG=pdfium:719 R=npm@chromium.org Change-Id: Ifd9330de265f8419d588b65fbd6a6187f17badd1 Reviewed-on: https://pdfium-review.googlesource.com/5950 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-26Add public API for setting LineJoin and LineCap on a pathwileyrya
BUG=pdfium:718 R=npm@chromium.org Change-Id: Icdc1546c87a676a7d05330dece2c5eacd92c0c92 Reviewed-on: https://pdfium-review.googlesource.com/5951 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>