summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-06-21Fixed optional content not rendered when OCGs array is empty.chromium/3138Henrique Nakashima
At least one nonnull entry needs to be in OCGs for it to be considered present. See "OCGs" in table 4.49 in the PDF 1.7 spec. Bug: pdfium:491. Change-Id: I7eae65ba1fabff9cf1d5cea50d059a04814a3fec Reviewed-on: https://pdfium-review.googlesource.com/6751 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-21Renamed bug_492 pixel test expected png.Henrique Nakashima
The test should be reenabled by this change. Also updated the expected .png, as it's slightly displaced since it was run a year ago. Change-Id: I2e7003f8b353212804d3fd7af08c41476351f575 Reviewed-on: https://pdfium-review.googlesource.com/6813 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-21skia/BUILD.gn: s/ImageEncoder_none/ImageEncoder/Hal Canary
msarett@ realized that if all of the encoders were disabled, then these files were equivalent. Bug: Change-Id: I1bbfd00b9324fb4b051154089c84b7d759ff1a1f Reviewed-on: https://pdfium-review.googlesource.com/6810 Commit-Queue: Hal Canary <halcanary@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com>
2017-06-21Fix typos that meant to say handler instead of hander.Lei Zhang
Change-Id: I60f556f107f740b854237bc89184b09e4f1d2585 Reviewed-on: https://pdfium-review.googlesource.com/6790 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Use early returns in more CPDFSDK_FormFillEnvironment code.Lei Zhang
Same for CFFL_InteractiveFormFiller. Fix other nits in both classes and in related code. Change-Id: I9901c48794358889cc20638455ffd7fcb3344574 Reviewed-on: https://pdfium-review.googlesource.com/6652 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-20Cleanup fpdf_parser_decodeNicolas Pena
This CL fixes some nits in fpdf_parser_decode, especially avoiding non-const reference parameters. Change-Id: Ibb914850afd924bb398f886ac862f7589519ef7e Reviewed-on: https://pdfium-review.googlesource.com/6750 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Add FORM_GetSelectedText() function.Diana Gage
This function copies the selected text from a form text field or form combobox text field into the buffer parameter and returns the length of the selected text string. When buffer is a nullptr or buflen is less than the length of the selected text, this function does not modify the buffer and only returns the selected text length. BUG=chromium:59266 Change-Id: Ie77de38e45bbe6f9ea033826c961435304eedfc7 Reviewed-on: https://pdfium-review.googlesource.com/6413 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-20Add sample PDF with comboboxes.Lei Zhang
There are three comboboxes: 1) Normal combobox with pre-selected value. 2) User editable combobox. 3) Read-only combobox, which is actually invisible. Change-Id: I6bc7955459a11bf043ace7002393c2d7ee8471e9 Reviewed-on: https://pdfium-review.googlesource.com/6770 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-20Wrapper class for annotation dictionary + CPDF_Formchromium/3137Jane Liu
Simple wrapper class for annotation + its path parsing form object. This will be used in APIs for extracting and setting annotation paths. Bug=pdfium:737 Change-Id: I2e8131672d087613213735295c6d01e377b956e7 Reviewed-on: https://pdfium-review.googlesource.com/6730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-20Fix signedness of height in BMP decoderNicolas Pena
Change-Id: I8a17739538a9ecd63d713007550177579c0b72f0 Reviewed-on: https://pdfium-review.googlesource.com/6731 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Cleanup tiling and shading patterns in correct orderDan Sinclair
When a Shading is created we have both a ShadingPattern and a ShadingObject. The ShadingPattern is a ref-counted object that is stored in the CPDF_DocPageData. The ShadingObject, when we have a tiling pattern parent, is stored in the CPDF_Form of the tiling pattern. Currently during destruction it is possible for the ShadingPattern to get cleaned up before the ShadingObject which causes the UnownedPtr probe to fire. This CL loops over all patterns and for each Tiling pattern forces the CPDF_Form to get cleared. This then removes the ShadingObject before we remove the ShadingPattern. Bug: chromium:728992 Change-Id: Ife65607aa97f69440b03028981b5575b1e297093 Reviewed-on: https://pdfium-review.googlesource.com/6651 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-19Add heuristic for improving text rendering in CPDF_CharPosList::LoadNicolas Pena
This CL uses the following algorithm for improving substitute font spacing (we are assuming the text layout is horizontal): * Calculate PDFWidth, the width that the PDF says the glyph should have. * Calculate FTWidth, the width calculated by freetype for the glyph, using the substitute font that we'll use to render it. Note that some embedded fonts have PDFWidth == FTWidth + 1, so we consider that to be matching widths. * If PDFWidth > FTWidth + 1 , move the x coordinate by the difference / 2 so that the glyph is rendered in a more centered spot and the text looks better. * If PDFWidth < FTWidth, transform the glyph horizontally by PDFWidth / FTWidth so that the glyph gets compressed and does not overlap with surrounding glyphs. Bug: chromium:431507 Change-Id: Ia378344253fabe44d93af4daab98bb3b7bca22de Reviewed-on: https://pdfium-review.googlesource.com/6630 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-19Fixing metadata not read from linearized file.chromium/3136Henrique Nakashima
This still won't work if the info dict is not on the first page without first calling FPDFAvail_IsFormAvail or FPDFAvail_IsPageAvail, as these are the methods that trigger parsing the rest of the data. Bug: pdfium:664 Change-Id: I0b0193e415a1153dcfb8bfba0e0482da6b6ba53c Reviewed-on: https://pdfium-review.googlesource.com/6610 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
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-19Use EXPECT_STREQ() in fx_system_unittest.cpp.Lei Zhang
Instead of using EXPECT_EQ() and constructing a std::string. Change-Id: I7f349f49a03b1ebbad15865f9783568f4d025d91 Reviewed-on: https://pdfium-review.googlesource.com/6670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@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-19Make out_row_buffer an std::vectorNicolas Pena
The out_row_buffer of BMPDecompressor is made a vector. This forces the class to have constructor/destructor. Some other members were changed to be of size_t instead of int32_t. Change-Id: I3f70b0322dcee2ddf9a00da7962b43f3415ba545 Reviewed-on: https://pdfium-review.googlesource.com/6691 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-19Added EmbedderTest::RenderPageWithFlags()Jane Liu
Currently, in embedder tests, pages can only be rendered with no flags specified. With the addition of annotation APIs and corresponding embedder tests, it is helpful to add a test method to allow flags to be passed in when rendering pages in embedder tests. This CL adds such a method. Bug=pdfium:737 Change-Id: I277831cb2e228154e9a65b078a241b8e61220664 Reviewed-on: https://pdfium-review.googlesource.com/6711 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
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-19Consistently pass FPDF handles by value.Lei Zhang
Change-Id: I1b31217c756620873f59527768464aec02a82900 Reviewed-on: https://pdfium-review.googlesource.com/6677 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-19Converting CFX_ByteTextBuf to ostringstream in SAX.Henrique Nakashima
Bug: pdfium:731 Change-Id: Ic492e8900c4a69082ff9c2384006a4e6bfa3313e Reviewed-on: https://pdfium-review.googlesource.com/6592 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-19Converting CFX_ByteTextBuf to ostringstream in cxml_parser.cpp.Henrique Nakashima
Bug: pdfium:731 Change-Id: Id4cb57aaf1d045d5052869477a8c5082cab8961c Reviewed-on: https://pdfium-review.googlesource.com/6675 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@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-15Remove unused BMP compressing codeNicolas Pena
Change-Id: I64e32fc9226f57e1c9adff7809fabc6cd56e7a8f Reviewed-on: https://pdfium-review.googlesource.com/6611 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-14Cleanup fx_bmp part 1Nicolas Pena
This CL creates BMPDecompressor from a struct and moves into this class many methods which naturally belong to it. Change-Id: I042fac9b48d0b732ee9e43fbeb0eec6b52007dab Reviewed-on: https://pdfium-review.googlesource.com/6511 Commit-Queue: Nicolás Peña <npm@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-14Fix bad format string in CXFA_FM2JSContext.Lei Zhang
PDFium's vswprintf() is based on the win32 version to be consistent across platforms. On Windows, %s has different meanings depending on whether the printf() variant is wide or not. BUG=chromium:732533 Change-Id: I7437ecd253da1234728c1e0897f02b7f907aada8 Reviewed-on: https://pdfium-review.googlesource.com/6550 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-13Check validity of color indices in bmp_decode_rgbNicolas Pena
The pal_num member of bmp_ptr indicates the number of color indices used by the bitmap. This CL returns an error when an invalid index is found, since otherwise a heap-buffer-overflow can occur since the size of m_pSrcPalette is calculated based on pal_num. Bug: chromium:616670 Change-Id: I397958704bed1aa1ae259016ffd5033c07a801ee Reviewed-on: https://pdfium-review.googlesource.com/6470 Reviewed-by: dsinclair <dsinclair@chromium.org> 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-13Add CFGAS_FormatString helper to extract digits.Dan Sinclair
This CL adds ExtractCountDigits and ExtractCountDigitsWithOptional to cleanup the digit extraction code. Change-Id: I6c3f4b435ec41b429b18cd9af9be46551a7fa391 Reviewed-on: https://pdfium-review.googlesource.com/6391 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-13Converting CFX_ByteTextBuf to ostringstream in cpdf_pagecontentgenerator.Henrique Nakashima
Bug: pdfium:731 Change-Id: If606359bd9264a6f440871ab824ab54a4efae901 Reviewed-on: https://pdfium-review.googlesource.com/6450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-13Converting CFX_ByteTextBuf to ostringstream in cpdf_syntax_parser.cpp.Henrique Nakashima
Bug: pdfium:731 Change-Id: I6d1f59318cd63539ddce3fbdd3f0a375060b6476 Reviewed-on: https://pdfium-review.googlesource.com/6435 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-13Fix FPDFAction_GetFilePath() documentation error.Lei Zhang
Commit 5f597db5 accidentally changed this. Probably due to copy/pasting. Change-Id: I41f6876da28d5d744d6d169c67b33399893e3585 Reviewed-on: https://pdfium-review.googlesource.com/6416 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-12Trimming brackets and quotes outside URLs.chromium/3129Henrique Nakashima
Bug: pdfium:655 Change-Id: Ibf4217b35b613d21d3e8e060608b502ef79acd9e Reviewed-on: https://pdfium-review.googlesource.com/6392 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@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-09Converting CFX_ByteTextBuf to ostringstream in fdpf_parser_decode.cpp.chromium/3126Henrique Nakashima
Bug: pdfium:731 Change-Id: I20c3d87dba91d1489794abb77afcd2d7e9db88fe Reviewed-on: https://pdfium-review.googlesource.com/6393 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: 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>