summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller/cffl_textfield.cpp
AgeCommit message (Collapse)Author
2018-10-26Pass CreateParams to CPWL_Wnd constructor.chromium/3595chromium/3594Tom Sepez
The previous reshuffling means we always have the create params earlier, so pass them in at create time. Clean up two forward declarations that were not needed as noticed in the process. Change-Id: I5d3861f3c1e3508e0d25950e919859244fac5f8b Reviewed-on: https://pdfium-review.googlesource.com/c/44710 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-26cp.pParentWindow is always NULL in NewPWLWindow()Tom Sepez
Because the CreateParams come from one of the GetCreateParam() overrides, and none of these set that particual field. This implies that the caller will always own the result, since it is never handed off by an AddChild() call, which is consistent with the function return. Change-Id: I1a9f580f347e911855c695807795541282d43f3f Reviewed-on: https://pdfium-review.googlesource.com/c/44691 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-26Stop transfering ownership of |this| as CPWL_Wnd::Create() side-effectTom Sepez
Instead, make it an explicit method called on the parent outside of create. Rename Create() to Realize() to be sure to catch all usages, and add the new required call. Attachment to the parent now takes place a little earlier on in the life-cycle as a result but should be ok. Precursor to converting to smart pointers. Change-Id: I45c459fcd28b5d03c428ce5809d0432506cf4ec6 Reviewed-on: https://pdfium-review.googlesource.com/c/44690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-26Rename NewPDFWindow() => NewPWLWindow()chromium/3593Tom Sepez
The window comes from the PWL layer. The string |PDF| doesn't add a lot of information since the whole repository is about PDF. Change-Id: I396351519e68ac0c59a02806941f45d3b17e7567 Reviewed-on: https://pdfium-review.googlesource.com/c/44670 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-25Make CPWL_Wnd own its pAttachedData.Tom Sepez
This requires moving it out of CreateParams, since that must be a copyable struct, and implies that currently there is some questionable sharing going on. To resolve this, introduce a Clone() method so that each window gets its own copy. Make GetAttachedData() return a const pointer, so that callers can't free it behind our back. Tidy initializations along the way. Change-Id: Iadc97688b4692bf4fafefe8cff88af88672f7110 Reviewed-on: https://pdfium-review.googlesource.com/c/44590 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-24Fix CPLW_Wnd ownership model in CFFL_FormFiller.Tom Sepez
CFFL_FormFiller::DestroyPDFWindow() might get re-entered, so do not leave any dangling references in maps. Use unique_ptr to be more sure that we have it right. Bug: chromium:898531 Change-Id: I7b61940ff4e88c8a7e3219fefb0479f33bbbfae1 Reviewed-on: https://pdfium-review.googlesource.com/c/44542 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Add k prefixes to CPDF_AAction::AActionType enumeratorsHans Wennborg
The GetFocus enumerator was shadowing the GetFocus function in winuser.h. Change the enumerators to all have a k prefix to avoid the warning, and since I believe pdfium wants to move towards that style anyway. Bug: chromium:895475 Change-Id: I740afa4f29d895e7e3cbb488fd311a7487d67a82 Reviewed-on: https://pdfium-review.googlesource.com/c/44470 Commit-Queue: Hans Wennborg <hans@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-16Remove arguments from CPWL_Edit::SetAlignFormatV().chromium/3525Tom Sepez
There's only one caller. Rename to match its new behaviour. Change-Id: I2d5ac2017316fdf6e9533fe506f2dab14205043a Reviewed-on: https://pdfium-review.googlesource.com/40410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-16Replace optional bool bNotify with enum type.Tom Sepez
Adds clarity to the call sites. Change-Id: Id4deed9adda2ad79f0847d618792429044d4f7d6 Reviewed-on: https://pdfium-review.googlesource.com/40351 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-12Rework "Make common page base class."Tom Sepez
Re-landing of https://pdfium-review.googlesource.com/c/pdfium/+/32892 This time, however, we do not build on the previous CL which cached pages. This CL by itself should be OK but was reverted only because it was blocking earlier reverts. Change-Id: I067d5f07373eeac6cced5d0c113ea40e5f8dcd15 Reviewed-on: https://pdfium-review.googlesource.com/34910 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-04Revert "Make common page base class for XFA and non-XFA."Tom Sepez
This reverts commit d06cc38b76685b002c51b227ae43b8314d926ad8. Reason for revert: blocking previous revert Change-Id: I74f8b80852c671440cca5fabef30e69cde9e2063 Reviewed-on: https://pdfium-review.googlesource.com/33713 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-30Make common page base class for XFA and non-XFA.Tom Sepez
Now that both are ref-counted, we can replace ifdef's with some polymorphism. Bug: pdfium:760 Change-Id: Ie22ea259c9af56fa569f0af268b8e7065789a3f2 Reviewed-on: https://pdfium-review.googlesource.com/32892 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-28More fpdfsdk filename cleanupDan Sinclair
This CL moves more of the fpdfsdk/ code around to better match the naming of other files. Change-Id: I203d91e3e345b2b4767df7a69dd5bd981d61f1d2 Reviewed-on: https://pdfium-review.googlesource.com/29372 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-28Rename some fsdk files to cpdfsdkDan Sinclair
This CL renames fsdk_common and fsdk_define to cpdfsdk_common and cpdfsdk_helpers respectively. Change-Id: I8ee7a308561f1ff2f510954444f953b0c8fed788 Reviewed-on: https://pdfium-review.googlesource.com/29371 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-10Fix UAF in SaveData on all of CFFL_* types.Luật Nguyễn
Bug: 756427 Change-Id: I8e31d96c6f3b83a6464ed69c95225362c50386d1 Reviewed-on: https://pdfium-review.googlesource.com/15870 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-10-05Add ObservedPtrs to catch issues in SaveDataRyan Harrison
BUG=chromium:756427 Change-Id: I90c7065ec5a467cb954cdf3e1d6954a0b0655d4e Reviewed-on: https://pdfium-review.googlesource.com/15630 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@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-09-15Move CPWL_CREATPARAM to CPWL_Wnd::CreateParamsTom Sepez
This nesting makes so much more sense when I read the code. Fix member naming for this in CPWL_Wnd. Pass in/out CreateParams arg as pointer. Kill Reset() method, only called during destroy and nothing needs explicit cleanup. Change-Id: If50e403e11c131e7656da09c0cb36866223d64c6 Reviewed-on: https://pdfium-review.googlesource.com/14070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-08-29Reduce rounding errors when Invalidating rects.Lei Zhang
Instead of using CFX_FloatRect::ToFxRect(), which always rounds down, use GetOuterRect() which correctly rounds up / down depending on the side of the rectangle. Change-Id: I7abd3a65e8c0467ed4303292f26a72737a5d553b Reviewed-on: https://pdfium-review.googlesource.com/12312 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-02Add CFFL_TextField class.chromium/3175Lei Zhang
This class implements common code used by several CFFL_FormFiller sub-classes. Make those sub-classes inherit from CFFL_TextField, instead of inheriting from CFFL_FormFiller directly and then implementing the same functionality multiple times. Change-Id: Iad8a735b6d6e18e89d617636b753805d3f77a286 Reviewed-on: https://pdfium-review.googlesource.com/9850 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-21Change "Sel" abbreviation to "Selection".Diana Gage
This CL changes SetSel() and GetSel() to SetSelection() and GetSelection() in CFX_Edit and CPWL_EditCtrl, and SetEditSel() and GetEditSel() to SetEditSelection() and GetEditSelection() in CPWL_ComboBox. Change-Id: Idd984932bda139a04e99193e519756980b7d4397 Reviewed-on: https://pdfium-review.googlesource.com/8610 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-07-20Make CPWL_Wnd classes be observable.Tom Sepez
This is another case where JS may lead to destruction of an object far away from where we are holding it. Bug: 737023 Change-Id: I994d5425184b8c00b5cfaeb95dbb5032a6e09edb Reviewed-on: https://pdfium-review.googlesource.com/8350 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-07-10Change parameter type to IPWL_FocusHandler::OnSetFocus().Lei Zhang
The parameter is a CPWL_Wnd* but the only caller passes in a CPWL_Edit*, so change it to CPWL_Edit* and remove the type checks / casting. Change-Id: Ic2c85427bea5bf3d257b63c1e2ce9db5bee22136 Reviewed-on: https://pdfium-review.googlesource.com/7430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-15Change some CFFL classes to use early returns.chromium/3132Lei Zhang
Also switch C-style casts to the appropriate C++ casts, and add helper functions in some cases. Change-Id: I73f1ab36c6c89ced9d2b7b98393805142661dcac Reviewed-on: https://pdfium-review.googlesource.com/6650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-02Clean up CFFL formfiller classes.Lei Zhang
- Consolidate assertions for m_pFormFillEnv. - Remove check for m_pFormFillEnv being NULL. - Pass in a CPDFSDK_Widget* instead of an Annot* and then casting. - Remove unused LoadPopupMenuString() method. Change-Id: Ic22e75c9e41eb54002be812945a3ee80debeca8b Reviewed-on: https://pdfium-review.googlesource.com/6232 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-02Remove unused parameter from CFFL_FormFiller::NewPDFWindow().Lei Zhang
Change-Id: I27164e023c622d5c0d9490aa2b09ac4e66dda0fb Reviewed-on: https://pdfium-review.googlesource.com/6231 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-25Mass conversion of remaining class members (non-xfa)Tom Sepez
Change-Id: I8365ba80e3395d59a3cf35dbd9d9162e86e712e3 Reviewed-on: https://pdfium-review.googlesource.com/5970 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-19Cleanup codepage and charset definitions.Dan Sinclair
This Cl cleans up the unused defines in fx_codepage.h. The FXFONT_CHARSET_ defines are replaced with fx_codepage defines, this moves fx_codepage into core instead of xfa only. Static asserts are added to verify the public/ charsets match the fx_codepage charsets. Change-Id: Ie2f749e093de60a9a6743128a1fb087912e4cc96 Reviewed-on: https://pdfium-review.googlesource.com/4316 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-23Remove dead CFX_Edit code and fix some typos.Lei Zhang
Change-Id: Ieaac36e06db3d1e2b857d999a7d3d9cd5c5a9506 Reviewed-on: https://pdfium-review.googlesource.com/3118 Commit-Queue: Lei Zhang <thestig@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-11-02Remove FX_BOOL from fpdfsdk.tsepez
Review-Url: https://codereview.chromium.org/2453683011
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-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
2016-10-03Add ptr_util.h from base until std::make_unique<> availabletsepez
Review-Url: https://codereview.chromium.org/2386273004
2016-09-29Move fpdfsdk/include to fpdfsdkdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2384503003
2016-09-28Replace std::unique_ptr.reset() with WrapUnique assignment.thestig
fpdfsdk/ edition. Review-Url: https://codereview.chromium.org/2381723002
2016-09-22Move CPDFSDK_Environment code to cpp filedsinclair
This CL moves the code from the .h file into the .cpp file. Review-Url: https://codereview.chromium.org/2354363003
2016-09-21Make the I in IFormFiller explicitdsinclair
Typically the I prefix means Interface, except for CFFL_IFormFiller where it means Interactive. Rename CFFL_IFormFiller to CFFL_InteractiveFormFiller to make the meaning explicit. Review-Url: https://codereview.chromium.org/2357203003
2016-09-21Rename m_pApp to m_pEnvdsinclair
The m_pApp variable holds a CPDFSDK_Environment. This Cl renames the variable to be m_pEnv so as not to confuse with the various App classes that exist. Review-Url: https://codereview.chromium.org/2357293002
2016-09-15Replace FX_UINT with unsigned intdsinclair
Remove the FX_UINT typedef and update to use the actual unsigned int type. Review-Url: https://codereview.chromium.org/2343693002
2016-09-14Remove FFI_ from CPDFSDK_Environment method namesdsinclair
The prefix doesn't add anything when used in CPDFSDK_Environment, remove. Review-Url: https://codereview.chromium.org/2338303002
2016-09-14Rename CPDFDoc_Environment to CPDFSDK_Environmentdsinclair
CPDFDoc_Environment does not fit with the general naming scheme of the rest of the files in fpdfsdk. This CL updates the naming to CPDFSDK_Environment to better fit with the surrounding files. Review-Url: https://codereview.chromium.org/2333413003
2016-09-13Split fsdk_mgr files apart.dsinclair
This CL separates the CPDFDoc_Environment, CPDFSDK_Document and CPDFSDK_PageView classes into their own h and cpp files. Review-Url: https://codereview.chromium.org/2335243002
2016-09-13Stop converting widestring -> c_str -> widestring in several places.tsepez
Avoids a needless alloc and copy. Review-Url: https://codereview.chromium.org/2338553002
2016-08-22Destroy window before cleaning up comboboxdsinclair
Currently, when we destroy a CFFL_ComboBox we'll cleanup the fontmap and then call the destructor for the parent type. This will case the PWL_Wnd to be destroyed. In this case, the window is a PWL_Edit. On destruction it will reset the focus which causes the text selection to change, which asks the font map for data but we've already destroyed the font map. This CL forces the destruction of the window earlier in order to have the fontmap available. A followup bug is filed to correct the location of the fontmap so we don't have this dependency. BUG=chromium:637546 Review-Url: https://codereview.chromium.org/2266943002
2016-08-17Split fpdfsdk/fsdk_baseform.h into individual classes.jaepark
This CL moves classes in fsdk_baseform.h to their own files. Classes include CPDFSDK_Widget, CBA_AnnotIterator, CPDFSDK_XFAWidget, PDFSDK_FieldAction, and CPDFSDK_Interform. Review-Url: https://codereview.chromium.org/2252723002
2016-08-03Use smart pointers for class owned pointersweili
For all classes under /fpdfsdk, use smart pointer to replace raw pointer type for class owned member variables so that memory management will be easier. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2173253002
2016-07-27Reland of Remove pageview from map immediatelydsinclair
This reverts commit f2cee9894b9f7cf2e50060965ad1eedd90ab55b6. This CL removes the default parameter from the CPDFSDK_Document::GetPageView |ReNew| flag and updates the code as needed. In CFFL_FormFillter::KillFocusForAnnot we flip the flag to |FALSE| as we don't want to re-create the page view if it is already removed. If we don't do this then the page view will be re-created in the map, the page associated to the page view, but then the page can be deleted out from under the pageview as it isn't owned by the page view. BUG=chromium:630654 Review-Url: https://codereview.chromium.org/2179163004
2016-07-13Cleanup some PWL interfaces.chromium/2800chromium/2799chromium/2798chromium/2797dsinclair
This CL removes IPWL_Edit_Notfy and removes the OnKillFocus override from IPWL_FocusHandler. Review-Url: https://codereview.chromium.org/2144813002