summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-06-01Rename CPDFXFA_Context::GetTimerMgr() to NewTimerMgr()Tom Sepez
Because it returns an unique_ptr to a newly-created object. Also rename m_pTimeMgrAdapter to m_pAdapterTimerMgr, because in English, adjectives come first, and this is a TimerMgr obtained from an Adatper, not an Adapter for a TimerMgr. Also change TimeMgr to TimerMgr since the manager manages timers, not time itself. Follow-on from https://pdfium-review.googlesource.com/c/pdfium/+/33230 No functional change. Change-Id: I08d2b6cd8cc816f38326e87ee46060f091c74fdf Reviewed-on: https://pdfium-review.googlesource.com/33570 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Move variable into loop scopeRyan Harrison
The variable is not used outside of the loop. This was noted by tsepez@ after landing the initial CL to clean up this code. Change-Id: Id7d6713db4fa6bdfe867c151290cb28329ae7042 Reviewed-on: https://pdfium-review.googlesource.com/33590 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Clean up some issues found in CXFA_TextLayoutRyan Harrison
Initialize pCharPos to non-NULL, so that later code can depend on it != nullptr, avoiding a potential call to memset on nullptr. Additionally get rid of a free then alloc pattern and just use realloc. Later on remove updates to fBaseLineTemp that have not effect, since it isn't read after them. Issues found with Clang Static Analyzer. Change-Id: Iff175e20cd8860d263a56a24c8781e214c61d02c Reviewed-on: https://pdfium-review.googlesource.com/33533 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Creating XFA context shouldn't be a side-effect of FPDF_* conversion.Tom Sepez
Create it explicitly as needed. Change-Id: I42d5a6f33bc32e7fb768bed96aa6d239d133467e Reviewed-on: https://pdfium-review.googlesource.com/33350 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-01Return unique_ptr from CPDFXFA_Context::GetTimerMgr()Tom Sepez
Proves ownership by avoiding a std::unique_ptr::reset() call. Change-Id: Ia6e11920d84dda49699736ef3189e58d240d409e Reviewed-on: https://pdfium-review.googlesource.com/33230 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-01Roll third_party/freetype/src/ d45d4b97e..125b84800 (4 commits)Nicolas Pena
https://chromium.googlesource.com/chromium/src/third_party/freetype2.git/+log/d45d4b97e6a0..125b84800a32 $ git log d45d4b97e..125b84800 --date=short --no-merges --format='%ad %ae %s' 2018-05-31 wl * src/raster/ftraster.c (black_TWorker_): Remove `gTarget' field. 2018-05-30 apodtele Shorten LCD filtering docs. 2018-05-31 wl [sfnt] Get colors from `CPAL' table in right order (#54015). 2018-05-30 wl ftcolor.h: Improve API design, fix typos (#54011, #54014). Created with: roll-dep third_party/freetype/src R=dsinclair@chromium.org,npm@chromium.org,thestig@chromium.org Bug: pdfium:1100 Change-Id: I5fbf9e4ea21e6443293d79e416b55cf23c23ce9d Reviewed-on: https://pdfium-review.googlesource.com/33534 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-06-01Remove ununused startAngle and sweepAngle variablesRyan Harrison
Neither of these local values ever get read after calculating them. Issue found with Clang Static Analyzer. Change-Id: Iffa578f1d5e303c65a881bcd372a9144a11edd3b Reviewed-on: https://pdfium-review.googlesource.com/33532 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Remove initialization of wchar_t chRyan Harrison
This value is overwritten at the beginning of the following while loop, so the initialized value is never used and the method called is const, so should be side effect free. Issue found with Clang Static Analyzer. Change-Id: I77f27daccd3aa1edd434cfa3e0dd7bc095db06d0 Reviewed-on: https://pdfium-review.googlesource.com/33550 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Remove unused variable pDst from CFWL_Edit::OnValidateRyan Harrison
GetOuter is const, so the assignment has no side effects, and the value is never user in the method body. Issue found with Clang Static Analyzer. Change-Id: I0116726a3df38dbf611db75ed03a0a17b4449d09 Reviewed-on: https://pdfium-review.googlesource.com/33531 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Remove unneeded call to GetNextSiblingWidgetRyan Harrison
The value is stored in a local scope variable at the end of a loop, so is never used. The method is const, so is sideffect free, thus this line has no overall effect. Issue found with Clang Static Analyzer. Change-Id: Ib20c5c121c8464433c6ad6d8e1439b929033d6d6 Reviewed-on: https://pdfium-review.googlesource.com/33530 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Fix XFA guardsRyan Harrison
These guards are using #if, when they should be using #ifdef. Caught using Clang's static analyzer. Change-Id: I86e99c5e4142cf84fff5f2365ad534f09ae40511 Reviewed-on: https://pdfium-review.googlesource.com/33510 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Fix V8 guardsRyan Harrison
These guards are using #if, when they should be using #ifdef. Caught using Clang's static analyzer. Change-Id: I9bb7a4c2b817e752c04b21a8321595f9676d6381 Reviewed-on: https://pdfium-review.googlesource.com/33511 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-31Make CPDF_Document own its Extension.Tom Sepez
Inverting the ownership from the current situation makes cleanup much more intuitive. Change-Id: Iad9a7ca70c0746170ba753297732e3e34f96c5ba Reviewed-on: https://pdfium-review.googlesource.com/33190 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
2018-05-31Update fxjs READMETom Sepez
TBR=dsinclair@chromium.org Change-Id: I6f2a4a4b39c38a1bcfcf817a5c2aa51414291ad9 Reviewed-on: https://pdfium-review.googlesource.com/33451 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-31Make FXJSE variable context compatible with FXJS.Tom Sepez
Allows FXJS to be entered directly from V8 when the variable context gets a reference to an FXJS object. Bug: pdfium:1066 Change-Id: I48e39ed9104cc6df31c19d94fa7e0f8c7760932f Reviewed-on: https://pdfium-review.googlesource.com/33450 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-31Make XFA pixel tests more stablechromium/3447Ryan Harrison
When generating PDFs using the fixup script and a .in, specify them to to use Ahem.ttf as the text font. Ahem is a font designed to reduce flakiness in pixel tests due to font rendering differences between platforms. Specifically the glyphs in the font are standard size black boxes, so though the specific text content cannot be easily compared, things like layout and high level changes to the content can still be tested. Testing things like specific text changes should be done via an embedder test, where the strings in the elements can be extracted and inspected. The font itself is is CID type 2 font, which is relatively complex to correctly embed in a PDF due to subsetting and other features. Instead of embedding it in the generated PDFs, which was originally attempted, it is being supplied to pdfium_test via the --font-dir flag. This flag overrides where the binary looks for system fonts. This works correctly on Mac and Linux, but not on Windows, which is why that platform remains suppressed. BUG=pdfium:1008,pdfium:1020 Change-Id: I00811536de98f736fc599d96b397194ccf8db0cd Reviewed-on: https://pdfium-review.googlesource.com/27790 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-31Add missing newlines in pdfium_test help text.Tom Sepez
Change-Id: I05e663b85dcfc6e03a4d77fa7f5071143d7c86b2 Reviewed-on: https://pdfium-review.googlesource.com/33432 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-31Clean up some nits in CPDF_Type3GlyphNicolas Pena
Change-Id: Ia466bb0119d914794b0d7ed9385547a7be245858 Reviewed-on: https://pdfium-review.googlesource.com/33312 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-31Handle image mask continuous loading correctlyWei Li
When image mask doesn't need multi-steps to load, ContinueLoadMaskDIB() will return LoadState::kFail as result. For this case, the loading should continue as usual instead of aborting. BUG=pdfium:1087 Change-Id: I5c43a67e43469ac7febca4c0cf1faa96ee105206 Reviewed-on: https://pdfium-review.googlesource.com/33310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Wei Li <weili@chromium.org>
2018-05-31Remove uselesss code.Artem Strygin
Change-Id: Id58d10dfb2bc51d3bd8b77fd71e7728823a542cf Reviewed-on: https://pdfium-review.googlesource.com/33410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-05-31Make pagview decisions at runtime for non-xfa pages.Tom Sepez
Change-Id: I4c51bed2d285060f28311a0c5e1be9a7e19d408d Reviewed-on: https://pdfium-review.googlesource.com/33153 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-31[xfa] Remove unused methods from CFXJSE_ScopeUtil_IsolateHandleContextDan Sinclair
Methods are not called, removed. Bug: pdfium:1097 Change-Id: I0c7bc8ded070002dd5eb980a4705eabb829fb6ec Reviewed-on: https://pdfium-review.googlesource.com/33390 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-31Move codepage/charset methods into related places.Artem Strygin
Change-Id: I71417cc5b1bd00f77d42740198cc17487ebd686e Reviewed-on: https://pdfium-review.googlesource.com/33330 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-05-31Fix font regression in AdjustMMParamsNicolas Pena
Commit 2334660 changed the |dest_width| in CFX_Font::AdjustMMParams to unsigned, but this means that dest_width - min_width becomes unsigned, which is wrong because the subtraction could be negative. This CL fixes this bug. Bug: chromium:845697 Change-Id: I88fb2f3ee3837d80ff5fa70a08309d9e0fec50e0 Reviewed-on: https://pdfium-review.googlesource.com/33150 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-31Add alphabetical order per file check in api_check.pyNicolas Pena
Change-Id: Iee691870bd890da8e5c8ce9f9f74d15bc213d4a8 Reviewed-on: https://pdfium-review.googlesource.com/32871 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-30Fix roll-dep path in roll-freetype.shNicolas Pena
This CL removes the 'pdfium' part of the path, because it's not working for me anymore with that. Change-Id: I84008905e368a4bdccc5e53aff2b90f4ae1938d7 Reviewed-on: https://pdfium-review.googlesource.com/33311 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-30Remove unused CFX_MemoryStream::{Attach,Detach}Buffer() methodsTom Sepez
Also, EstimateSize() is similarly unused. Change-Id: Idbbb5a4a1105448731d3541365c30ba37ff7eb29 Reviewed-on: https://pdfium-review.googlesource.com/33314 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-30Migrate coverage_report.py to use upstream Chromium scriptsRyan Harrison
This adds tools/code_coverage from Chromium to DEPS and converts our existing coverage_report.py to use it instead of gcov & lcov. This generates a different format of HTML report, but the content appears to be the same. Some of the coverage numbers changed a bit, due to differences in how llvm-cov and gcov calculate executable lines, but drilling down into the reports I think llvm-cov is more accurate overall and there are no major discrepancies. Large portions of the existing script are left as is and just the report generation has been changed. I plan in follow up CLs to remove the duplication of functionality in the PDFium scripts and modularlize the upstream code better. BUG=pdfium:1069 Change-Id: I009bfb8aac8f1a878e01ff70923e19bbb4774a9c Reviewed-on: https://pdfium-review.googlesource.com/32894 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-30Roll third_party/freetype/src/ 9e345c911..d45d4b97e (27 commits)Nicolas Pena
https://chromium.googlesource.com/chromium/src/third_party/freetype2.git/+log/9e345c911714..d45d4b97e6a0 $ git log 9e345c911..d45d4b97e --date=short --no-merges --format='%ad %ae %s' 2018-05-30 prince.cherusker Beautify a3cfed5e87232c933bdc64f43e8ebebcfd18b41b. 2018-05-30 prince.cherusker Fix pointer underflow. 2018-05-30 wl Various minor color fixes. 2018-05-25 ramakrishnan.nikhil [docmaker] Fix missing `Defined in (...)' under Windows/Cygwin. 2018-05-24 apodtele [smooth] Formalize Harmony LCD rendering. 2018-05-22 wl Oops! 2018-05-22 wl [truetype] Reject elements of composites with invalid glyph indices. 2018-05-22 wl * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Trace # of points. 2018-05-20 wl * include/freetype/ftcolor.h: New file. 2018-05-20 apodtele Autoformatting. 2018-05-18 apodtele * include/freetype/internal/ftcalc.h (FT_MSB): Verified `_MSC_VER'. 2018-05-18 wl * include/freetype/internal/ftcalc.h (FT_MSB): Use `_MSC_VER' value. 2018-05-18 wl Minor comment fixes. 2018-05-17 wl s/inline/__inline/ for MSVC. 2018-05-16 wl Add function `FT_Get_GlyphLayers' to access `COLR' table data. 2018-05-15 apodtele [base] Fix mono bitmap presetting (#53896). 2018-05-15 wl [psaux] Fix compiler warning (#53915). 2018-05-15 wl [sfnt] Fix memory leak in handling `COLR' data. 2018-05-15 wl Grammar fixes. 2018-05-15 wl [sfnt] If `COLR' is present, don't assume that all glyphs use it. 2018-05-14 wl * src/base/ftobjs.c (FT_Load_Glyph): Fix signature of `pixel_modes'. 2018-05-14 wl Provide dummy functions if `TT_CONFIG_OPTION_SFNT_NAMES' is not set. 2018-05-13 wl Typo. 2018-05-13 wl * src/base/ftobjs.c (FT_Load_Glyph): Improve tracing. 2018-05-13 shaozhang [sfnt] Preliminary support of coloured layer outlines. 2018-05-12 arkady.shapkin Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636). 2018-05-11 parthwazurkar [pcf]Documentation Typo. Created with: roll-dep third_party/freetype/src R=dsinclair@chromium.org,npm@chromium.org,thestig@chromium.org Bug: pdfium:1099 Change-Id: Id1c2ed07a8c771be282e2aa3b015a6840b443735 Reviewed-on: https://pdfium-review.googlesource.com/33290 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-30Remove dead code in various write function.Lei Zhang
BUG=pdfium:1093 Change-Id: I05f32018841dfa8b1c4512fb6350fc2a2fe4c5e4 Reviewed-on: https://pdfium-review.googlesource.com/33250 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-30Add pixel tests for PDFs that use generation numbers.Lei Zhang
This checks in 2 identical looking PDFs. They both started out as hello_world.pdf. They were then hand edited in different ways that results in the same final rendering output. Change-Id: Ib3b634a5119c0f2e4beb36844c3f2b8d58ab8a21 Reviewed-on: https://pdfium-review.googlesource.com/33232 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-30Exclude certain colorspace types for calculating transparency backdrop color.Lei Zhang
Per discussion for the "CS" entry in the PDF 1.7 spec table 7.13, several types of colorspaces do not meet the requirements of this particular colorspace entry. In terms of implementation, this avoids hitting a NOTREACHED() in CPDF_PatternCS::GetRGB(). BUG=chromium:847346 Change-Id: If994a91cdcd84b8977196256ee6926e20c4b74aa Reviewed-on: https://pdfium-review.googlesource.com/33210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-30Remove manual references to exe_and_shlib_depsTom Anderson
After [1], a manual dependency on exe_and_shlib_deps is no longer necessary since it's automatically added. This CL removes all remaining manual references to exe_and_shlib_deps. [1] https://chromium.googlesource.com/chromium/src.git/+/d7ed1f0a9c28c932fddc834ca5de44f28266c7f5 BUG=chromium:845700 R=thestig Change-Id: I5708e7c662b24493d1216f9a802dfce3de5dbea6 Reviewed-on: https://pdfium-review.googlesource.com/33151 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-30Make common page base class for XFA and non-XFA.Tom Sepez
Now that both are ref-counted, we can replace ifdef's with some polymorphism. Bug: pdfium:760 Change-Id: Ie22ea259c9af56fa569f0af268b8e7065789a3f2 Reviewed-on: https://pdfium-review.googlesource.com/32892 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-30[xfa] Dump JS errors to console in debug modechromium/3446Dan Sinclair
This CL writes any JS exceptions to the console in XFA if running in Debug mode. This makes it possible to see when an error happens in JS execution. Bug: pdfium:1097 Change-Id: Ida14050328c5e6e85ab2704bb5dddfec370dddf1 Reviewed-on: https://pdfium-review.googlesource.com/33154 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-30Make CPDF_Document cache CPDF_PagesTom Sepez
We cache pages not by page number, which can bounce around as pages are inserted or removed, but by page dictionary's object number. Since the page may be created under one function and used under another, we can't take the shortcut of not instantiating a render cache nor not parsing the page. Change-Id: I9a325cda8b3141153544ac53e78a51a44e6b411a Reviewed-on: https://pdfium-review.googlesource.com/32830 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-30Implement handling --font-dir on MacRyan Harrison
Currently the value passed in via the flag is ignored on Mac. This implements the needed logic to use the given path instead of the standard system font directories. BUG=pdfium:1094 Change-Id: I2a0599ce8c784add75d36089dee5e4b5476c3d3d Reviewed-on: https://pdfium-review.googlesource.com/33090 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-30Add FPDFPath_GetDrawMode() APIMiklos Vajna
It was already possible to set the draw mode of a path object, this is the other direction. Change-Id: Id0ee98dd8dfe433edd0e4715fc009ad4d1625981 Reviewed-on: https://pdfium-review.googlesource.com/33010 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-30Roll DEPS for build and buildtools.Tom Anderson
https://chromium.googlesource.com/chromium/src/build/+log/037f38ae..10a93c2c https://chromium.googlesource.com/chromium/buildtools/+log/ab7b6a7b..893eb86b https://chromium.googlesource.com/android_ndk/+log/e951c372..5cd86312 https://chromium.googlesource.com/chromium/src/tools/clang/+log/abe5e4f9..c893c7ee https://chromium.googlesource.com/external/github.com/catapult-project/catapult/+log/4f03e51f..8fbdf9f1 BUG=chromium:845700 R=thestig Change-Id: I1496686af4336917f363297fb582b7f0483d3591 Reviewed-on: https://pdfium-review.googlesource.com/33231 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-29Pass a CFX_Matrix by reference in font code.chromium/3445Lei Zhang
The callers always pass in a valid CFX_Matrix, so eliminate the possibility of a nullptr. Change-Id: Id7d8b731ed60d5f66517b50c56efeca343e897c4 Reviewed-on: https://pdfium-review.googlesource.com/33152 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-29[xfa] Propagate the xfa change data for text to JS and back.Dan Sinclair
This CL adds the necessary plumbing to propagate the change information for a text widget from FWL out to JS and handle the returned value as necessary. Bug: pdfium:1066 Change-Id: I78fd81761b90294f1836e9f09dba12ed238963cc Reviewed-on: https://pdfium-review.googlesource.com/33070 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-29Get rid of FXARGB_MAKE macro.Lei Zhang
ArgbEncode() does the same thing. Change-Id: Ibb05ed4aae720c0a5ba66771699c0d7e11230921 Reviewed-on: https://pdfium-review.googlesource.com/32230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-28Revert 'Remove almost all usages of CFX_FixedBufGrow with std::vector'chromium/3444Nicolas Pena
This is a manual revert of the CL at: https://pdfium-review.googlesource.com/c/pdfium/+/32159 The only file manually changed was cpdf_renderstatus.cpp Reason for revert: the bug below shows that sometimes the vector size used is larger than the parameter given to CFX_FixedBufGrow. Thus, we will revert, then add vectors using std::max unless it's clear from the code that the code will never access indices outside. Bug: chromium:847247 Change-Id: Iee54af023c8564824418a7d34a6385b0bc418ff0 Reviewed-on: https://pdfium-review.googlesource.com/33050 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-28Add const/non-const versions of remaining CPDF_Dictionary methods.Lei Zhang
GetObjectFor() and GetDirectObjectFor(). Change-Id: I588cd994dfccf0ffd4c8f91362a4806dc109251e Reviewed-on: https://pdfium-review.googlesource.com/32991 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-25Replace some ifdef PDF_ENABLE_XFA, part 3.chromium/3443chromium/3442Tom Sepez
Always include a rect parameter. It is unused in the non-XFA case, but there is no need for ifdefs. Change-Id: If6229461d6b20ee8ea557a012f2dbf8ef9f6287e Reviewed-on: https://pdfium-review.googlesource.com/32835 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-25Replace some #ifdefs PDF_ENABLE_XFA, part 2.Tom Sepez
Tidy some code encountered along the way in cpdfsdk_helpers.cpp Remove one ifdef from xfa-only file. Restore some option flag processing (probably wrong to remove). Flip some #ifndef to #ifdef (#ifndef PDF_ENABLE_XFA is an anti-pattern and should be treated with suspicion since XFA should always be "additive"). Change-Id: I564a28401e20e6269c85ea610da8c96f8c8dd737 Reviewed-on: https://pdfium-review.googlesource.com/32834 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-25Replace some #ifdef PDF_ENABLE_XFA with runtime checks.Tom Sepez
Abstract GetUserPermissions() differences via new virtual method. Abstract GetPageCount() differences via existing virtual method. Remove unused ReadHeader() form for non-xfa. Remove unused FindSubstFontByUnicode() for xfa. Remove unused FXFONT_EXACTMATCH Change-Id: I0a3de01a9841db86fcbc96991d3fa2682393b9ad Reviewed-on: https://pdfium-review.googlesource.com/32831 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-25Make CPDF_Page retainable.Tom Sepez
Small step to reducing the differences between XFA and non-XFA. We still use the RetainPtr pretty much as if it were an unique_ptr, in that we're not yet caching pages and handing out multiple pointers to the same page in the non-XFA case. The one change is in page view cleanup, where we no longer need a boolean and can take (sufficient) page ownership with a RetainPtr. Tidy up some document.h -> page.h -> document.h circular inclusion while we're at it. NOTE: Wait for imminent branch to pass before landing. We'll want this to bake a while. Change-Id: I64a2f12ac3424ece1063d40583995b834117cf34 Reviewed-on: https://pdfium-review.googlesource.com/32790 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-25Add proper const/non-const versions of CPDF_Dictionary::GetDictFor().Lei Zhang
BUG=pdfium:234 Change-Id: I6fde00c976ad4bb9cab632f465cf292f5b1da3d2 Reviewed-on: https://pdfium-review.googlesource.com/32914 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-25Add proper const/non-const versions of CPDF_Dictionary::GetArrayFor().Lei Zhang
BUG=pdfium:234 Change-Id: I5c900aa0547afef0c60de35422b4ee489daa6cfb Reviewed-on: https://pdfium-review.googlesource.com/32913 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>