summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
AgeCommit message (Collapse)Author
2018-10-22Rename CPDF_Object::Type enumerators with k prefixesHans Wennborg
This was originally motivated by Clang's newly enhanced -Wshadow warning, which complained about BOOLEAN shadowing a BOOLEAN typedef in winnt.h. The warning has since been changed to not fire on enums shadowing types, but it was suggested that this kind of naming change was desirable anyway. Bug: chromium:895475 Change-Id: I278ce9dbbd88f802fe5bc77fca28b082aa5e684d Reviewed-on: https://pdfium-review.googlesource.com/c/44330 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-17Add CPDF_{Array,Dictionary}Locker to catch illegal iteration patterns.Tom Sepez
Move begin/end methods onto locker object which tracks whether iterators are in existence. Change-Id: Ia869f313fce48d10a0d0180d0cc083eed6ea1584 Reviewed-on: https://pdfium-review.googlesource.com/c/44070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-16Make constants/ pass gn check.Lei Zhang
Change-Id: I1104d5c3c63dbf9f2f286797db842d30c75e2718 Reviewed-on: https://pdfium-review.googlesource.com/c/44077 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Use unique_ptr and span in CPDF_Image::SetImage().Lei Zhang
Fix lint errors as well. Change-Id: I139528b8e76383f878915f9ec940b0af29e155f0 Reviewed-on: https://pdfium-review.googlesource.com/c/44071 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-15Split pdfium_embeddertests sources.chromium/3582Lei Zhang
Move foo_embeddertest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_embeddertests pass gn check. Change-Id: If1fe67c261960c35c344c1047950cd7fdb32c4a1 Reviewed-on: https://pdfium-review.googlesource.com/c/43997 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split pdfium_unittests sources.Lei Zhang
Move foo_unittest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_unittests pass gn check. Change-Id: Id9f649d5d0c76fe4254f3887778516abb75fcbce Reviewed-on: https://pdfium-review.googlesource.com/c/43995 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make core/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: Ia7a29a268e67b1fe21bed5cdd629e06fb5cc7bfb Reviewed-on: https://pdfium-review.googlesource.com/c/43992 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Split core/fpdfapi build rules into various sub-directories.Lei Zhang
Change-Id: I98e2e913f11ff63e70cb841de00a4f56b06ca03b Reviewed-on: https://pdfium-review.googlesource.com/c/43974 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Remove more unnecessary includes and do IWYU as needed.Lei Zhang
Also move some implementations out of headers. Change-Id: I321fc26970c440d874b135bd28e8bc8156b9afee Reviewed-on: https://pdfium-review.googlesource.com/c/43890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Move core/fdrm/crypto/* to core/fdrm/.Lei Zhang
core/fdrm/ currently only contains the crypto directory. Change-Id: I68f4a38e7098f8a3bdc19764bc1ec78c28a386c9 Reviewed-on: https://pdfium-review.googlesource.com/c/43945 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Rename CPDF_{Array,Dictionary}::GetCount() to size().Lei Zhang
Make them compatible with pdfium::CollectionSize(). Change-Id: Ibef3b182e35a7eca7c656cf590462782de0cc157 Reviewed-on: https://pdfium-review.googlesource.com/c/43937 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-10Rename CPDF_ContentMark to CPDF_ContentMarks.Henrique Nakashima
Also change variable names and member names of this type. This better reflects the fact that this class contains all the marks in a page objects, not just one mark. Change-Id: I4fe3d2620e78cbe423f18634f19fa82530d7efe1 Reviewed-on: https://pdfium-review.googlesource.com/c/43813 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-10-10Simplify some object rect calculations.Lei Zhang
Change-Id: I46ae4fb4e0f8d51130f5e5beae286dae5466b629 Reviewed-on: https://pdfium-review.googlesource.com/c/43574 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Do IWYU for cpdf_dictionary.h.Lei Zhang
Move some method implementations out of headers in the process. Change-Id: I8701e360d4addd9aec39fe887d932209985d2443 Reviewed-on: https://pdfium-review.googlesource.com/c/43608 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-06Encapsulate CPDF_PageObject's rect member.Lei Zhang
At the same time, change it from 4 floats to a CFX_FloatRect. Change-Id: I00ded941723d6a264b7a17c73fd337e66b449308 Reviewed-on: https://pdfium-review.googlesource.com/c/43570 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-05Remove optional matrix parameter from CPDF_PageObject::GetBBox().Lei Zhang
Instead, add GetTransformedBBox() with a required matrix parameter and use that when the there is a matrix. Change-Id: I594f3eb6bc7e1bc3eb6aa9f66556ebb1dfdbebe1 Reviewed-on: https://pdfium-review.googlesource.com/c/43553 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-04Refer to const smart pointers consistently.Lei Zhang
SmartPtr<T> const m_Ptr, instead of const SmartPtr<T> m_Ptr. Change-Id: I8001b0334543f49d138a24438def62088a15c6e4 Reviewed-on: https://pdfium-review.googlesource.com/c/43512 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-02Remove dead code in CPDF_PageRenderCache::ResetBitmap().Lei Zhang
Callers only ever pass in nullptr for the bitmap parameter. Change-Id: Iefeb72a1268521a38b3d5ab4b03163b67bf35796 Reviewed-on: https://pdfium-review.googlesource.com/43210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-21Replace CPDF_Color::Copy() with honest-to-goodness operator=().Tom Sepez
Change-Id: Ifcce7b1e513c8859752d5248ae686bbe5349e342 Reviewed-on: https://pdfium-review.googlesource.com/42614 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-21Validate more image values in CPDF_DIBBase.Lei Zhang
Change-Id: Ia5f72e6397ee959d897a945c4069f47c494b5511 Reviewed-on: https://pdfium-review.googlesource.com/42870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Validate some image data in CPDF_Image::InitJPEG().Lei Zhang
Change-Id: I55e840667acfda831488d75efc97504355813dd1 Reviewed-on: https://pdfium-review.googlesource.com/42850 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Fix misc lint errors and other cleanups.Lei Zhang
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26 Reviewed-on: https://pdfium-review.googlesource.com/42811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-09-20Remove many unneeded STL #includes from headers.Lei Zhang
Change-Id: I7010cedee8d17d05b2c37a94d767e6f3a9c48f7d Reviewed-on: https://pdfium-review.googlesource.com/42790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-17Encapsulate CPDF_StreamAcc::LoadAllData().Lei Zhang
Make it a private method, and add public methods so only limited combinations of LoadAllData() arguments are possible. Change-Id: I8c2220eb0e95012350858876586f7c470c40a7c3 Reviewed-on: https://pdfium-review.googlesource.com/42590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-14Make ContentParam::m_Name be a ByteString.Tom Sepez
Currently this is an inline fixed-length char[] buffer. We make a byte string out of this in many places, and the current implementation still memcpy's, so the additional costs should be minimal. Next, we can avoid special-casing names that are longer than the fixed size. Change-Id: I980463cbb2325a9d6080bb51a6dfb0dbd1b704b1 Reviewed-on: https://pdfium-review.googlesource.com/42430 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-13Reland "Introduce FX_Number class as a replacement for FX_atonum()."Tom Sepez
This reverts commit 29e180342e18873babf1c74f7c5c056f90a191b0. Reason for revert: probably harmless Original change's description: > Revert "Introduce FX_Number class as a replacement for FX_atonum()." > > This reverts commit a5d7ad3aa8feb08a14b5cca173d673054c1ade23. > > Reason for revert: Speculative revert to get back before flake. > > Original change's description: > > Introduce FX_Number class as a replacement for FX_atonum(). > > > > The issue with FX_atonum() is that it doesn't return any information > > about whether it range-checked its integer values as a signed or > > unsigned type, even though it knows this as part of its processing. > > > > Rather than adding another out parameter to that function, create > > a class to hold all this information together. > > > > This is the first place things went astray while diagnosing > > bug 882959, in that a large positive value was cast to float as a > > negative value. Unfortunately, this doesn't affect the related bug, > > but is a step in the right direction. > > > > Change-Id: I0977ec8fccf85e2632a962507bdd30a1cbe6d33c > > Reviewed-on: https://pdfium-review.googlesource.com/42353 > > Reviewed-by: Lei Zhang <thestig@chromium.org> > > Commit-Queue: Tom Sepez <tsepez@chromium.org> > > TBR=thestig@chromium.org,tsepez@chromium.org > > Change-Id: Ia56270c3daa80408fc2b23eb4384a77f03f45b82 > Reviewed-on: https://pdfium-review.googlesource.com/42392 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org Change-Id: I83c37aa3040a8890f2117753f19ab1d452d411e7 Reviewed-on: https://pdfium-review.googlesource.com/42410 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-13Revert "Introduce FX_Number class as a replacement for FX_atonum()."Tom Sepez
This reverts commit a5d7ad3aa8feb08a14b5cca173d673054c1ade23. Reason for revert: Speculative revert to get back before flake. Original change's description: > Introduce FX_Number class as a replacement for FX_atonum(). > > The issue with FX_atonum() is that it doesn't return any information > about whether it range-checked its integer values as a signed or > unsigned type, even though it knows this as part of its processing. > > Rather than adding another out parameter to that function, create > a class to hold all this information together. > > This is the first place things went astray while diagnosing > bug 882959, in that a large positive value was cast to float as a > negative value. Unfortunately, this doesn't affect the related bug, > but is a step in the right direction. > > Change-Id: I0977ec8fccf85e2632a962507bdd30a1cbe6d33c > Reviewed-on: https://pdfium-review.googlesource.com/42353 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org Change-Id: Ia56270c3daa80408fc2b23eb4384a77f03f45b82 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/42392 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-13Introduce FX_Number class as a replacement for FX_atonum().Tom Sepez
The issue with FX_atonum() is that it doesn't return any information about whether it range-checked its integer values as a signed or unsigned type, even though it knows this as part of its processing. Rather than adding another out parameter to that function, create a class to hold all this information together. This is the first place things went astray while diagnosing bug 882959, in that a large positive value was cast to float as a negative value. Unfortunately, this doesn't affect the related bug, but is a step in the right direction. Change-Id: I0977ec8fccf85e2632a962507bdd30a1cbe6d33c Reviewed-on: https://pdfium-review.googlesource.com/42353 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-12Set correct stream index when parsing is done in several steps.Henrique Nakashima
When parsing happens in several steps (in pages with > 100 page objects), the position is reset to 0 and the start pointer is advanced. This breaks the calculation of which stream an object belongs to. Passing in the base pointer separately from the start offset allows the correct position to be calculated and the correct stream to be identified. Change-Id: Ic0d5f59f437609158aa97b3c8a18dbd48cd3b0d4 Reviewed-on: https://pdfium-review.googlesource.com/42270 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-11Do not copy data in DecodeAllScanlines().Lei Zhang
The copy will never be read. Change-Id: I129859ed7569e054e66f00314f8ecf20e2c67715 Reviewed-on: https://pdfium-review.googlesource.com/41854 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-11Make flate decode functions' buffer out parameter unique_ptrs.Lei Zhang
Change-Id: Idb14846e87a8287dd911b0a2f7a32146e86c2af7 Reviewed-on: https://pdfium-review.googlesource.com/41853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-11Make RunLengthDecode()'s buffer out parameter a unique_ptr.Lei Zhang
Change-Id: I1dc99831a564e88035c317455411f1eba9aa41c4 Reviewed-on: https://pdfium-review.googlesource.com/41852 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-11Make HexDecode()'s buffer out parameter a unique_ptr.Lei Zhang
Do the same for A85Decode(). Change-Id: Ic6a0e5e8a63defa104e35e97eb9ce4223aac23a7 Reviewed-on: https://pdfium-review.googlesource.com/41851 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-04Fix some more span/memcpy interactions.Tom Sepez
Use the preferred idiom of creating a subspan, which makes the proper checks prior to the copy. Change-Id: Ia7f25b5760dea5707df66cf421195b23a1ce0ad0 Reviewed-on: https://pdfium-review.googlesource.com/41911 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-29Use pdfium::span<> in fpdf_parser_decode.h helper functions.Tom Sepez
Change-Id: Ib0a2bd21fe4304163cf9c080e07475e7c033c299 Reviewed-on: https://pdfium-review.googlesource.com/41570 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-29Remove FPDFAPI_ prefix from internal cid/encoder functionsTom Sepez
These look too much like public/ FPDF functions otherwise and yet they are not exposed anywhere beyond core/fpdfapi. Disambiguate one method vs. top-level function usage as a result. Bug: pdfium:1141 Change-Id: I9cfdfced90386bb9ef6b2b86f568f2e6f8ee6a5a Reviewed-on: https://pdfium-review.googlesource.com/41530 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Use pdfium::span<> in more image modulesTom Sepez
Change-Id: Ie344bb37abf7dde158d03cc2897dca3588f1a5e3 Reviewed-on: https://pdfium-review.googlesource.com/41550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-28Use std::span<> in CCodec_JPEGModuleTom Sepez
Also rename .cpp file to match class name and .h file. Modify some helper functions to operate on spans. Move some initializations to member declarations. Change-Id: Ie0889bda91daaef80fae6f5681f8ce068e92453b Reviewed-on: https://pdfium-review.googlesource.com/41534 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Rename CFX_DIBSource to CFX_DIBBase.Tom Sepez
It is not a source from which you can get CFX_DIBs, but rather a base class from which all DIBs inherit. Do the same thing for the CPDF_DIBSource wrapper class. Mechanical change apart from adding a one-line comment in cfx_dibbase.h Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184 Reviewed-on: https://pdfium-review.googlesource.com/41352 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Use pdfium::span<> in CPDF_Stream::SetData().Tom Sepez
Conversion to span makes this more elegant in a number of places, owing to std::vector directly converting to span, and the bytestring's ToRawSpan(). Disambiguate single-argument forms to allow passing {} as an argument. Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2 Reviewed-on: https://pdfium-review.googlesource.com/41272 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-14Remove more default arg = nullptr cases.Tom Sepez
Bring in line with standards. Remove argument entirely for mac code that is always nullptr. Change-Id: I0710bdbd51fc0bc2e1d428ef44976be39a631147 Reviewed-on: https://pdfium-review.googlesource.com/40091 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-10Kill some optional parameters that are always supplied.Tom Sepez
No need to even bring any .cpp files in line with these headers. Change-Id: I934169d77ae09adc11f02e5ea92b1f8b078c9477 Reviewed-on: https://pdfium-review.googlesource.com/39876 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-10Make the 4th parameter in CPDF_Form non-optional.Lei Zhang
Instead, add a 3-parameter constructor that delegates to the 4-parameter constructor. Change-Id: Ied6c55360084ea26b07dbaa449bf155b5db182f0 Reviewed-on: https://pdfium-review.googlesource.com/39872 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-10Minor cleanup in CPDF_ContentParser.Lei Zhang
Add more asserts and use more constants. Change-Id: I51f1d9d1b501f4e99d9793b6c803676b7221be17 Reviewed-on: https://pdfium-review.googlesource.com/39871 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-10Make CPDF_PSFunc::m_PS mutable.Tom Sepez
Preferred over const_cast<> to show how that state is used. Change-Id: Ia6fe6bf46fb7fa8e701481b1604073b5d7f222fa Reviewed-on: https://pdfium-review.googlesource.com/39870 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-09Change CPDF_Font::GetNextChar()'s in-out parameter to pass by pointer.chromium/3518Lei Zhang
Instead of passing by non-const reference. Adjust the override in CPDF_CIDFont and CPDF_CMap::GetNextChar() as well. Change-Id: I0ee6dc21077101cbeeb0e334498075fc463a2d65 Reviewed-on: https://pdfium-review.googlesource.com/39492 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-18Use casts to deduplicate implementation of const/non-const methods.Henrique Nakashima
Change-Id: Ia5a4e89bff8a1dbc46246f5a734170765b7ee74e Reviewed-on: https://pdfium-review.googlesource.com/38250 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-14Use more ternary operators in content mark code.chromium/3493chromium/3492Lei Zhang
Change-Id: Ibf09905523ae2d80ce48bfe7337733d8dc718669 Reviewed-on: https://pdfium-review.googlesource.com/37850 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>