summaryrefslogtreecommitdiff
path: root/xfa/fxfa
AgeCommit message (Collapse)Author
2017-02-14Revert "Convert Origins to points"Dan Sinclair
This reverts commit da83d3a5cc09c4056310b3cf299dbbccd5c70d11. Reason for revert: Reverting chain to see if fixes Chrome roll. Original change's description: > Convert Origins to points > > This CL converts various OriginX, OriginY pairs into CFX_PointF objects. > > Change-Id: I9141f7fc713c710b2014d4fdcdec7dc93501f844 > Reviewed-on: https://pdfium-review.googlesource.com/2575 > Commit-Queue: dsinclair <dsinclair@chromium.org> > Reviewed-by: Nicolás Peña <npm@chromium.org> > TBR=tsepez@chromium.org,dsinclair@chromium.org,npm@chromium.org,pdfium-reviews@googlegroups.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= Change-Id: I949fb4ec712e2587e7d0ef0191c34db198b61dcc Reviewed-on: https://pdfium-review.googlesource.com/2696 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-13Convert Origins to pointsDan Sinclair
This CL converts various OriginX, OriginY pairs into CFX_PointF objects. Change-Id: I9141f7fc713c710b2014d4fdcdec7dc93501f844 Reviewed-on: https://pdfium-review.googlesource.com/2575 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-13Simplify FX_UTF8Encode variants.chromium/3012Tom Sepez
Doing so reveals places where there are needless copies and conversions. Change-Id: I24a868d40aa63836f4167eaf4541964049df7916 Reviewed-on: https://pdfium-review.googlesource.com/2555 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-09Convert Get methods to return instead of using out params.Dan Sinclair
This Cl changes several Get methods to return their values instead of using out parameters. Change-Id: Ie9a930a5c2d0e809f2d7181ca033d801945c1cf9 Reviewed-on: https://pdfium-review.googlesource.com/2556 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-08Rename x,y to width,height for Size typesdan sinclair
This Cl fixes the naming of the size types to match their purpose. This makes the code clearer. Change-Id: I37a41ab0fe01782f4749054f1f8ab29ddf8d2790 Reviewed-on: https://pdfium-review.googlesource.com/2551 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-08Update to use CFX_Rect{F} and CFX_Matrix constructors.Dan Sinclair
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-07Cleanup out params in XFA layout code.Dan Sinclair
This CL converts some of the out parameters in the XFA layout code to pointers instead of references. Change-Id: I6246b91b975e7bc08f8cfb040de9dfdc3c3bedee Reviewed-on: https://pdfium-review.googlesource.com/2531 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-06More CXFA_ItemLayoutProcessor cleanupchromium/3005Dan Sinclair
Continuing cleaning up members and methods of CXFA_ItemLayoutProcessor. Change-Id: Ie74fb83337c85820072b43352b734eafc3a0d5af Reviewed-on: https://pdfium-review.googlesource.com/2513 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-06Cleanup xfa layout codedan sinclair
Split XFA layout code into correct files, move static methods into anonymous namespace blocks. Cleanup formatting where possible. Change-Id: Ia342d7db42f947db02a52aa86bfa69e4fda916fd Reviewed-on: https://pdfium-review.googlesource.com/2512 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-04Remove unused parameterchromium/3004dan sinclair
The pPageView parameter is always set to nullptr when creating XFA widgets. Change-Id: I4259ff7e523dc462242d2e37f0e2a919c5543035 Reviewed-on: https://pdfium-review.googlesource.com/2511 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-02Remove FX_WSTRC usagechromium/3003chromium/3002dan sinclair
Not needed with modern compilers, removed. Change-Id: Ia8977262b5791bd4445f02be8456641d1a7e18f3 Reviewed-on: https://pdfium-review.googlesource.com/2431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-02Clean up CSS code to match styles.chromium/3001dan sinclair
Simplify the code to what we support, remove unnecessary classes. Change-Id: I7af79a4720e0c95c609f163ebb86cf67d643add1 Reviewed-on: https://pdfium-review.googlesource.com/2430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-01-31use std::vector in cfx_graphics.h and xfa_ffwidget.hTom Sepez
Change-Id: I19f2e729b58de42506e8fc2811dd06d406470314 Reviewed-on: https://pdfium-review.googlesource.com/2470 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-01-26Cleanup memory in CFDE_CSSStyleSelectorDan Sinclair
This CL fixes up the bare new calls in CFDE_CSSStyleSelector and replaces them with unique_ptrs. Code massaged to work correclty with new types. Change-Id: I90fce1ed7486da97fe7b5e597e9d423748c069c0 Reviewed-on: https://pdfium-review.googlesource.com/2353 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-25Remove last usage of IFX_Retainable.chromium/2993Tom Sepez
Change-Id: Id2ece818c80e8cce4748b9a237871131a7acd6d1 Reviewed-on: https://pdfium-review.googlesource.com/2354 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-01-24Track CFDE_CSSComputedStyle with retained ptrsDan Sinclair
Remove the bare new and use CFX_RetainPtr to keep track of the computed styles. Change-Id: Icf235623529797176707482c78676814b7a81b9e Reviewed-on: https://pdfium-review.googlesource.com/2292 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-23Remove unused author and and user stylesheetsDan Sinclair
We only load atyles from the CXFA_TextParser which loads a static UserAgent stylesheet. This CL removes the User and Author styles from the system and simplifies the storage of the stylesheets. Change-Id: I7abcf39333655f8dd6bc2cfe685c8cf73b779c7d Reviewed-on: https://pdfium-review.googlesource.com/2293 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-23Cleanup CSS parsingDan Sinclair
This Cl removes unused CSS parsing code. The only caller of CFDE_CSSStyleSheet::LoadeBuffer is from CXFA_TextParser which provides a static string. So, we know there are no Media rules, Import rules, FontFace rules or Page rules in the input style. These rules are also not allowed in inline styles. This CL removes the supporting code. Change-Id: I3a559352b2dd0769c465cbd3da40d1db5f9577b0 Reviewed-on: https://pdfium-review.googlesource.com/2330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-23Replace CXFA_StrokeArray and CXFA_WidgetArray with std::vectortsepez
Review-Url: https://codereview.chromium.org/2648773003
2017-01-23Remove some |void Release() { delete this; }| anti-pattern.tsepez
m_pSyntaxParser was unused. Review-Url: https://codereview.chromium.org/2646203002
2017-01-20Replace CFX_ByteArray with CFX_ArrayTemplate<uint8_t>chromium/2990chromium/2989chromium/2988tsepez
Also replace CFX_Int32Array typedef with CFX_ArrayTemplate<int32_t>. Removing the typedefs makes subsequent conversion to std::vector<> easier on a case-by-case basis. Review-Url: https://codereview.chromium.org/2649563003
2017-01-19Split fde/css files into individual class files.Dan Sinclair
This CL splits the files in xfa/fde/css into class per file and renames any needed files to match the class names. Update some of the classes to use std::stack. Change-Id: I4eca0fb3556d949a15a873bb0f0fd732f47e4fb1 Reviewed-on: https://pdfium-review.googlesource.com/2253 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-01-18use unique_ptr in xfa_checksum.htsepez
Review-Url: https://codereview.chromium.org/2613143002
2017-01-18Split CFDE_CSSPrimitiveValue apartDan Sinclair
This CL splits the CFDE_CSSPrimitiveValue class into individual classes per value type. This moves the numeric itypes out of the FDE_CSSPrimitiveType list and creates a new CFDE_CSSNumberType list. Change-Id: I6f55e9e3509de7ff1e82dcf018a1f1c472565e54 Reviewed-on: https://pdfium-review.googlesource.com/2250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-17Avoid endless loop deleting CFGAS_GEFont.tsepez
It's a ref-counted class, so if we're in the destructor, the ref count has hit zero. We can't make a new ref pointer to itself here, as it will re-invoke the destructor when it goes out of scope. This should have been an obvious anti-pattern in hindsight. The object in question can't be in the m_pFontManager, since the font manager retains a reference, and we wouldn't get to this destructor while that is present. So the cleanup isn't required. Fixing this revealed a free-delete mismatch in cxfa_textlayout.cpp. I also converted to use unique_ptrs in a few places near this issue. Fixing this revealed a UAF in CFGAS_GEFont, memcpy'ing a RetainPtr is not a good idea as it doesn't bump the ref count. Also protect and friend the CFGAS_GEFont destructor, to make sure random deletes don't happen. Also kill off a const cast, and remove unnecessary conversion to retain_ptr when we already have one. TEST=look for absence of -11 in XFA corpus test logs, bots not currently noticing the segv. Argh. Review-Url: https://codereview.chromium.org/2631703003
2017-01-17Rename FDE_CSSRECT and FDE_CSSLENGTHDan Sinclair
This Cl converts the names to FDE_CSSRect and FDE_CSSLength to better match other parts of the code base. Change-Id: I33367ae3d93d912755671486d6d5317cddbc4f62 Reviewed-on: https://pdfium-review.googlesource.com/2179 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-16Remove IFDE_CSS interfaces which are only implemented once.Dan Sinclair
This CL cleans up some interface classes from FDE CSS. Change-Id: I975e5d63f8ae6a0bc7bb849b6f11f0ae43092e4d Reviewed-on: https://pdfium-review.googlesource.com/2177 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-12Remove used items from the CSS code.chromium/2980Dan Sinclair
This Cl cleans up the property and property value definitions which are never used in the FDE CSS parser code. A few other unused methods are also removed. Change-Id: Ib5a316d9c877d87f1d5e0003de4d85d59eab087a Reviewed-on: https://pdfium-review.googlesource.com/2175 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-11Convert FDE CSS enums to enum classes.Dan Sinclair
This CL updates the possible FDE CSS enums to enum classes and fixes up any instances of incorrect values being used. A few other cleanups and changes were needed to complete the conversion. Change-Id: Ibcca5229a9ca8de1f4beb6462535f61705fd4f8c Reviewed-on: https://pdfium-review.googlesource.com/2170 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-11Cleaning up memory allocation in CXFA_FM2JSContext - IVDan Sinclair
This CL removes the use of FX_Alloc and any remaining new'd CFXJSE_Value objects from CXFA_FM2JSContext and replaces them with unique_ptrs and vectors. Change-Id: I30ba697d65ee326d2faa895c3217bdc407419298 Reviewed-on: https://pdfium-review.googlesource.com/2157 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-10Strip out custom allocator codeDan Sinclair
This Cl replaces the custom IFX_MemoryAllocator code with new/delete as needed. Change-Id: Ie786f607c9e0b3035ffd87733bc3e29a4b6426d9 Reviewed-on: https://pdfium-review.googlesource.com/2164 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-10Split xfa_textlayout apart.Dan Sinclair
This CL splits the xfa_texlayout.{cpp|h} files into individual class files. Minor reformatting was done in the new clasess. Change-Id: Id79ffcb8dca3fcf287a2e6dec78fd2b1f990a542 Reviewed-on: https://pdfium-review.googlesource.com/2162 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-10Remove more _LP* typedefs.tsepez
Code is much clearer when we use the actual types rather than this convention. Review-Url: https://codereview.chromium.org/2618993002
2017-01-06Remove CFX_MapPtrToPtr and templates.chromium/2976chromium/2975tsepez
All usage is now replaced with stl equivalents. Move one definition from fx_basic.h to where it's actually needed. Review-Url: https://codereview.chromium.org/2612773007
2017-01-05use unique_ptr in cxfa_layoutprocessor.htsepez
Review-Url: https://codereview.chromium.org/2617483005
2017-01-06Cleaning up memory allocation in CXFA_FM2JSContext - IIIDan Sinclair
This CL updates the unique_ptrs to use MakeUnique instead of new. The types are updated to be auto. Change-Id: I2a82a4ec6659e5c343cc03d4840b3046ecb6934e Reviewed-on: https://pdfium-review.googlesource.com/2156 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-05Cleaning up memory allocation in CXFA_FM2JSContext - IIDan Sinclair
This CL removes the size arrays and variables and uses the vector to get the size directly. Change-Id: I0f7b5f48e53ff1ec379ad34a23807d70b02a538a Reviewed-on: https://pdfium-review.googlesource.com/2155 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-05Cleaning up memory allocation in CXFA_FM2JSContext - Ichromium/2974Dan Sinclair
This CL updates ::ParseResolveResult to accept a std::vector<std::unique_ptr<CFXJSE_Value>>& instead of a CFXJSE_Value**&. This removes a bunch of manual new/delete code used to mantain the values. The size parameter was also removed and is retrieved by calling .size() on the vector now. Change-Id: I60fc6176523ece112d41fdefc767aaefedfae2db Reviewed-on: https://pdfium-review.googlesource.com/2153 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-05Properly ref-count CFGAS_GEFont with CFX_RetainPtr.tsepez
We worry about cyclical references, but no leaks found. Review-Url: https://codereview.chromium.org/2609423003
2017-01-05Remove CFX_MapPtrToPtr from xfa/fxfa.tsepez
Review-Url: https://codereview.chromium.org/2612923002
2017-01-03remove some CFX_ArrayTemplate in xfa_ffdocview.hchromium/2971tsepez
Review-Url: https://codereview.chromium.org/2593163002
2017-01-03Remove the ::GetCapacity methods.Dan Sinclair
The GetCapacity methods return a void* because they return different types of internal class memory based on what the calling parameter was. This is confusing and makes it difficult to tell when then enum values can be removed. This CL removes GetCapacity and adds methods as needed to get the real values. Change-Id: I64c2edc858220624880e27f4ed49c2dae080f462 Reviewed-on: https://pdfium-review.googlesource.com/2137 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-03Create individual exception methods.Dan Sinclair
This CL removes the LoadString method from CPDFXFA_Context and, instead, creates individual exception methods for each of the loaded strings and calls as needed. BUG=pdfium:549 Change-Id: I1d975f01f13f45a885946a9952f24b13387dc3e4 Reviewed-on: https://pdfium-review.googlesource.com/2135 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-01-03Kill last use of CFX_PtrList.tsepez
I'd been waiting on this hoping the code would be refactored out of existence, but it looks to be used. Use tests against x.end() in place of a "null position". This is greatly complicated by the use of "tail position", which now calcluated by std::prev(x.end()) unless the list is empty. Review-Url: https://codereview.chromium.org/2592163002
2017-01-03Cleaning out params in CPDFXFA_ContextDan Sinclair
This CL cleans up some of the out params in CPDFXFA_Context. In the process several of the strings returned by ::LoadString() are inlined in their call sites and the defines removed. BUG=pdfium:549 Change-Id: I41a7ceeba3962299eecd0cb714ddb03d28dbb0ea Reviewed-on: https://pdfium-review.googlesource.com/2134 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2016-12-16Better tests for password protected documents.chromium/2954tsepez
- Add unit tests for sha256 implementation. - Remove void* types from API in favor of correct actual types. Review-Url: https://codereview.chromium.org/2577223002
2016-12-14Return unique_ptr from CXFA_FFApp::CreateDoc.tsepez
Remove one unused CreateDoc variant. Review-Url: https://codereview.chromium.org/2576893002
2016-12-14Update CFWL_ListBox to return instead of using out params.dsinclair
This CL updates the CFWL_ListBox code to work with return values instead of out params. This also extracts the CFWL_ListItem code out of CFWL_ListBox and puts into the correct class. Review-Url: https://codereview.chromium.org/2572783002
2016-12-14Avoid the ptr.reset(new XXX()) anti-patterntsepez
Be suspicious of |new|. This removes some of the easy cases. Review-Url: https://codereview.chromium.org/2571913002
2016-12-13Replace CFX_FloatArray with std::vectortsepez
Review-Url: https://codereview.chromium.org/2567503002