summaryrefslogtreecommitdiff
path: root/xfa
AgeCommit message (Collapse)Author
2017-09-15Simplify a couple of CXFA_Node methods.Lei Zhang
Change-Id: I89c81e18273e929910f083399ed169017a6171f5 Reviewed-on: https://pdfium-review.googlesource.com/14091 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-15Fix nullptr dereference in XFA_Node::SetScriptContent().Lei Zhang
BUG=chromium:763353 Change-Id: I6ee93f769509326d9af5bbfa1450c90747d6a065 Reviewed-on: https://pdfium-review.googlesource.com/14090 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-15Make static const char* arrays more const.Lei Zhang
Change-Id: I87b5e6cefe973b82b4868e56fc5285c95c53a12b Reviewed-on: https://pdfium-review.googlesource.com/12550 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-14Roll clang to 4db5854chromium/3216Tom Sepez
AKA roll clang 310694:312679 Fix virtual dtor warning in xfa/fde/cfde_texteditengine.h Bug: pdfium:896 Change-Id: Ib5fb9433b2c138ca46ccb281b8c0a852daeb623e Reviewed-on: https://pdfium-review.googlesource.com/13850 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-13Remove includes of xfa/fwl/theme/cfwl_widgettp.h that are unused.Henrique Nakashima
Change-Id: I51fb7b9df8bdb557e9dca6d1be91736fe124e16a Reviewed-on: https://pdfium-review.googlesource.com/13630 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-09-13Add readme files to some directories.chromium/3215Henrique Nakashima
Change-Id: I2a750c8e46b68dc4870e2dadd2ed3429008e1562 Reviewed-on: https://pdfium-review.googlesource.com/13551 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-08Remove CFWL_SpinButton, which is unused.chromium/3211Henrique Nakashima
Change-Id: I0be113b5515a95829566938c84e2f74c7c1c75a3 Reviewed-on: https://pdfium-review.googlesource.com/13552 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-09-07Roll DEPS for build to a049c43.Lei Zhang
This enables MSVC by default on Windows again, so fix code that fail to build with MSVC too. Change-Id: I03fb4e3697ad777a4dca88af462b35526d6c1d4d Reviewed-on: https://pdfium-review.googlesource.com/13392 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-06Merge CFX_WordBreak into CFDE_TextEditEngine::Iterator.Dan Sinclair
This CL moves the CFX_WordBreak::FindNextBreakPos into the text edit engine iterator. The word break data was moved to cfde_wordbreak_data. Change-Id: Ie022f5f761479f97b9d4bc7789f890cb2ef99106 Reviewed-on: https://pdfium-review.googlesource.com/13250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Implement word selection in CFDE_TextEditEngineDan Sinclair
This CL implements the needed logic in CFDE_TextEditEngine to handle word selection. Change-Id: I6b388c23655037fec107d68ec07d33638b959374 Reviewed-on: https://pdfium-review.googlesource.com/13211 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Convert FX_STRSIZE int->size_tRyan Harrison
Change the underlying type for FX_STRSIZE to size_t from int. This will make the value unsigned and thus all values in the range of the type will be valid. This allows for the final remove of negative length strings, but also introduces a some casting and functional errors, since many parts of the code base assume that FX_STRSIZE is int or another signed type. This also CL fixes these errors. BUG=pdfium:828 Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b Reviewed-on: https://pdfium-review.googlesource.com/11830 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-06GUID cleanupDan Sinclair
This CL removes fx_guid and inlines into CXFA_FM2JSContext as needed. Change-Id: I08a1f03fd4be46730eee24ab73b8b5c0daf9cd7d Reviewed-on: https://pdfium-review.googlesource.com/13094 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-05Remove isDevice parameter from barcode Render().Henrique Nakashima
isDevice is currently false in tests and fuzzers and true in real usage. This CL changes it all to true. Change-Id: Idea14795d7f0bb70031e04e5c58e248de72fd39e Reviewed-on: https://pdfium-review.googlesource.com/13130 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-05Split fx_guid from fx_extensionDan Sinclair
This CL splits the GUID code out of fx_extension into an fx_guid.h file. Change-Id: I915538ff98601efb07595264eff6435729193177 Reviewed-on: https://pdfium-review.googlesource.com/13090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Split fx_ucd.h into fx_unicode.h and fx_ucddata.h.Tom Sepez
File naming now matches. Fix one usage not going through the accessor function. Change-Id: I5cc4986238764964f2a71807a94bd2facf517263 Reviewed-on: https://pdfium-review.googlesource.com/12930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-01Cleanup usages of Mid(foo, 1), Right(1), and Left(1)chromium/3203Ryan Harrison
Mid(foo, 1) is equivalent to [foo], if all you want is the character. Similarly Left(1) is [0]. It is faster also, since it does not need to create intermediate strings. Right(1) is a touch more tricky, since it requires something like GetLength() ? [GetLength() - 1] : 0;. A new method, Last() has been added to perform this character extraction. Multiple call sites have been updated to use more efficient/simpler syntax. There are a number of call sites that use on these patterns, but based on the surrounding context we actually need/want a string, so they have not been modified. Change-Id: I485a7f9c7b34c9bdacecada610158f996816afdd Reviewed-on: https://pdfium-review.googlesource.com/12890 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-01Fix integer overflow in Buffer_itoa when passing INT_MIN.Henrique Nakashima
Bug: chromium:760034 Change-Id: Id0862749b1454e065de4de7d746a27e78ac58e30 Reviewed-on: https://pdfium-review.googlesource.com/12730 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Cleanup fx_basic_* filesDan Sinclair
Remove dead code, move code to namespaces where possible, cleanup some single use items. Change-Id: Ia734477ceb2105a1ed272463bd8220f1205a7ce9 Reviewed-on: https://pdfium-review.googlesource.com/12732 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31More BIDI code shufflingchromium/3206chromium/3205Dan Sinclair
Change-Id: I6df7e7d1283541ea2e6b9bcf3de172f6a886054a Reviewed-on: https://pdfium-review.googlesource.com/12731 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move bidi code to fx_bidiDan Sinclair
This CL moves the BIDI code from fx_arabic to fx_bidi and conditionally compiles based on XFA. Change-Id: Iaba60486f03e48f0816d60e365a58a8622bc8254 Reviewed-on: https://pdfium-review.googlesource.com/12713 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Clean up of typing in lexer codeRyan Harrison
BUG=pdfium:813 Change-Id: I4c638857bf114327dbc0344cc6d231b897f0d001 Reviewed-on: https://pdfium-review.googlesource.com/11971 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Remove fx_basic.hDan Sinclair
This CL removes the fx_basic.h header and fixes up includes as needed. Change-Id: I49af32a8327bdbcda40c50a61ffbd75d06609040 Reviewed-on: https://pdfium-review.googlesource.com/12670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Add truly const versions of CPDF_Document getters.Lei Zhang
Instead of only having CPDF_Dictionary* GetRoot() const, provide const CPDF_Dictionary* GetRoot() const and CPDF_Dictionary* GetRoot(). Do the same for GetInfo(). Change-Id: I6eae1208d38327fcdc7d0cd75069a01c95f4a92a Reviewed-on: https://pdfium-review.googlesource.com/11671 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-30Move CFX_WideTextBuf out of fx_basicDan Sinclair
This CL moves CFX_WideTextBuf to its own files and updates includes as needed. Change-Id: Ibe66ecf3e66f8f01dd8e9eaf6b467588be86ad4f Reviewed-on: https://pdfium-review.googlesource.com/12413 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Split auto restorer from fx_basicDan Sinclair
This CL moves CFX_AutoRestorer into its own file, separate from fx_basic.h. Change-Id: I415cb9207416bd4744b8ac8e2d7466852db53f0a Reviewed-on: https://pdfium-review.googlesource.com/12390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Rebuild CFDE_TextEditEngine.Dan Sinclair
This CL rebuilds the text edit engine in a simpler fashion. Instead of depending on multiple pages, paragraphs and buffer fields there is a single text edit engine which contains a gap buffer. This makes the code easier to understand and follow. Change-Id: I10fe85603fa9ed15a647eaac2d931f113cd0c7b0 Reviewed-on: https://pdfium-review.googlesource.com/11990 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-08-30Convert int* references to FX_STRSIZERyan Harrison
Through out the code base there are numerous places where variables are declared using a signed integer type when interacting with the string classes, since they assume that FX_STRSIZE is 'int'. As part of changing the underling type of FX_STRSIZE to be unsigned, these locations are being changed to use FX_STRSIZE. This is necessary as part of converting the type, but has been broken off into a separate CL, since it should be low risk. Some related cleanups that are low risk are included as part of this CL. BUG=pdfium:828 Change-Id: Ifaae54ad195ccde0fe8672f71271d29a6ebd65fd Reviewed-on: https://pdfium-review.googlesource.com/12210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-29Remove an unused CXFA_FFDoc method.chromium/3200Lei Zhang
Change-Id: If2a8e608498c505440405e7eff675969ac4b195a Reviewed-on: https://pdfium-review.googlesource.com/12330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-29Fix incorrectly guarded lexer advancement in FormCalc parserRyan Harrison
BUG=chromium:752501 Change-Id: Ie9943cd80a4afa73ad9393c8bcd2aa2656a9d932 Reviewed-on: https://pdfium-review.googlesource.com/12290 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-28Remove unused / rarely used CFX_PTemplate methods.Lei Zhang
CFX_Point and CFX_PointF are derived from CFX_PTemplate. Add a helper function to replace the rarely used method where its used. Change-Id: I28448d44bbae9aa6773d1ad5fd7daf342b67c84c Reviewed-on: https://pdfium-review.googlesource.com/12071 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-28Add a global font loader in XFA testsDan Sinclair
This CL creates a global font loader for use in XFA tests. This is needed because the CFGAS_FontMangaer takes a linearly increasing amount of time to load fonts each time it's loaded. This can get excessively slow for test suites which run a lot of tests. Change-Id: Ie389844b56598ce414f4f761654fa4ed465955fd Reviewed-on: https://pdfium-review.googlesource.com/12090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-28Remove code which does nothingDan Sinclair
This code will just add 0 to x and subtract 0 from y. Doing nothing. Remove. Change-Id: I6e0aa91d088acd49cb83d4bded29908b544b692b Reviewed-on: https://pdfium-review.googlesource.com/12110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-08-23Reduce FM2JS parser depth limit to avoid memory exhaustionRyan Harrison
The current limit of 2000 is still causing occassional ASAN issues, reducing to 1250. BUG=chromium:757711 Change-Id: Idb07f97b01230afabcceaa23b29495432193ec64 Reviewed-on: https://pdfium-review.googlesource.com/11750 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Remove OnPageLoad and OnPageUnload from CFWL_EditDan Sinclair
This CL updates the text edit engine to load and unload the page directly instead of calling through the edit widget. Change-Id: I636c8e8b0e635968222430098d3d268c75224b42 Reviewed-on: https://pdfium-review.googlesource.com/11590 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-23Cleanup GetPre* methods in CFDE_TextEdtEngineDan Sinclair
This CL cleans up the GetPre* methods in CFDE_TextEdtEngine. In particular: * GetPreDeleteText was inlined as it was very simple * GetPreReplaceText was removed as unused * GetPreInsertText was renamed to InsertIntoTextCopy to make clear that this was doing the insert into a copy of the text. Change-Id: Icde0126b6ddb0ec9d4956238ebff53c9fe51c051 Reviewed-on: https://pdfium-review.googlesource.com/11531 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-23Move m_pTextBreak to be a member of CFDE_TxtEdtEngineDan Sinclair
Previously text break was a unique_ptr inside the CFDE_TxtEdtEngine. This CL converts it to be a member instead of a unique_ptr. We never replace the pointer after it's created. Change-Id: I89ab73e81c63c24abfacd38a1141db6473d77640 Reviewed-on: https://pdfium-review.googlesource.com/11530 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-23Convert string Find methods to return an OptionalRyan Harrison
The Find and ReverseFind methods for WideString, WideStringC, ByteString, and ByteStringC have been converted from returning a raw FX_STRSIZE, to returning Optional<FX_STRSIZE>, so that success/failure can be indicated without using FX_STRNPOS. This allows for removing FX_STRNPOS and by association makes the conversion of FX_STRSIZE to size_t easier, since it forces checking the return value of Find to be explictly done as well as taking the error value out of the range of FX_STRSIZE. New Contains methods have been added for cases where the success or failure is all the call site to Find cared about, and the actual position was ignored. BUG=pdfium:828 Change-Id: Id827e508c8660affa68cc08a13d96121369364b7 Reviewed-on: https://pdfium-review.googlesource.com/11350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Convert the CFDE_TxtEdtEngine::Insert results into an enum classDan Sinclair
This CL converts the return value to be an enum class and updates the usages to use the names instead of values. Change-Id: I8b6927551679ac4103775a04187daad2e0d6c569 Reviewed-on: https://pdfium-review.googlesource.com/11512 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-22Converted CFX_Matrix::TransformRect() to take in constsJane Liu
Currently, all three of CFX_Matrix::TransformRect() take in rect values and modify them in place. This CL converts them to take in constant values and return the transformed values instead, and fixes all the call sites. Bug=pdfium:874 Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b Reviewed-on: https://pdfium-review.googlesource.com/11550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-21Convert FDE_TXTEDIT_LINEEND to a private enum classDan Sinclair
This CL converts the enum to an enum class and updates the usage as needed. Change-Id: I7ba883e7d1debee00d3d9baafe941620109df8b8 Reviewed-on: https://pdfium-review.googlesource.com/11511 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-21Cleanup CFDE_TxtEdtBuf and simplify some logic.Dan Sinclair
This CL cleans up nits in CFDE_TxtEdtBuf and simplifies some of the methods. Change-Id: I2092da8e27281a577752fc331fec0612a349dfd6 Reviewed-on: https://pdfium-review.googlesource.com/11335 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-08-21Converted CFDE_TxtEdt{Buf|Engine}::Insert() to take CFX_WideStringJane Liu
Converted CFDE_TxtEdtBuf::Insert(), CFDE_TxtEdtEngine::Insert(), and CFDE_TxtEdtEngine::Inner_Insert() to take in CFX_WideString instead of a wchar_t* and length. Bug=pdfium:757 Change-Id: I6097e9b0d4e584b920b2117b4c5489eedef37767 Reviewed-on: https://pdfium-review.googlesource.com/11411 Commit-Queue: Jane Liu <janeliulwq@google.com> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-21Cleanup CFDE_TextOutDan Sinclair
This CL cleans up formatting and simplifies logic in CFDE_TextOut. Change-Id: Ib675a35da79df77854f51e86bf24e5dc90b33b06 Reviewed-on: https://pdfium-review.googlesource.com/11334 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-21Fixing crash on delete or backspace in XFA text edit box.Henrique Nakashima
Bug: pdfium:872 Change-Id: Ib7f0e3708cea2d16d7536ae26777ddc48d7e2c1d Reviewed-on: https://pdfium-review.googlesource.com/11370 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Change XFA DrawWidget() code to take its CFX_Matrix by const-ref.chromium/3192chromium/3191chromium/3190chromium/3189Lei Zhang
Change-Id: Idc9dfcafe6727c1689443ce8f9568567e55d51c8 Reviewed-on: https://pdfium-review.googlesource.com/11114 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Change CXFA_FFWidget::RenderWidget() to take a const CFX_Matrix&.Lei Zhang
Change some related code to take a const CFX_Matrix* since it is not immediately obvious if the matrix can be made into a const-ref. Change-Id: I15c840222b575cc479b1f6f0b6d3b3c0e50d5515 Reviewed-on: https://pdfium-review.googlesource.com/11113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Remove default parameters from CXFA_FFWidget methods.Lei Zhang
Also remove an unused method and move a bunch of internal methods into an anonymous namespace. Change-Id: Ic7b4a975852cc2a7384bf3f681b953a5bf7e7d29 Reviewed-on: https://pdfium-review.googlesource.com/11112 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Remove default parameters in CXFA_Graphics methods.Lei Zhang
Constify parameters as well. Change-Id: I7e87b11cc73b133b04d49ceed1c46f5afcb89d1a Reviewed-on: https://pdfium-review.googlesource.com/11111 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Remove default argument for CXFA_Graphics::SetLineWidth().Lei Zhang
Change-Id: I6ea062bf5def0bc5fea7c52323198209dcf4c3e9 Reviewed-on: https://pdfium-review.googlesource.com/11110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-17Remove redundant members in CFDE_TxtEdtEngineDan Sinclair
This CL removes a bunch of redundant members from the text edit engine. The change information tracking was removed as most of it was unused or was used inconsistently. Change-Id: I92460594e46accff0b78e1183c8574fc83ce728a Reviewed-on: https://pdfium-review.googlesource.com/11275 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>