summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-12-06Fix ps rendering.chromium/3287Henrique Nakashima
Also fix other occurrences that were missed. Bug:pdfium:947 Change-Id: Ic7e909ff9ce3abdf91e8e9ba108c84ad28b2fd65 Reviewed-on: https://pdfium-review.googlesource.com/20472 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-06Fix nits on some font code.Lei Zhang
Change-Id: I80be0de1a7d9ba502b4468bc13a4595566f8fb30 Reviewed-on: https://pdfium-review.googlesource.com/20432 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-06Move V8 helper methods to their own class.Dan Sinclair
This CL extracts the V8 helper methods from the CFXJS_Engine and places them in a CJS_V8 class which the engine inherits from. This will allow inheriting the CJS_V8 class into CFXJSE_Engine to share the helper methods. Change-Id: I58a7cd7ebac3af303ecbeee84c6940186a0f1dc6 Reviewed-on: https://pdfium-review.googlesource.com/20470 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-12-05Replace uses of bsearch().chromium/3286Lei Zhang
Either switch to std::lower_bound(), or brute force when the search space is very small. Change-Id: I54db346aeb6f2e8000e95a6a9c8fbdd512df500a Reviewed-on: https://pdfium-review.googlesource.com/20431 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-05Replace bsearch() in FPDFAPI_CIDFromCharCode().Lei Zhang
Use std::lower_bound() instead. Change-Id: I0bed2a90f3aa427a283cd86a050a027ec7a64358 Reviewed-on: https://pdfium-review.googlesource.com/20430 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-05Remove redundant field in struct FXCMAP_CMap.Lei Zhang
Change-Id: Ibac6398b5849820562830bb8ed95c3428496f7ef Reviewed-on: https://pdfium-review.googlesource.com/20410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-05Fix CXFA_SimpleParser member destruction order.Lei Zhang
To avoid confusing UnownedPtr. BUG=chromium:791616 Change-Id: Ieb637f726049eee7c640b6de3b6ecd848ab40384 Reviewed-on: https://pdfium-review.googlesource.com/20391 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-05Avoid integer overflows in CPDF_FixedMatrix::Transform().Lei Zhang
Use floating point math and saturated_cast to calculate the transform. Refactor CFX_BilinearMatrix::Transform() to share common code, instead of using integer math and CheckedNumerics. BUG=chromium:791048 Change-Id: Ib3812b3b3b9373a8eb3b1dde12cb28d424e0bb3e Reviewed-on: https://pdfium-review.googlesource.com/20390 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Simplify some CFX_FloatRect methods.chromium/3285Lei Zhang
Also add a comment about the various CFX_FloatRect to FX_RECT conversion methods. Change-Id: Ia9984797dc513cdc487fe9972b32c216c9f99ec1 Reviewed-on: https://pdfium-review.googlesource.com/20217 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-04Simplify color calculations in CFX_ImageTransformer.Lei Zhang
Change-Id: I14e614dbd0b7c1187b686bf574d14b94f04a3e7e Reviewed-on: https://pdfium-review.googlesource.com/20271 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Simplify code in CFX_ImageTransformer.Lei Zhang
Also fix lint errors. Change-Id: Iaf5fb440fd43d5c36b00630e16d700827c09fc7f Reviewed-on: https://pdfium-review.googlesource.com/20270 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Refactor CFX_ImageTransformer down sample calculations.Lei Zhang
Change-Id: Ib3aa0b6ce2fa7b2a643068cb9ffcaca9fe18d3de Reviewed-on: https://pdfium-review.googlesource.com/20258 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Refactor CFX_ImageTransformer bicubic calculations.Lei Zhang
Change-Id: I47c0ae6dbdf339ab7ade36b141c220b8a3fb2274 Reviewed-on: https://pdfium-review.googlesource.com/20257 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Remove SetResultCreateNodeDan Sinclair
This CL removes the SetResultCreateNode method and inlines into the one caller. The XFA_RESOLVENODE_RSTYPE enum is also renamed XFA_ResolveNode_RSType to make it easier to find XFA_RESOLVENODE_RS objects. Change-Id: I937b612be062c5b7b05fd8d2822cd12cb882ba06 Reviewed-on: https://pdfium-review.googlesource.com/20370 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Refactor CFX_ImageTransformer bilinear calculations.Lei Zhang
Change-Id: Ia38329bf5622c0ae6f5c4173332d2140de08c567 Reviewed-on: https://pdfium-review.googlesource.com/20256 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Remove CXFA_ValueArrayDan Sinclair
This CL removes the CXFA_ValueArray. Some of the code in XFA_RESOLVENODE_RS is duplicated, but the duplication makes the code clearer. Change-Id: I7495bb8c614a3d8919bfca858866932774f13fd8 Reviewed-on: https://pdfium-review.googlesource.com/20350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Cleanup ResolveObjects params and returnDan Sinclair
The return value of ResolveObjects is always used as a boolean, so change from int32_t. The XFA_RESOLVENODE_RS object was made a pointer from a ref. Change-Id: I030036c01101680e36f4ddf524b468354a2e6850 Reviewed-on: https://pdfium-review.googlesource.com/20331 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Cleanup CFXJSE engine and resolve processorDan Sinclair
Change-Id: Ibb7411a7c90f723a19fd5d41552988bc8943e4ea Reviewed-on: https://pdfium-review.googlesource.com/20330 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Break out CFX_ImageTransformer color calculations.Lei Zhang
Change-Id: I5d3a01310bd5fcddbb8c39025b07a2e83ddae84f Reviewed-on: https://pdfium-review.googlesource.com/20255 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Break out CFX_ImageTransformer mono calculations.Lei Zhang
Change-Id: Ibd9ca20e902bbd2b62af12d25836497413912b1b Reviewed-on: https://pdfium-review.googlesource.com/20254 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Add text unit to glyph unit conversion to CPDF_Type3Char.Lei Zhang
Use it in type 3 font code. Change-Id: I8b0eb462cc0308f1700d21a62efc929babae8e20 Reviewed-on: https://pdfium-review.googlesource.com/20215 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Cleanup CFXJSE_Engine visibilityDan Sinclair
This CL makes CFXJSE_Engine methods private where possible and shuffles static methods to the top of the declarations. Change-Id: Ife84ce30d00e126bcbc5cb86d1a189eec2c7cb1c Reviewed-on: https://pdfium-review.googlesource.com/20310 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Break out CFX_ImageTransformer alpha calculations.Lei Zhang
Change-Id: I4f221d5d6c17e8507f87d9c63b87431cc2b8f45e Reviewed-on: https://pdfium-review.googlesource.com/20253 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Shuffle XFA code arounddan sinclair
This CL moves some XFA code around to better match the files in which it is either used or defined. Change-Id: Iec3df187326e48189a048355a8bef76cccb4cdb4 Reviewed-on: https://pdfium-review.googlesource.com/20250 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-12-04XFA JS method cleanupdan sinclair
Change-Id: I182388970e422bd31d011628a4f1b905d12b0da0 Reviewed-on: https://pdfium-review.googlesource.com/20193 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Remove XFA isolate trackerdan sinclair
We don't add anything to the tracker lists so we can remove the tracker. The only thing the Initialize and Finialize methods are doing now is to trigger a v8::V8::Dispose which should happen automatically at exit anyway. Change-Id: I1f783ae5a1df3df63fb067ab30310791b6c44929 Reviewed-on: https://pdfium-review.googlesource.com/20192 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Fix nits in CPDF_Type3Font.Lei Zhang
Change-Id: Ib922184ee844e66a0b29f49025e83e13eb81fdb8 Reviewed-on: https://pdfium-review.googlesource.com/20214 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-12-04Remove unused XFA codedan sinclair
Change-Id: Iea75ce6b3a7e06b7977491a89e7a31755f038312 Reviewed-on: https://pdfium-review.googlesource.com/20191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-12-04Break out CFX_ImageTransformer mask calculations.Lei Zhang
Change-Id: Iab7ff29c2ce9ed56715b5897e89da2d9d693583c Reviewed-on: https://pdfium-review.googlesource.com/20252 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Add functions for common code in CFX_ImageTransformer.Lei Zhang
Change-Id: I556934f61f24883e684865e4a8fc5e0519248cee Reviewed-on: https://pdfium-review.googlesource.com/20251 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-04Make a CXFA_DocumentParser member Unowned.Lei Zhang
Fix/cleanup ctors/dtors in related classes. Change-Id: Ia05ec9b6892fd7d19d0a417fc1226a407e3ac260 Reviewed-on: https://pdfium-review.googlesource.com/20216 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Make CXFA_SimpleParser members const or Unowned.Lei Zhang
Fix ownership issues, and simplify CXFA_SimpleParser ctors. Change-Id: Ie083080297c5c2586ae3e6a8355839fcb86ee9ea Reviewed-on: https://pdfium-review.googlesource.com/20130 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Check for success of decodes to avoid infinite loopsNicolas Pena
Bug: 790693 Change-Id: I9b1d87e024229d8b01f55ec554e2cc544db6ac06 Reviewed-on: https://pdfium-review.googlesource.com/20230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-12-01Add CFX_FloatRect::ToRoundedFxRect().Lei Zhang
Unlike ToFxRect(), which floors the LBRT values. Also fix some nits. Change-Id: I0680eebb09031807a14402ca30b13558ea5b56d9 Reviewed-on: https://pdfium-review.googlesource.com/20213 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Add CFX_FloatRect::Scale().Lei Zhang
Unlike ScaleFromCenterPoint(), Scale() just scales the LBRT values. Also add unit tests for CFX_FloatRect::Normalize(). Change-Id: Iebf48fa9adcf47adff3255b157d3e3056f3687fc Reviewed-on: https://pdfium-review.googlesource.com/20212 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Rename CFX_FloatRect::Scale() to ScaleFromCenterPoint().Lei Zhang
Change-Id: I6baab14c989e8ae692ed1c846b135af95c09ce37 Reviewed-on: https://pdfium-review.googlesource.com/20210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Remove unused CFX_FloatRect::Substract4().Lei Zhang
Change-Id: I08706f53bf3960cbea60b09a1702bf0ba371f1ce Reviewed-on: https://pdfium-review.googlesource.com/20211 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Add some CFX_FloatRect unit tests.Lei Zhang
Change-Id: I32cc3cb0a8a987980b900a5650cc051cb50dd1cc Reviewed-on: https://pdfium-review.googlesource.com/20190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-12-01Remove unneded structs from CFX_CTTGSUBTable part 2Nicolas Pena
This CL continues removing structs from CFX_CTTGSUBTable Change-Id: I1ede1e3e736f87292b6119406fd5f12a0bb7e7cb Reviewed-on: https://pdfium-review.googlesource.com/20170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-12-01Encapsulate CPDF_Type3Char members.Lei Zhang
Change-Id: Iec4e999d76dabc9b6cd00323881c5c87afc5f629 Reviewed-on: https://pdfium-review.googlesource.com/19930 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-30Simplify XDP parsing codeDan Sinclair
This CL cleans up the XDP packet parsing code. This is followup from a previous CL. Change-Id: Ic4a855e67e1b22d0703e53e9a2a9b4923775b6ad Reviewed-on: https://pdfium-review.googlesource.com/20090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Rename XFA_ATTRIBUTEENUM to XFA_AttributeEnum enum classDan Sinclair
This CL changes the enum XFA_ATTRIBUTEENUM to an enum class XFA_AttributeEnum. Methods expecting an int32 have been updated to take or return the XFA_AttrbuteEnum type. Change-Id: I268453949545fe2dd3eae707be4d9cc7edeff763 Reviewed-on: https://pdfium-review.googlesource.com/20070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Move packet information into simple parserDan Sinclair
This CL moves the packet information into the anonymous namespace of the simple parser. There is slight duplication in that two of the namespace URIs have been copied into other files but this duplication allows for a bunch of simplification. Change-Id: I33092424ff4cb57eaf85da97a92fa6cf7b11f2ef Reviewed-on: https://pdfium-review.googlesource.com/20050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-30Make parsers work off XFA_PacketType enumDan Sinclair
This CL changes the various parsers to use XFA_PacketType instead of XFA_XDPPACKET. This just leaves XFA_XDPPACKET for determining if a given node can be created in a given packet. Change-Id: I6fd23480c0c780a131d23b64b7c7e9d8684b0220 Reviewed-on: https://pdfium-review.googlesource.com/20013 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-30A CXFA_Node can only be in one packetDan Sinclair
When a CXFA_Node is created it's created as part of a specific packet. Previously the code would accept an XFA_XDPPACKET which was stored internally. This had the potential to allow a node to exist in multiple packets. This CL changes the XFA_XDPPacket to the XFA_PacketType enum class and cleans up a lot of uses to use the more specific packet type. Change-Id: I7fc8c843bfa6bd32295ae58a26bcec311e43c4b0 Reviewed-on: https://pdfium-review.googlesource.com/20012 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Cleanup XFA packet codeDan Sinclair
Remove GetPacketByID, move GetPacketByName to the xfa_utils file. Cleanup CreateNode to accept the XFA_XDPPACKET instead of the packet info. Change-Id: I0f246c84f61b6b4175ca307bdcd125d9bc24bb1e Reviewed-on: https://pdfium-review.googlesource.com/20010 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Rewrite lower level details of extracting text from pageRyan Harrison
The current implementation of text extraction was difficult to understand, duplicated logic that existed in other methods, and wasn't clear about the units the inputs were in. It also didn't handle control characters correctly. The new implementation leans on the methods for converting indices between the text buffer index and character list index spaces to avoid duplication of code. It also makes it clear to the reader that inputs are in the character list index space. Finally, it fixes issues being seen in Chrome with respect of ranges being slightly off. This CL also adds a test for extracting text that has control characters. BUG=pdfium:942,chromium:654578 Change-Id: Id9d1f360c2d7492c7b5a48d6c9ae29f530892742 Reviewed-on: https://pdfium-review.googlesource.com/20014 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-11-30Create CXFA_Node::NameToAttributeEnumDan Sinclair
This CL removes XFA_GetAttributeEnumByName and moves the functionality into CXFA_Node::NameToAttriuteEnum. Change-Id: Id1484103c62bf7728d5406c22fb9d83fc0e032e1 Reviewed-on: https://pdfium-review.googlesource.com/19791 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Move setting of XML content back to specific set methodsDan Sinclair
This removes the need for the casting as we know the type in the caller. Change-Id: I9fe30d9f8e6110356549c283980e2f4f37f43d02 Reviewed-on: https://pdfium-review.googlesource.com/19870 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>