summaryrefslogtreecommitdiff
path: root/xfa/fde
AgeCommit message (Collapse)Author
2017-03-28Refcount all CFX_DIBSources (and subclasses) all the time.Tom Sepez
There are currently several ownership models for these objects, including ad-hoc logic for sharing and deletion, and the now-redundant CFX_DIBitmapRef externally-counted handle to the DIBs. Replace them all with the internal refcount scheme. Change-Id: I2db399dfc19219eda384f94cc989353b78ce2872 Reviewed-on: https://pdfium-review.googlesource.com/3166 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-27kill another CFX_ArrayTemplate in cfde_txtedtengine.cppTom Sepez
Change-Id: I87521aa9bdc796895f1db144fda22b1cb44d2089 Reviewed-on: https://pdfium-review.googlesource.com/3215 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-26Use PartitionAlloc for JavaScript ArrayBuffers and strings.Chris Palmer
BUG=pdfium:681 Change-Id: I5073d80d9bd623b73e578d5ba2226c39c371bab0 Reviewed-on: https://pdfium-review.googlesource.com/3097 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-23Cleanup some xfa/fxfa code.Dan Sinclair
This CL moves the .h files to have names corresponding to the contained classes. The .cpp files are moved alongside the .h files. Any extra classes in the .h files have been split into their own files. Change-Id: I14b4efc02417f0df946500e87b6c502e77020db8 Reviewed-on: https://pdfium-review.googlesource.com/3160 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-22Use std::vector in cfde_txtedtenginechromium/3049Tom Sepez
Change-Id: I651782e6eb6b14580a89d9d613404e7984a76cf0 Reviewed-on: https://pdfium-review.googlesource.com/3141 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-03-22Use unique_ptr for CFDE_XMLDoc::m_pRootTom Sepez
Remove some less helpful helper methods. Change-Id: Id027e31b6584156263c4aa0c2888e91fa44e4b0b Reviewed-on: https://pdfium-review.googlesource.com/3150 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-22Use unique_ptr in cfx_saxreader.hTom Sepez
Change-Id: Ia024aff32e7e6fb2d5f6454b9856518a76365de2 Reviewed-on: https://pdfium-review.googlesource.com/3142 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-21Use std::vector for m_HotKeysTom Sepez
Change-Id: I637fe236ae351bf6fcf8aa2913b94f55d997c612 Reviewed-on: https://pdfium-review.googlesource.com/3132 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-03-21Combine more RTF and TXT Break codeDan Sinclair
This Cl conbines several more methods from RTFBreak and TXTBreak into the common Break baseclass. Change-Id: Ibe2236eb4fd30faab239e7c9c8b578164014eb39 Reviewed-on: https://pdfium-review.googlesource.com/3108 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-17Add pdfium::clamp() as a placeholder for std::clamp().chromium/3046Lei Zhang
Ue it to fix a typo as well. BUG=pdfium:634 Change-Id: I2d686242ffb841aedc2fae6a3cf7a00bea667404 Reviewed-on: https://pdfium-review.googlesource.com/3113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
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-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-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-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-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-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_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-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-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-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-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-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>
2017-03-03Remove CFX_StackTemplate<FDE_CANVASITEM>Tom Sepez
Change-Id: I2dbea7665b5fc2ca239ad2f75c91d4a1e0d522c7 Reviewed-on: https://pdfium-review.googlesource.com/2911 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-03Remove CFX_StackTemplate from fde_xml_imp.hTom Sepez
Change-Id: I61552fba2387533699e917918318b002a14bba6b Reviewed-on: https://pdfium-review.googlesource.com/2912 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-02Use std::deque for CFX_MassArrayTemplate<FDE_TEXTEDITPIECE>Tom Sepez
Change-Id: I1080eefb4e47d7bc86fb3384fd7479a1fd49b203 Reviewed-on: https://pdfium-review.googlesource.com/2898 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-02Use std::deque for CFX_MassArrayTemplate<FDE_TTOPIECE>Tom Sepez
Change-Id: Ib6ad46c0d79f51579a99869c5ff87cc9baf75c6e Reviewed-on: https://pdfium-review.googlesource.com/2897 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-28Avoid crash above CFWL_ListItem::GetText()Tom Sepez
The issue at hand is caused by a raw pointer rather than a retained pointer in InheritedData::m_pFontFamily. But the larger issue is that it's bad to Get() raw pointers from these, especially when its so cheap to pass them by const reference. One reason to Get() a raw pointer is to aid in down-casts, so add a helper to CFX_RetainPtr to give us downcasted retained pointers. BUG=pdfium:665 Change-Id: Ic8624af09664ff603de2e1fda8dbde0cf889f80d Reviewed-on: https://pdfium-review.googlesource.com/2871 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: 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-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-15Cleanup CFX_PathData.Dan Sinclair
This CL replaces the array of path points with a vector. Cleaning up the usage as required. Change-Id: Ifa386a2c847005fef68af748ebe99c4e08961238 Reviewed-on: https://pdfium-review.googlesource.com/2710 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@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-09Remove CopyToLocal from CFDE_CSSDeclarationDan Sinclair
This CL removes the CopyToLocal method and creates CFX_WideString's directly. This fixes several memory leaks as the CopyToLocal strings were not cleaned up correctly. Change-Id: Ie5ba4cdc4d713cd0b8e3fb85e02f27dc09f38af1 Reviewed-on: https://pdfium-review.googlesource.com/2553 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: 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-08Add CFDE_CSSValueListParser testsDan Sinclair
This Cl adds some unit tests for the CFDE_CSSValueListParser prior to refactoring. Change-Id: I2b32775ea1e70b721f5902cd3d88d68a01166d5e Reviewed-on: https://pdfium-review.googlesource.com/2535 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@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-07Use enum class for PathPoint types.Nicolas Pena
This hopefully makes it less confusing what the description of a point is. Currently we have defines for the types, which is confusing because a point can only be one of the three. And it is mixed up with whether the point is closing a figure or not. Change-Id: Icd71355d69c77b3d52ca78e03bc379081ff87753 Reviewed-on: https://pdfium-review.googlesource.com/2552 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-07Split CFX_STemplate from CFX_PSTemplateTom Sepez
This will allow the compiler to distinguish between rectangle initialization from a point and a size vs. two points. Add corresponding ctors, and fix style noise induced in XFA, now that rects have become a complex type. Change-Id: Iaa5887db63dafd41ac95f5c623989ca1d6443fd6 Reviewed-on: https://pdfium-review.googlesource.com/2533 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@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-26Add CSS parser testsDan Sinclair
This CL adds more unit tests to the css parser and removes some unused code. Change-Id: If233040e19c7a79a907a3215877e042ac388d61b Reviewed-on: https://pdfium-review.googlesource.com/2412 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-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-24Cleanup memory in CFDE_CSSRuleCollectionDan Sinclair
This Cl cleans up the memory for the CFDE_CSSRuleCollection::Data parameter. Change-Id: I449ffdeebdc6463bf68b991fffecdc6cf0b25362 Reviewed-on: https://pdfium-review.googlesource.com/2296 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>