summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-03-16Create common base class for TxtBreak and RTFBreak.Dan Sinclair
This CL starts extracting common members between the two break classes into a common base class. This also normalizes some of the member names to be the same across classes. Change-Id: I7f4e5065f2dac79eb4ebba397458236cc0609d38 Reviewed-on: https://pdfium-review.googlesource.com/3058 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-16Use EXPECT_FLOAT_EQ in cpdf_devicecs_unittestNicolas Pena
Change-Id: I2e4eba78c5764de108c203b0e0efcd4e81b7bab2 Reviewed-on: https://pdfium-review.googlesource.com/3068 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-16Compare to epsilon instead of 0 in CFX_Matrix::SetReverseNicolas Pena
Since we are going to divide i by 0, it is better to compare it to epsilon and avoid wonkiness from division by something too close to 0. BUG=chromium:702041 Change-Id: I8136d6063f8debd41cef37eaab7e4097b3f32f4b Reviewed-on: https://pdfium-review.googlesource.com/3090 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-15remove CFX_ArrayTemplate from fde/xml.Tom Sepez
Change-Id: I62499a271e753e44234412fd855fbd8a56763d71 Reviewed-on: https://pdfium-review.googlesource.com/3055 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-15Add array_buffer JS test.Tom Sepez
JS Array Buffers are the first candidate to be allocated from PartitionAlloc when it becomes available, so add test first. Presently, we will return as large an array buffer as the system can handle; this is generally a bad idea so limit them to 256MB and test that we handle failure. Change-Id: I205745a7938d69eb32ac883b90824f2f9e584ec7 Reviewed-on: https://pdfium-review.googlesource.com/3065 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-15Reset tree traversal when we think we're at the startchromium/3043Nicolas Pena
If the PDF declares it has a gazillion pages when it does not, we just start traversing again from the start. This CL fixes that. BUG=chromium:680222 Change-Id: Ie9b55abc0aaa372429b3d995a7e1e7ab58fb7965 Reviewed-on: https://pdfium-review.googlesource.com/3060 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-15Use map of unique_ptr in cxfa_textparser.Tom Sepez
Change-Id: I005f9da5ab64558689204f23d3444cdc68f3c59b Reviewed-on: https://pdfium-review.googlesource.com/3064 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-15remove CFX_ArrayTemplate from fxet_list.Tom Sepez
Change-Id: I7a26c961c6c2667440bcc04bfd636087660ea238 Reviewed-on: https://pdfium-review.googlesource.com/3063 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-15Refactor some CPDF_ColorSpace code.Lei Zhang
Change-Id: I1e30d68dae3bf70cf3c426f6126d593b7f1c3ba4 Reviewed-on: https://pdfium-review.googlesource.com/2991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-15Clean up more CPDF_PSEngine code.Lei Zhang
Change-Id: I229a3108a787725bbf2f000c39ee19d0680e9150 Reviewed-on: https://pdfium-review.googlesource.com/2968 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-15Fix botch introduced at 193e6ca, try 2.Tom Sepez
Change-Id: I9eb6e8c621b0562413873ac67b362efa68fc3ab8 Reviewed-on: https://pdfium-review.googlesource.com/3061 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-15Roll DEPS for v8 to 5362e552.Lei Zhang
TBR=jochen@chromium.org Change-Id: I6d5c5c6732a3f2fa2f99c4fd0178f6862a0435d0 Reviewed-on: https://pdfium-review.googlesource.com/3010 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-15Cleanup nits from prior CLsDan Sinclair
Change-Id: Ie69dfc32e7b526eca2ac6ae621eed879ad98476e Reviewed-on: https://pdfium-review.googlesource.com/3054 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-15Clean up fx_agg_driver a bitNicolas Pena
Change-Id: I44af42c02232742edaf9f59ee63f4575e33513fb Reviewed-on: https://pdfium-review.googlesource.com/3057 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-15Remove unused methods and data from fgas_codepageDan Sinclair
The methods are not called, so the data is not used. Removed. Change-Id: I29e904da2a000fd5173d2f5240ad377613db200a Reviewed-on: https://pdfium-review.googlesource.com/3050 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-15Fix an integer underflow in the BMP decoder.Lei Zhang
Make RLE error handling more consistent. BUG=chromium:700576 Change-Id: I37290ede666ba3e0a697d9d6eb209f869a07293d Reviewed-on: https://pdfium-review.googlesource.com/2990 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-15Replace FX_POSITION in GFGAS_FontMgr with boolDan Sinclair
Change-Id: Iddd99312aee6447c05be5633eead023a004e65e1 Reviewed-on: https://pdfium-review.googlesource.com/3034 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-15Add IndexInBounds() convenience routine.Tom Sepez
Avoid writing |Type| in CollectionSize<Type>() so that index type can change without rewriting conditions. Change-Id: I40c94ca39148b379908760ba9b861114b88af7bb Reviewed-on: https://pdfium-review.googlesource.com/3056 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-14remove CFX_ArrayTemplate from fx_extension.cppTom Sepez
Change-Id: Iccd9e374dc982da5cb2a9c75e5e16b2ea261e346 Reviewed-on: https://pdfium-review.googlesource.com/3053 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-14Replace CFDE_TxtEdtPage FX_POSITION usage with uint32_tchromium/3042Dan Sinclair
Change-Id: I8cd68aaeb3c1f7ba92f32bc4846bf2e7d02111e4 Reviewed-on: https://pdfium-review.googlesource.com/3033 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-14Use std::vector for content layout item arraysTom Sepez
Change-Id: Iebbb8e16dae503807fa12cd2d20577082d2a3bca Reviewed-on: https://pdfium-review.googlesource.com/2960 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-14Prevent integer overflow in CPDF_CIDFONT::LoadMetricsArrayNicolas Pena
The CIDs are unsigned integers. Avoid overflow since they are given as input from the PDF file. BUG=chromium:700787 Change-Id: Icdc3efbbd0f4f2ad8d5b4f4f52926e20f7e06391 Reviewed-on: https://pdfium-review.googlesource.com/3052 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-14Convert CPDF_Creator::m_Pos to uint32_tDan Sinclair
Currently m_Pos is a FX_POSITION. The value stored into the void* is typically a uint32_t. We sometimes read that uint32_t value as a size_t to compare against vector lengths. This Cl converts all usages to be uint32_t and uses pdfium::CollectionSize to get the correct typed vector size. Change-Id: I5f452817ab6049e03477945e4622c6911c89f877 Reviewed-on: https://pdfium-review.googlesource.com/3032 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-14Replace CXFA_{Object,Node}Array with std::vectorTom Sepez
These two ought to happen at the same time as they are intertwined in spots. Remove blatant casts between the two along the way. Change-Id: I9ce5d2faadf1e38aba7cade316560d24a66d8669 Reviewed-on: https://pdfium-review.googlesource.com/2933 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_FLOAT with underlying float type.Dan Sinclair
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-14Replace FX_DOUBLE with underlying double type.Dan Sinclair
Change-Id: Ife4a46157ec1044b24965f7d282858f8261031b1 Reviewed-on: https://pdfium-review.googlesource.com/3030 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_CHAR and FX_WCHAR with underlying types.Dan Sinclair
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-14Merge text breaking helper classes.Dan Sinclair
This Cl merges the CFX_TxtPiece and CFX_RTFPiece classes into CFX_BreakPiece. CFX_TxtLine and CFX_RTFLine into CFX_BreakLine and CFX_TxtChar and CFX_RTFChar into CFX_Char. Change-Id: I95421bdf4cafd5e394db9238dea3603ccb8349c3 Reviewed-on: https://pdfium-review.googlesource.com/2966 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-13Remove openjpeg write support.thestig
Review-Url: https://codereview.chromium.org/2071693002
2017-03-14Roll clang to 49cece5b.Lei Zhang
AKA roll clang 295762:296321. Change-Id: I46be95f4bd50a205b880c62ce4a8e3a7d4508e68 Reviewed-on: https://pdfium-review.googlesource.com/2957 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-13Fix boundary value negation in bmp_read_headerchromium/3041Nicolas Pena
When the value read is equal to -INT_MIN, we cannot negate it since it will be out of bounds, so return error in this case. BUG=chromium:628559 Change-Id: I7e47a71ef0d35cfb2d1fddc0ba644f9aac79ec3f Reviewed-on: https://pdfium-review.googlesource.com/2965 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Add utf-8 flag to win build.Dan Sinclair
Tell VC++ that the pdfium source files are encoded in UTF-8 so that it doesn't interpret them as being encoded in the local code page. Change-Id: Ide74061cad523a873ffa5630781dfc47bf7ae79c Reviewed-on: https://pdfium-review.googlesource.com/2961 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
2017-03-13Make most PDFium code pass Clang plugin's auto raw check.Lei Zhang
Change-Id: I9dc32342e24361389841ecba83081a97fc043377 Reviewed-on: https://pdfium-review.googlesource.com/2959 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-13Fix some nits in fx_codec_faxNicolas Pena
Change-Id: I16acba7b3eda26b4edfbfe0cb356267bd536fee8 Reviewed-on: https://pdfium-review.googlesource.com/2964 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Check run lengths in FaxG4GetRowNicolas Pena
The spec says a1 is to the right of a0, a2 to the right of a1. I think that means that the run lengths have to be positive, but that certainly means that they cannot be negative. BUG=chromium:699340 Change-Id: Ic07a272e63610f7a66c5073179cdb2768f80e2b8 Reviewed-on: https://pdfium-review.googlesource.com/2963 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13LibopenJPEG: Fix some divisions by 0 in pi.cNicolas Pena
The undefined shifts in libopenjpeg are sometimes used as divisors. This CL checks that we are not trying to divide by 0 or mod by 0 in some places in pi.c. BUG=chromium:699491 Change-Id: Iaf629112437068d6479dbbb52b339bec6edefed0 Reviewed-on: https://pdfium-review.googlesource.com/2962 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Replace discrete array with a map.dan sinclair
There is one use of the discrete array, GFGAS_GEFont. This CL replaces that usage with a std::map and removes the fgas_util classes. Change-Id: Ic45812168e9487ebac08abaa131c58080a949d69 Reviewed-on: https://pdfium-review.googlesource.com/2953 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-13Convert TxtBreak line pieces to a vector.dan sinclair
This Cl converts the m_LinePieces array to a vector. This is the last usage of the CFX_BaseArrayTemplate so remove it and supporting code. Change-Id: I3f81e4fd1210f8d0347364a2e4e5bb42cd83cb30 Reviewed-on: https://pdfium-review.googlesource.com/2952 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-13Simplify TxtBreak line handling.dan sinclair
This Cl moves the two lines into an array and uses m_iReady to index the array. Change-Id: Ibecfb35fb72603433a6ed1efa6ec8ae609caebf7 Reviewed-on: https://pdfium-review.googlesource.com/2951 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-13Simplify the CFX_TxtPiece classdan sinclair
This Cl removes unused methods and makes GetString return a CFX_WideString instead of taking an out parameter. Change-Id: I3d2fcbdf51e7619f4fa42e46a0c83fbfa1132a84 Reviewed-on: https://pdfium-review.googlesource.com/2950 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-13Remove some single use interfacesDan Sinclair
Remove interfaces which are only implemented once. Change-Id: I73ceaa7bfd7ef2a630479c7eebed5e32ecb99940 Reviewed-on: https://pdfium-review.googlesource.com/2944 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-13Remove TextBreak rotation codeDan Sinclair
The rotation value is always 0 so we end up doing nothing for the rotation. Change-Id: Ib12a269d4f3c16961b1b934bf9dfc04d1c368e51 Reviewed-on: https://pdfium-review.googlesource.com/2943 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-13Remove unused defines from TextBreak.Dan Sinclair
This Cl removes the unused TXTLAYOUTSTYLE and TXTCHARTYLE defines from fgas_textbreak. This also ripples and removes some of the defined styles from fde_textout as well. Change-Id: Ic647e97694366685bbad367e0a7ba61a00416598 Reviewed-on: https://pdfium-review.googlesource.com/2942 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-13Cleanup TXTLINEALIGNMENT definesDan Sinclair
This Cl replaces the FX_TXTLINEALIGNMENT_ defines with an enum and cleans up various usages. Change-Id: I5ff20f046322e5cd39a7d2abbd8735eac81e8c69 Reviewed-on: https://pdfium-review.googlesource.com/2941 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-13Remove unused TextBreak methodsDan Sinclair
This Cl removes some CFX_TxtBreak methods which aren't called. Change-Id: Ic66a89fa9c99aefb78d8314e1a3ebee089ef83cf Reviewed-on: https://pdfium-review.googlesource.com/2940 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-13Cleanup FX_TXTBREAKDan Sinclair
This Cl removes the FX_TXTBREAK defines and unifies the type with the CFX_RTFBreakType which is renamed to CFX_BreakType. Change-Id: I890ae5e08a65f922d714aaaa9ab0f9f8a882cb3c Reviewed-on: https://pdfium-review.googlesource.com/2939 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-10Bound cbox from tricky faceschromium/3040chromium/3039chromium/3038Nicolas Pena
The cbox values are long. We should make sure they are not too big before putting them into FX_RECT, which holds integers. The bound is chosen to also avoid overflow when multiplying by 1000. BUG=chromium:699961 Change-Id: Ie4443848e0319348110f7215bd1c909ef19dad9f Reviewed-on: https://pdfium-review.googlesource.com/2956 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-10Normalize channels when transforming CMYK to RGBNicolas Pena
PDF spec, section 'DeviceCMYK Color Space' states that: 'Each component is specified by a number in the range 0.0 to 1.0' BUG=chromium:699459 Change-Id: Ie476bbe8740c7b1b33c80be3e3dc4207df5e6e28 Reviewed-on: https://pdfium-review.googlesource.com/2954 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-10Add public method FPDFText_GetTextIndexFromCharIndexNicolas Pena
BUG=pdfium:676 Change-Id: I46de35a86769dc2f7f73ac3552306356ca3289a5 Reviewed-on: https://pdfium-review.googlesource.com/2955 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-09Remove unused Txt break policies.chromium/3037Dan Sinclair
These are unset in the code, remove support. Change-Id: I76ef73929a1f74f59ccdd7bbd054d04dc9c5c6e7 Reviewed-on: https://pdfium-review.googlesource.com/2938 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>