summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_formfillenvironment.cpp
AgeCommit message (Collapse)Author
2017-09-21Rename CFX_RetainPtr to RetainPtrDan Sinclair
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@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-01Remove support for negative params to ReleaseBuffer()Ryan Harrison
This CL removes the default param value for this method, which was negative. It also adds in a method to get buffer lengths, so that the callsites can explictly passing in the length of the buffer if they were using the default value previously. BUG=pdfium:828 Change-Id: I0170771ee81970b8b601631015ab3e6e39fea8ea Reviewed-on: https://pdfium-review.googlesource.com/9790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-07-22Simplify code in CPDFSDK_FormFillEnvironment.chromium/3165Lei Zhang
This makes various IsFooKeyDown() methods static. Transitively apply that to callers too. Change-Id: Ia43b1fd62889c1943e0d8407e9696225b05125a8 Reviewed-on: https://pdfium-review.googlesource.com/7190 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-19Use CFX_WideString in CPDF_NameTree functions to strip BOMchromium/3162Jane Liu
PDFium doesn't strip BOMs during parsing, but we should strip BOMs when retrieving parsed strings in CPDF_NameTree to ensure consistency and appropriate function behavior. See the bug for more info. As outlined in Bug=pdfium:593, the solution is to call GetUnicodeText() instead of GetString(). I added a GetUnicodeTextAt() function in CPDF_Array, which is symmetrical to GetUnicodeTextFor() in CPDF_Dictionary. I then changed the input variable types to CPDF_NameTree functions to be CFX_WideString instead of CFX_ByteString, and modified all the calls to them. I also added a unit test for nametree, which would fail prior to this change. Nametrees with non-unicode names are already tested by embedder tests. Bug=pdfium:820 Change-Id: Id69d7343632f83d1f5180348c0eea290f478183f Reviewed-on: https://pdfium-review.googlesource.com/8091 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-21Fix typos that meant to say handler instead of hander.Lei Zhang
Change-Id: I60f556f107f740b854237bc89184b09e4f1d2585 Reviewed-on: https://pdfium-review.googlesource.com/6790 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Use early returns in more CPDFSDK_FormFillEnvironment code.Lei Zhang
Same for CFFL_InteractiveFormFiller. Fix other nits in both classes and in related code. Change-Id: I9901c48794358889cc20638455ffd7fcb3344574 Reviewed-on: https://pdfium-review.googlesource.com/6652 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-19Mark more CPDFSDK_FormFillEnvironment methods as const.Lei Zhang
Change-Id: Ie7bd4ec567ce932c8010bae744ba42cf40706b79 Reviewed-on: https://pdfium-review.googlesource.com/6678 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-22Use less opaque types in CPDFSDK_FormFillEnvironment.Lei Zhang
Fix type mismatches. Change-Id: Id475f927d0919f60a84f17bd9545ec67d569ff64 Reviewed-on: https://pdfium-review.googlesource.com/5740 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-18Use Unowned/Observed pointers between doc and FF onwership hierarchies.Tom Sepez
See the explanation in CPDFSDK_FormFillEnvironment.h Change-Id: I52feb25fb358831233a636e3ead5aa70e98c5baa Reviewed-on: https://pdfium-review.googlesource.com/5658 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-16Be skeptical of bare |new|s.Tom Sepez
In particular, prefer an explicit .release() call when handing ownership of an object to a caller across a C-API. Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1 Reviewed-on: https://pdfium-review.googlesource.com/5470 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-02Remove some |new|s in cpdfsdk_formfillenvironment.cpp and cpdfxfa_context.cppTom Sepez
Use std::vector<uint8_t> as buffer instead. Change-Id: I710fe87f292b2c0f838410e9c7ff615c27c589a6 Reviewed-on: https://pdfium-review.googlesource.com/4790 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Cleanup string passing in core/fpdf*Tom Sepez
Return strings where possible. Add missing consts to strings passed by ref. Convert non-const cases to pointers. Rename a few methods to be clearer. Change-Id: I86569bc1744f539e6dd67fc73649b272c016328c Reviewed-on: https://pdfium-review.googlesource.com/3951 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-30Add some calls to MakeUniqueDan Sinclair
This CL replaces some new's with pdfium::MakeUnique. Change-Id: I50faf3ed55e7730b094c14a7989a9dd51cf33cbb Reviewed-on: https://pdfium-review.googlesource.com/3430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-02-22Convert OutputSelectedRect to take a rectDan Sinclair
This updates the CPDFSDK_FormFillEnvironment::OutputSelectedRect to match to CFX_SystemHandler::OutputSelectedRect method. Change-Id: Ia07c408533a4423cf81095c5467c9ee82a25988c Reviewed-on: https://pdfium-review.googlesource.com/2815 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-22Update Invalidate to take a rectDan Sinclair
This Cl updates the various Invalidate methods to take a rect when possible. Change-Id: I5359f4d8118f822347414ccb8d261aeef2ac35e0 Reviewed-on: https://pdfium-review.googlesource.com/2814 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-12-07Refcount all the IFX_ stream classes all the time.tsepez
We can remove a lot of "bOwnsStream" logic in the process. Always pass these by const reference, in case the called method wants to hang on to the stream (one exception is where we stick a raw pointer into a void* slot in a context from another layer). Review-Url: https://codereview.chromium.org/2451493002
2016-12-02Make concrete stream classes private to .cpp, part 4.tsepez
This one is more complicated because we were using stack-based instances of what should have been a Release()-only type. Review-Url: https://codereview.chromium.org/2549573003
2016-11-08Fix CPDFSDK_FormFillEnvironment destruction ordertsepez
This was broken in 6c659ab2. Also fix m_PageMap naming while we're at it to match conventions. TEST=covered by forthcoming bug 662698 CL. Review-Url: https://codereview.chromium.org/2489663002
2016-11-02Remove FX_BOOL from fpdfsdk.tsepez
Review-Url: https://codereview.chromium.org/2453683011
2016-11-02Merge CPDFXFA_App into CPDFXFA_Document.dsinclair
This Cl moves the CPDFXFA_App code into CPDFXFA_Document. Review-Url: https://codereview.chromium.org/2424993002
2016-11-01Reland: Make the CPDFXFA_App non-globalchromium/2907dsinclair
This reverts commit a282c7380f3964de41ea93c9980b12c4513d3473. This CL changes CPDFXFA_App from a global object to a child of the CPDFXFA_Document objects. BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2421603002
2016-10-28Fix one more FX_BOOL / int issue in fpdfsdkchromium/2905chromium/2904tsepez
Review-Url: https://codereview.chromium.org/2449783008
2016-10-28Continue fixing FX_BOOL / int noisetsepez
Review-Url: https://codereview.chromium.org/2459073002
2016-10-24Rename IFX_ stream nameschromium/2900tsepez
It's been troubling for some time that an IFX_FileStream might actually be an in-memory buffer with no backing file. Review-Url: https://codereview.chromium.org/2443723002
2016-10-13Revert of Reland: Make the CPDFXFA_App non-global (patchset #2 id:20001 of ↵dsinclair
https://codereview.chromium.org/2418653003/ ) Reason for revert: https://build.chromium.org/p/client.pdfium/builders/linux_xfa_asan_lsan/builds/117/steps/corpus%20tests/logs/stdio Original issue's description: > Reland: Make the CPDFXFA_App non-global > > This reverts commit b685e6471075bebd26711bc183de3128f54932e3. > > This CL changes CPDFXFA_App from a global object to a child of the CPDFXFA_Document objects. > > BUG=pdfium:623 > > Committed: https://pdfium.googlesource.com/pdfium/+/f3736bca5f874b0889c5906ffbd74a405089f671 TBR=tsepez@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2414883006
2016-10-13Reland: Make the CPDFXFA_App non-globaldsinclair
This reverts commit b685e6471075bebd26711bc183de3128f54932e3. This CL changes CPDFXFA_App from a global object to a child of the CPDFXFA_Document objects. BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2418653003
2016-10-13Revert of Make the CPDFXFA_App non-global (patchset #3 id:80001 of ↵dsinclair
https://codereview.chromium.org/2416753002/ ) Reason for revert: https://build.chromium.org/p/client.pdfium/builders/linux_xfa_asan_lsan/builds/112/steps/embeddertests/logs/stdio msan is sad. Original issue's description: > Make the CPDFXFA_App non-global > > This CL changes CPDFXFA_App from a global object to a child of the > CPDFXFA_Document objects. > > BUG=pdfium:623 > > Committed: https://pdfium.googlesource.com/pdfium/+/abefb79577b32d291d14d7e01a70f6f8cf213bd3 TBR=tsepez@chromium.org,thestig@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2412903004
2016-10-13Make the CPDFXFA_App non-globaldsinclair
This CL changes CPDFXFA_App from a global object to a child of the CPDFXFA_Document objects. BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2416753002
2016-10-12Cleanup nits from merge CLchromium/2889dsinclair
This CL cleans up the nits from https://codereview.chromium.org/2410893002/. Review-Url: https://codereview.chromium.org/2417633002
2016-10-12Cleanup env variable namesdsinclair
This CL cleans up any old m_pEnv variables to be correctly named m_pFormFillEnv. Review-Url: https://codereview.chromium.org/2412523002
2016-10-12Merge CPDFSDK_Document into CPDFSDK_FormFillEnvironmentdsinclair
This CL merges the CPDFSDK_Document and CPDFSDK_FormFillEnvironment classes as they always existed and always pointed at each other. Review-Url: https://codereview.chromium.org/2410893002
2016-10-11Fixup formfiller cleanupdsinclair
The CFFL_InteractiveFormFiller must be cleaned up before the environment because the destruction of the formfiller will trigger the destruction of the formfiller widgets. Some of those widgets may require stopping timers, which requires accessing the environment. BUG=chromium:654272, chromium:653459 Review-Url: https://codereview.chromium.org/2408163003
2016-10-05Rename CPDFSDK_Environment to CPDFSDK_FormfillEnvironmentdsinclair
Rename CPDFSDK_Environment to make it explicit that this is part of the formfill system. Review-Url: https://codereview.chromium.org/2391313002