Age | Commit message (Collapse) | Author |
|
Do not allow instanceManager methods to run in Foreground XFA forms.
They are static, and their widgets should not be inserted or removed.
See "XML Forms Architecture (XFA) Specification Version 3.3", page 272.
Bug: chromium:860697
Change-Id: Ia96834e085ee508618ca4dcb2bd5271466369ede
Reviewed-on: https://pdfium-review.googlesource.com/38751
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Previous CLs have shown that the "lpClass" checks aren't sufficient
here, so ensure we are always checking C++ enum value before
downcasting this type.
Change-Id: I418127c5e7131e0a3363363a60d1976719d6837c
Reviewed-on: https://pdfium-review.googlesource.com/38550
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Do the same thing for N other similar files.
Change-Id: If9bb7f6335287441206083c3512fc8a788e9d39b
Reviewed-on: https://pdfium-review.googlesource.com/38532
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
More foolproof technique, and saves one word in every instance at a
cost of two pointers in every subclass vtable.
Change-Id: Ied4f91d4d203b5e6d83abe751159eb7e55489bb5
Reviewed-on: https://pdfium-review.googlesource.com/38530
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Part of the effort to not trust downcasts in the CFXA_Node hierarchy.
The number of subclasses is small enough here that the O(n^2) space
overhead for the vtables is not significant.
Put all sub-classes in same top-level namespace as the parent, just
because we avoid jumping in and out of anonymous namespace.
Change-Id: I32b80a93c75f8a09eb17c01fe1e29d04b4053fa1
Reviewed-on: https://pdfium-review.googlesource.com/38510
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
This is a cleaner way of getting the required argument. Add helper
function and anonymous namespace as misc. cleanups along the way.
Change-Id: I600074b7f6597ffd9b451a21ee374f937a8e9940
Reviewed-on: https://pdfium-review.googlesource.com/38310
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Bug: chromium:849143
Change-Id: I973bb3be6151ac3afad850533cb735c03e9f3d2c
Reviewed-on: https://pdfium-review.googlesource.com/38210
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Introduce cfxa_layoutcontext.cpp to satisfy chromium style ctor check.
Fix typo in class forward declaration in cfxa_layoutcontext.h
Change-Id: I2b29bf61a21be0f895faf8984897c5655a4f0e89
Reviewed-on: https://pdfium-review.googlesource.com/37950
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
The root of the issue is that CXFA_FFDateTimeEdit inherits from
CXFA_FFTextEdit and methods in the former treat its widget as a
CFWL_Edit, while it can be a CFWL_DateTimePicker.
Bug: chromium:857521
Change-Id: I764b6c03095b16f6a9cf72ff36768ca4c57c4070
Reviewed-on: https://pdfium-review.googlesource.com/37910
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
UI elements in XFA can have two different <picture> clauses with
different meanings. One is a formatting statement that dictates the
format the underlying data should appear in. The other <picture>
occurs within an <validate> block and specificies what format the
underlying should be. If it doesn't fit this <picture> the <validate>
block indicates what should occur.
In the existing code actually running the second <picture> type was
being conditionally guarded on whether of not the formatting of the
first type succeeded. This CL moves the calls related to data changing
earlier, to before the formatting and UI updating occurs.
BUG=pdfium:1065
Change-Id: Ib525c490074187c3272f4263ab451bf347b74f9c
Reviewed-on: https://pdfium-review.googlesource.com/37250
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: I74b1828570e54a3868a77231a8ac13bc412c6c43
Reviewed-on: https://pdfium-review.googlesource.com/37051
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
The existing implementation was overly complex and hard to understand,
so this simplifies the logic. As part of this a number of issues, such
as the lack of a failure path, have been resolved.
The spec implies that a picture clause of "" should only accept the
empty string, but existing implementation returns that validation does
exist. This is due to the GetPicture() method returning a string,
instead of a pointer or an Optional, so there is no mechanism to
differentiate between a clause with an empty string and the clause not
being present. This CL maintains the existing behaviour, because there
may be code elsewhere that depends on it.
The existing implementation returns validation not existing if the
node under test is non-interactive. Though this seems intuitively
correct, it is problematic, because this logic isn't just called via
an interaction with the node. The validity check could be initiated
by a call from JS attached to an event or a different node. Thus it is
possible for a node under test to be non-interactive, but the result
of the test is still important. The caller may make the node
interactive if it isn't valid, for example. The spec doesn't state
anything about interactivity controlling if validity checks run. This
CL removes the related logic, since it was causing issues with an
example PDF from the wild.
BUG=pdfium:1065
Change-Id: Icb5b97e0d90f6fbc7ad6b87d81e256803c757eb0
Reviewed-on: https://pdfium-review.googlesource.com/37131
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: Idcd992224fc5411c97f3001293af83a6c581e695
Reviewed-on: https://pdfium-review.googlesource.com/36991
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I48c20a56ca25a6821bc9b51aa59c037fe2341194
Reviewed-on: https://pdfium-review.googlesource.com/36972
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Move initializers to .h file (proves none missing).
Change-Id: Iff8fe76e46634aa32a32ecd592476594a9d1bafa
Reviewed-on: https://pdfium-review.googlesource.com/36950
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Re-order owned/unowned references to obey lifetime constraint.
Change-Id: I589746b3c2e7d8c45d26d63d09eef977b095226d
Reviewed-on: https://pdfium-review.googlesource.com/36970
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Also make private member along the way.
Change-Id: I08a006a1bcca4e8ca21834dfda695a2d77d0a431
Reviewed-on: https://pdfium-review.googlesource.com/36930
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Ib65197a9cd9de173de8e77db168dcfbb43669022
Reviewed-on: https://pdfium-review.googlesource.com/36911
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I25496c9792a99ca27d2ab84c267770ff941cf921
Reviewed-on: https://pdfium-review.googlesource.com/36912
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Ifdb9fb23d61082b7c1b9b93c057e0881959cea2a
Reviewed-on: https://pdfium-review.googlesource.com/36530
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
XFA_LAYOUT_INVALIDNODE is used in place of nullptr, but does not
appear to represent a sentinel value distinct from it. Using a
non-nullptr value prevents using any kind of smart pointer type
in the future.
Change-Id: Iab6418b3dc9c3d45780730795496ac07b67de696
Reviewed-on: https://pdfium-review.googlesource.com/36651
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
These appear in compile-time const data. Adding the comment makes
it easier to see what work remains when using grep.
Change-Id: Ibb5fe920dc9fc99dd4c866f9ddf800a58f6a67a8
Reviewed-on: https://pdfium-review.googlesource.com/36690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I1981eb23006db203e845e954a7847cfa992d5e03
Reviewed-on: https://pdfium-review.googlesource.com/36710
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Part 2.
Change-Id: I26fe434dac3c3f5186414440acc2a495a5f14091
Reviewed-on: https://pdfium-review.googlesource.com/36670
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Comment raw pointers subject to nondeterministic tree destruction
order as such to avoid re-attempting to convert to the unowned
mechanism.
Change-Id: Ia9fe3c8a2729dc1e2b1de4a8c62ae3d2c3d7ec0a
Reviewed-on: https://pdfium-review.googlesource.com/36635
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Iae962711f522ad52e77f19201d00d9ab86096ca4
Reviewed-on: https://pdfium-review.googlesource.com/36510
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
It is only called during the destructor, and does things that
the destructor would automatically do, like calling into the
superclass. So just use destructors.
Change-Id: I1196817798eeca99914b44ddee1f75781e682211
Reviewed-on: https://pdfium-review.googlesource.com/36231
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I1e9059242dad254394b73c6fddb010b182e969f0
Reviewed-on: https://pdfium-review.googlesource.com/36230
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Bug: chromium:844367
Change-Id: I3cbe5d97a913c734c3d54657a2fb47b30cc362fe
Reviewed-on: https://pdfium-review.googlesource.com/36191
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Bug: chromium:844367
Change-Id: Id8185ea0219c03b4f8683362a3c2a45d481a5cfb
Reviewed-on: https://pdfium-review.googlesource.com/36170
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
Define constant values in the public API for the valid values of alert
button type, alert icon type, and beep type. Replace various magic
numbers through out the code base using these values. Also replace the
XFA specific versions with an enum class that is guaranteed to have the
same values, instead of #defines that just happen to.
This CL does not attempt to add error checking on these values, since
it currently doesn't exist so adding it may cause regressions.
Change-Id: Ief3aee2a4ad419691c18fc1dba8b984ad222141b
Reviewed-on: https://pdfium-review.googlesource.com/35730
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Many of these cause a string duplication as we go from
Widestring => c_str => Widestring
Change-Id: I0dfa952e66f89138e719ff9200db3d9397839e28
Reviewed-on: https://pdfium-review.googlesource.com/35790
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I5dfadcb68e640235be6e3eb7c8d57ae3b8013d26
Reviewed-on: https://pdfium-review.googlesource.com/35691
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Many of these are converting ByteString => c_str => ByteStringView, since
the ByteStringView ctor is implicit. This is unfortunate, since that
involves a strlen() which the ByteString already knows if we use
AsStringView() instead.
This changed one test result where we can now return the string
"\0" instead of "" -- since strlen no longer eats the NUL. This
seems consistent, say, with String.fromCharCode().
Change-Id: I17f68d1a1f4b352960208f9148e68ab4c4d78bd2
Reviewed-on: https://pdfium-review.googlesource.com/35590
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Remove some string copies in barcode that were noticed whilst
looking for moves.
Change-Id: Ieda34d00f633576ba1f0dca283dcdabfb36f236c
Reviewed-on: https://pdfium-review.googlesource.com/35410
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
When calling the FXSYS_wctof method we currently pass in -1 from
AdvanceForNumber. This tells the method to calculate the string length.
This can be slow for a formcalc string with a lot of numbers.
This CL changes the call to pass in the length of remaining data in the
original string. This takes the MSAN runtime of the case in the linked
bug from ~21seconds to ~500ms. The debug runtime goes from ~2s to
~500ms.
Bug: chromium:846104
Change-Id: Idbd19a728160f35982e21c0d97567fbbeefe667a
Reviewed-on: https://pdfium-review.googlesource.com/35210
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This allows compilers targeting the MS ABI to select the correct inheritance
model for the member function pointer type XFA_ATTRIBUTE_CALLBACK using the
complete type of CJX_Object. It will allow us to enable the new Clang flag
-fcomplete-member-pointers globally.
Bug: chromium:847724
Change-Id: I90cedde8c5355e5eb896a93f0e43e6a1e1d09dbc
Reviewed-on: https://pdfium-review.googlesource.com/35190
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This CL updates some of the formcal tests to use raw literals instead of
escaping lots of things.
Change-Id: I539063b6c98aae318147b7103a0fd84e6b76054f
Reviewed-on: https://pdfium-review.googlesource.com/34190
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
When converting a Var statement from formcalc to JS we would neglect to
add the ; if the variable was initialized. This generated invalid JS as
we'd end up with two statements smushed together.
FormCalc:
var s = ""
Previous JS:
var s = ""s = pfm....
New JS:
var s = "";
s = pfm ...
Bug: pdfium:1097
Change-Id: I8a869f07374cac68a06a487dace89699a4e5540c
Reviewed-on: https://pdfium-review.googlesource.com/34110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
When calling into the XFA JS engine with a request for a non-XFA JS
call which accesses the EventContext we would get a crash in XFA as we
never set the context. This CL changes the XFA code to accept the
CJS_Runtime instead of the CFXJS_Engine and then calls NewEventContext
before executing JS scripts. This will correctly setup the event context
as needed for any JS callbacks.
Bug: pdfium:1003
Change-Id: Icf202252b2e6e56afdf0d1766a32a893935a2fd3
Reviewed-on: https://pdfium-review.googlesource.com/33930
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Removed some unused assignments and now unused variables.
Also rewrote a for loop so that its secondary condition is now in the
control block. The static analyzer was claiming it was possible for a
division by 0, though following the control path it was claiming, I am
pretty sure it should have exited early. This reorganizing of the code
makes it a bit more readable and eliminates the div by 0 warning from
the static analyzer.
Issues found with Clang Static Analyzer.
Change-Id: I91f1b42374734665b06724e9fafa6490e06bd3da
Reviewed-on: https://pdfium-review.googlesource.com/33910
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
This assignment is never used, so removing it.
Issue found with Clang Static Analyzer.
Change-Id: I5cf4bd9626f0a0391681c3923ae1bee70ffb99c7
Reviewed-on: https://pdfium-review.googlesource.com/33791
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
When script variables are used the methods are set on the non-xfa global
object. This CL updates the NormalPropertyGetter to check the non-xfa
global object for methods which allows the variables methods to be
found.
Bug: pdfium:1097
Change-Id: I13d9d49ad654cad776883aef74de6250de5e756b
Reviewed-on: https://pdfium-review.googlesource.com/33433
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Because it returns an unique_ptr to a newly-created object.
Also rename m_pTimeMgrAdapter to m_pAdapterTimerMgr, because in
English, adjectives come first, and this is a TimerMgr obtained
from an Adatper, not an Adapter for a TimerMgr. Also change TimeMgr
to TimerMgr since the manager manages timers, not time itself.
Follow-on from https://pdfium-review.googlesource.com/c/pdfium/+/33230
No functional change.
Change-Id: I08d2b6cd8cc816f38326e87ee46060f091c74fdf
Reviewed-on: https://pdfium-review.googlesource.com/33570
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
The variable is not used outside of the loop. This was noted by
tsepez@ after landing the initial CL to clean up this code.
Change-Id: Id7d6713db4fa6bdfe867c151290cb28329ae7042
Reviewed-on: https://pdfium-review.googlesource.com/33590
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Initialize pCharPos to non-NULL, so that later code can depend on it
!= nullptr, avoiding a potential call to memset on
nullptr. Additionally get rid of a free then alloc pattern and just
use realloc.
Later on remove updates to fBaseLineTemp that have not effect, since
it isn't read after them.
Issues found with Clang Static Analyzer.
Change-Id: Iff175e20cd8860d263a56a24c8781e214c61d02c
Reviewed-on: https://pdfium-review.googlesource.com/33533
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Proves ownership by avoiding a std::unique_ptr::reset() call.
Change-Id: Ia6e11920d84dda49699736ef3189e58d240d409e
Reviewed-on: https://pdfium-review.googlesource.com/33230
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Neither of these local values ever get read after calculating them.
Issue found with Clang Static Analyzer.
Change-Id: Iffa578f1d5e303c65a881bcd372a9144a11edd3b
Reviewed-on: https://pdfium-review.googlesource.com/33532
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
This value is overwritten at the beginning of the following while
loop, so the initialized value is never used and the method called is
const, so should be side effect free.
Issue found with Clang Static Analyzer.
Change-Id: I77f27daccd3aa1edd434cfa3e0dd7bc095db06d0
Reviewed-on: https://pdfium-review.googlesource.com/33550
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|