summaryrefslogtreecommitdiff
path: root/xfa/fxfa
AgeCommit message (Collapse)Author
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-08Remove CFX_RTFPieceArray and use std::vectorDan Sinclair
This CL removes the CFX_RTFPieceArray typedef and updates the code to use a std::vector. Change-Id: I885038d432e700830958e37b8c03c5beceff012f Reviewed-on: https://pdfium-review.googlesource.com/2936 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-06Remove CFX_StackTemplate in xfa_utils.h.Tom Sepez
Tree traversal doesn't require a stack as we always have parent pointers in nodes. Break the code into smaller units to help make more comprehensible what is going on. Remove init methods and force callers to pass us root in the constructor. The operations are complicated by the lack of a last child or previous sibling pointer in our nodes. Change-Id: Ia32bb44354352686cb79ccd67fe8aa5cd5ccef58 Reviewed-on: https://pdfium-review.googlesource.com/2913 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-06Tidy xfa_utils_unittest.cppTom Sepez
Testing idempotency of const method kinda silly. Change nodes used in some tests. Add intermediate check in one test Rename one test case. Change-Id: Ib4cbb56665d0e0933561bb240205edeffdd74900 Reviewed-on: https://pdfium-review.googlesource.com/2931 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-03Add unit test for xfa node iteratorschromium/3032chromium/3031Tom Sepez
The code under test is too complicate to be refactored without first establishing tests. Change-Id: Id7dc87ec67c513220e64df9d82afb8bcd6acef21 Reviewed-on: https://pdfium-review.googlesource.com/2914 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-03remove CFX_StackTemplate<CFDE_XMLNode*>chromium/3030Tom Sepez
Change-Id: I1112d18e0d18514227d363b3010eb8f90fb0ffe4 Reviewed-on: https://pdfium-review.googlesource.com/2910 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-03Remove CXFA_NodeStackTom Sepez
Also replace CXFA_NodeSet with underlying type. Change-Id: Iba38ef67bab5d7b23a0bb2b8272a1effa1015c9c Reviewed-on: https://pdfium-review.googlesource.com/2905 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-01Change CreateBreak to return a unique_ptrDan Sinclair
The value is always set into a unique_ptr, so return one and assign. Change-Id: Ieda649c8f86caf1344ca2ce342a141c3ab70aa0f Reviewed-on: https://pdfium-review.googlesource.com/2883 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-01Return values instead of out paramsDan Sinclair
This Cl converts CFX_RTFPiece::GetString and CFX_RTFPiece::GetWidths to return CFX_WideString and std::vector<int32_t> respectively instead of taking pointers out parameters. Change-Id: Ie153caa0336861b3efa9b8ce26f75f0e019526e9 Reviewed-on: https://pdfium-review.googlesource.com/2882 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-01Create virtual codec APIs so chrome/fuzzers can link separatelyTom Sepez
The one step to make an actual concrete class is conditionalized in fpdfview and is unconditional in the fuzzer. Also replace the clumsy C-style callbacks with a delegate interface as long as we are making new interfaces. Change-Id: I733a437483ce5e0c34211cfbbda05105336f55b5 Reviewed-on: https://pdfium-review.googlesource.com/2887 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-28Remove unused methods from RTFBreak and TextBreakDan Sinclair
This Cl removes unused methods from the RTFBreak and TextBreak classes. Change-Id: If1e7e041cfd32b3be1240ae759f73c503b9c4cad Reviewed-on: https://pdfium-review.googlesource.com/2878 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-28Convert the FX_RTFBREAK defines to an enum classDan Sinclair
This Cl converts the type and updates the usage as required. Change-Id: I7c0f13aeabee1117086728333618504d3b65bb06 Reviewed-on: https://pdfium-review.googlesource.com/2876 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-28Convert FX_RTFLINEALIGNMENT to an enum classDan Sinclair
This Cl removes unused items and converts the remaining members to an enum class. Change-Id: I86e95231275ab20f274a5913715c1579a6fbc5dc Reviewed-on: https://pdfium-review.googlesource.com/2875 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-28Remove unused layout stylesDan Sinclair
This Cl removes the unused layout styles from RTF Break and the supporting code. Change-Id: I5f4ef593250be1c9b3ae32f1ae3d9ce6913abdcc Reviewed-on: https://pdfium-review.googlesource.com/2874 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-28Remove unused RTF Break PoliciesDan Sinclair
The break policy was always set to 0 so it would never match any of the polices. Removed and simplified the code. Change-Id: I260631a2210037ae75ca1a3a282a1fe4e7f8ef6f Reviewed-on: https://pdfium-review.googlesource.com/2873 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-28Clean up CXML_Element.chromium/3026Lei Zhang
- Set more members in the ctor - Remove dead code - Use more unique_ptrs Change-Id: Idfe85d07c784a57862f9314bc85f407f817b8f2f Reviewed-on: https://pdfium-review.googlesource.com/2844 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-23Cleanup CFX_Graphics.Dan Sinclair
This Cl removes unused methods, removes unused return values, removes unused hatch data. Change-Id: Id76240170a3bd1c3ef156fbda25a6ac96462cbda Reviewed-on: https://pdfium-review.googlesource.com/2827 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-23Merge CFX_PathGenerator into CFX_Path.Dan Sinclair
The CFX_Path was the only user of the CFX_PathGenerator which in turn just proxied to the CFX_PathData. This CL removes the CFX_PathGenerator and merges the code up into CFX_Path. Change-Id: I9e1a3921c987830f29b2ff5bd4aceacd2082e8f0 Reviewed-on: https://pdfium-review.googlesource.com/2825 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-23Convert point x,y into CFX_PointFdan sinclair
This Cl converts the PointX,PointY pairs into a CFX_PointF. Change-Id: I46897832077c317a5bffb4e568550705decbc40c Reviewed-on: https://pdfium-review.googlesource.com/2821 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-21Convert CFWL messages to use CFX_PointFDan Sinclair
This Cl updates the various CFWL_Message classes to take CFX_PointF instead of x,y values. Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1 Reviewed-on: https://pdfium-review.googlesource.com/2811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-21Convert more TransformPoint calls to TransformDan Sinclair
This Cl converts several uses of TransformPoint to use Transform(CFX_PointF). Change-Id: I9bc3c484e0a4304b904584218bd9e59dec7db727 Reviewed-on: https://pdfium-review.googlesource.com/2791 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-16Change FXTEXT_CHARPOS to use CFX_PointFDan Sinclair
This CL updates the Origin x,y coordinates in FXTEXT_CHARPOS to be an CFX_PointF. Change-Id: I67281db2cb82687e12490145f7c99aee908e5fa8 Reviewed-on: https://pdfium-review.googlesource.com/2718 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
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>