summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
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-26Remove pParentWnd field entirely from CreateParams.Tom Sepez
Put it into CPWL_Wnd directly, and set/clear it when a child is added/removed from a parent. Change-Id: I7a8cd0cf22dbd6173e64bec5d844df56ad373722 Reviewed-on: https://pdfium-review.googlesource.com/c/44692 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-17Add CPDF_{Array,Dictionary}Locker to catch illegal iteration patterns.Tom Sepez
Move begin/end methods onto locker object which tracks whether iterators are in existence. Change-Id: Ia869f313fce48d10a0d0180d0cc083eed6ea1584 Reviewed-on: https://pdfium-review.googlesource.com/c/44070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-15Split public/ headers into their own source_set.Lei Zhang
This removes some allow_circular_includes_from entries. Change-Id: I276d211a0f45f460b4814560533f0cb83d681613 Reviewed-on: https://pdfium-review.googlesource.com/c/43994 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make fpdfsdk/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: I58e90da4b71a22dd54fd59e8d644b6eef740d4cd Reviewed-on: https://pdfium-review.googlesource.com/c/43988 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Split core/fxcrt build rules into core/fxcrt/BUILD.gn.Lei Zhang
Change-Id: I9b3608bd76ec4911a4bb820fcda62c5d9533fb4f Reviewed-on: https://pdfium-review.googlesource.com/c/43947 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Split fpdfsdk build rules into various BUILD.gn files in fpdfsdk.Lei Zhang
Change-Id: I3500ab9a9bbf0ec983e02dd4b739c9b199d71e21 Reviewed-on: https://pdfium-review.googlesource.com/c/43943 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-11Rename InterForm classes to InteractiveForm.Lei Zhang
Shorten some names to try to avoid CPDF_InteractiveForm* pInteractiveForm = GetInteractiveForm(); Change-Id: I77fafd6c4cce20aa46908830afde12f87784680e Reviewed-on: https://pdfium-review.googlesource.com/c/43815 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-11Rename interform files to interactiveform.Lei Zhang
Just rename the files in this CL. Change-Id: I39f7fefa885977fffab6c909762b05484a1c923d Reviewed-on: https://pdfium-review.googlesource.com/c/43814 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-10Add Observable::ObservedPtr::HasObservable().Lei Zhang
if (pObserved->HasObservable()) is more readable than if (*pObserved). Change-Id: I61ad3deb8e9f30cdc120a05555c2558f34489681 Reviewed-on: https://pdfium-review.googlesource.com/c/43811 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Get rid of non-const ref parameter in CPDFSDK_InterForm::OnFormat().Lei Zhang
Return Optional<WideString> instead. Change the call stack to accept Optional<WideString>. Change-Id: I020589fac8a1de4974070268a19b4acad64c4092 Reviewed-on: https://pdfium-review.googlesource.com/c/43601 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Use pdfium::Optional in CPDFSDK_Widget.Lei Zhang
Also make some methods const. Change-Id: Ie2d0f7e691ad9448b4e77227ce3c0b2b065e0da0 Reviewed-on: https://pdfium-review.googlesource.com/c/43602 Commit-Queue: Lei Zhang <thestig@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-10-09Do IWYU for cpdf_dictionary.h.Lei Zhang
Move some method implementations out of headers in the process. Change-Id: I8701e360d4addd9aec39fe887d932209985d2443 Reviewed-on: https://pdfium-review.googlesource.com/c/43608 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Pass CFX_Matrix by const-ref in various OnDraw() methods.Lei Zhang
Change-Id: I6e953206520c024b2fc23b9b60c5c43112d04896 Reviewed-on: https://pdfium-review.googlesource.com/c/43603 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-24Give CFX_GraphStateData a work-over.chromium/3561Tom Sepez
Use std::vector<float> for dash array. Use compiler-generated default operations. Squeeze some enums. Fix obvious logic botch in DashChanged(). Change-Id: If1d809cc46a3cf2db98a09a3f5a49d22138c0640 Reviewed-on: https://pdfium-review.googlesource.com/42613 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-20Fix misc lint errors and other cleanups.Lei Zhang
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26 Reviewed-on: https://pdfium-review.googlesource.com/42811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-09-14Use MakeUnique() in CFFL_InteractiveFormFiller.Tom Sepez
Remove more bare |new|s. Change-Id: Ia26bb8150d5bb0004c6a8e6ff89b4694b9ef2865 Reviewed-on: https://pdfium-review.googlesource.com/42552 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Use pdfium::span<> in CPDF_Stream::SetData().Tom Sepez
Conversion to span makes this more elegant in a number of places, owing to std::vector directly converting to span, and the bytestring's ToRawSpan(). Disambiguate single-argument forms to allow passing {} as an argument. Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2 Reviewed-on: https://pdfium-review.googlesource.com/41272 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fix shadowed variablesRyan Harrison
This CL fixes instances of variable shadowing that are discovered by turning on -Wshadow. BUG=pdfium:1137 Change-Id: I418d50de89ecbeb12e85b23a358bc61e8f16e888 Reviewed-on: https://pdfium-review.googlesource.com/41150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@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-08-04Do more CBA_FontMap initialization in the ctor and header.Lei Zhang
Change-Id: I705a49198a91b67aa403beea4446095a6a359259 Reviewed-on: https://pdfium-review.googlesource.com/39415 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-02Handle inline font dicts in CBA_FontMap::AddFontToAnnotDict().Lei Zhang
BUG=chromium:869171 Change-Id: I0176bcafa8a63396d916916b5e10b96573085d04 Reviewed-on: https://pdfium-review.googlesource.com/39414 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-26Be more careful casting to widget subclasses.Tom Sepez
Part of the effort to reduce unchecked static casts. Change-Id: I1bff1c53aa7c5804660de4b65cf01523d70fcbb7 Reviewed-on: https://pdfium-review.googlesource.com/38896 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-25Remove some ASSERT (and cast) in favor of checked cases.Tom Sepez
Because it is a stronger pattern at runtime. These were found by essentially: grep -ni '\bassert\b.*type' Change-Id: I913d77139053e8980528597a6633e1859e5204c4 Reviewed-on: https://pdfium-review.googlesource.com/38890 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-22Avoid some duplicate const/non-const getters.Tom Sepez
Getters should nearly always be const when they return a non-const pointer to an unowned object. Saves a bit of code along the way. Grep for similar occurrences and add "const". Change-Id: I492bf962a7d62452fa40310146226dc0c8ebb753 Reviewed-on: https://pdfium-review.googlesource.com/35890 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-20Fix a couple of CPDF_DefaultAppearance::GetFont usageschromium/3467Nicolas Pena
Bug: 853238 Change-Id: I133be340fd877e9acd2733845d454924dc86d295 Reviewed-on: https://pdfium-review.googlesource.com/35711 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@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-11Implement CPDF_Object::MakeReference method.chromium/3456Artem Strygin
Change-Id: I153747ef587a184eaef58ff09dbf8f214c9ddfb3 Reviewed-on: https://pdfium-review.googlesource.com/17230 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-06-05Tidy parser lifecycle state machine in CPDF_PageObjectHolder.Tom Sepez
Only update state in CPDF_PageObjectHolder itself. Make more data private. Remove CPDF_Page::GetPageBBox() as exact duplicate of CPDF_PageObjectHolder::GetBBox(). Change-Id: I083ec33f61a1490e7a5e673c9787751af15a6cd1 Reviewed-on: https://pdfium-review.googlesource.com/33810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@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-05-28Add const/non-const versions of remaining CPDF_Dictionary methods.Lei Zhang
GetObjectFor() and GetDirectObjectFor(). Change-Id: I588cd994dfccf0ffd4c8f91362a4806dc109251e Reviewed-on: https://pdfium-review.googlesource.com/32991 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-25Add proper const/non-const versions of CPDF_Dictionary::GetDictFor().Lei Zhang
BUG=pdfium:234 Change-Id: I6fde00c976ad4bb9cab632f465cf292f5b1da3d2 Reviewed-on: https://pdfium-review.googlesource.com/32914 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Make more CPDF_PageObjectHolder members protected.Lei Zhang
Change-Id: Id31b9f6ac33971c47cdb378ff7f9ca7d33f899b9 Reviewed-on: https://pdfium-review.googlesource.com/32112 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-26Replace some c-style cast with static_cast<>Tom Sepez
Change-Id: I9dd6a36770f77f3df6c4395572785d37402eadc2 Reviewed-on: https://pdfium-review.googlesource.com/31350 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-19Add public APIs for undo / redo in forms.Lei Zhang
Add FORM_CanUndo(), FORM_CanRedo(), FORM_Undo(), and FORM_Redo(). BUG=chromium:764260 Change-Id: I1d9ea67152d9b35d9b8e1d7ef7d019706fdfa30a Reviewed-on: https://pdfium-review.googlesource.com/30872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-17Implement FORM_GetFocusedText() API.Lei Zhang
If there is a focused form field, get its text. BUG=chromium:753216 Change-Id: I05294f14d05c1c86769055f6c9eaf9177787d9fd Reviewed-on: https://pdfium-review.googlesource.com/12072 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-16Put prototypes of PDF_NameEncode/Decode in fpdf_parser_utility.hTom Sepez
Because the implementations are in fpdf_parser_utility.cpp Add unit test for both. Change-Id: Ibae90ecbe625a035c450614ddbe7f5969f9f92aa Reviewed-on: https://pdfium-review.googlesource.com/30793 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-03Use Optional to determine if appearance stream as fontchromium/3388Dan Sinclair
This CL changes the CPDF_DefaultAppearance code to remove the HasFont method and change GetFont to return an Optional. This forces all the call sites to verify a font was returned correctly and removes the need for the duplicate appearance stream parsing. Bug: chromium:827430 Change-Id: If09e0a7d3f7dd63ad77b97a5a388127e4a02da61 Reviewed-on: https://pdfium-review.googlesource.com/29610 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-28Use CPDF_DefaultAppearance instead of custom parsingDan Sinclair
This CL moves code over to using CPDF_DefaultAppearance instead of calling the CPDF_SimpleParser directly. This means the code for finding a specific tag start can move into CPDF_DefaultAppearance directly. Change-Id: I1dc64e54aedd03d059b963121d466f3eb75c17db Reviewed-on: https://pdfium-review.googlesource.com/28410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: 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>