Age | Commit message (Collapse) | Author |
|
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>
|
|
In this function a string is converted to UTF8, if there are
non-printing characters in the original string, the generated string
will be shorter. Thus using the original string length for iteration
range will cause an OOB read.
BUG=chromium:854623
Change-Id: I338005476c3de529709f3eae6892d27a6c7f2263
Reviewed-on: https://pdfium-review.googlesource.com/35810
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
It is hard to tell if there is some unsavory stuff going on with
references otherwise. Avoids some const_casts in the process.
Add some UnownedPtrs along the way to check caller's storage duration.
Change-Id: Ic8d85802083f0b27e07993ea25f8f1c15fca1712
Reviewed-on: https://pdfium-review.googlesource.com/35750
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@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>
|
|
Because the invisible temporary goes out of scope at the next
semicolon.
Also avoid returning const string references since the cost is
low to properly keep the string alive.
Change-Id: Id283e4fd99f79a02d79d739a533a4ce05e831e2a
Reviewed-on: https://pdfium-review.googlesource.com/35710
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: 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>
|
|
c_str() is a bit of a code smell, esp. since Byte/Wide strings
know how to do this all by themselves.
Change-Id: I9c86cee42c12a3f72ddb1d410a91cf25647d0ce6
Reviewed-on: https://pdfium-review.googlesource.com/35530
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@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>
|
|
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>
|
|
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>
|
|
Partial move, we'll clean up the engine side later.
Change-Id: I07fdae150de9e834d11ed242a7f9a007aae266ac
Reviewed-on: https://pdfium-review.googlesource.com/34810
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This more clearly shows how information is flowing out of V8
and into our C++ callbacks.
Change-Id: I5c37d2c28c166443eb9983076fbb0e944bebbf47
Reviewed-on: https://pdfium-review.googlesource.com/34790
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Avoid explicitly finding array sizes.
Change-Id: Id51e3d10ea4db0a6375807a53309ce8d68b3b413
Reviewed-on: https://pdfium-review.googlesource.com/34750
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Avoid explicitly having to count items in arrays.
Change-Id: I24a91db45e8a8530f38afcc273e824ffb70a6cb9
Reviewed-on: https://pdfium-review.googlesource.com/34710
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Because constructors can do all this.
Change-Id: I4f7ff6c26b17d9bddd326333a66e1bd38b2ea377
Reviewed-on: https://pdfium-review.googlesource.com/34693
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change the signature of the constructors to make it impossible to
do this otherwise.
Change-Id: I14e88d98a1128f2d599459ce9337cd6d079469fe
Reviewed-on: https://pdfium-review.googlesource.com/34531
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
We used to assume that a global proxy object could be distinguished
by it not having two internal fields, but that invariant isn't
correct. Instead, flag it as such so the block of code at line 126
will check the prototype to find an actual object.
Squeeze some bytes out of the tags while were at it, no reason for
them to be wide. Also remove GetGlobalObjectFromContext() helper, for
transparency into what's really going on in v8. This then shows a
needless retrieval of an object we already have in one case.
Bug: pdfium:1097
Change-Id: Iafc356373166fe5fda76ea7d64193826ee69a6c3
Reviewed-on: https://pdfium-review.googlesource.com/34630
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
TBR=dsinclair@chromium.org
Change-Id: I2665f616d451ff7075b63457a91ef264bbde84c9
Reviewed-on: https://pdfium-review.googlesource.com/34610
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I6a634cb3fb9acdd78ae29017987e5e41865a0d4b
Reviewed-on: https://pdfium-review.googlesource.com/34490
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Its no longer required.
Change-Id: I180ca99817352a91b6d9d7c9b45985cd96dc730e
Reviewed-on: https://pdfium-review.googlesource.com/34290
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
In a world without context slots, we don't need to test getting an
engine from a content slot.
Change-Id: If572c364d663d1f20af659392bda3b96348fd4d4
Reviewed-on: https://pdfium-review.googlesource.com/34270
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Removes CJS_Runtime::RuntimeFromIsolateCurrentContext()
Change-Id: I51abcf32aaafac522e1595edf663507c26781357
Reviewed-on: https://pdfium-review.googlesource.com/34230
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Another step in the move away from v8::Context slots.
Change-Id: I302d1b3305755088c663214120e582b783cc5fbb
Reviewed-on: https://pdfium-review.googlesource.com/34211
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Instead, use the object binding's pointer. Puts the cart back
behind the horse.
Change-Id: I4c06ae991b871c6e90b0e6c70b69886addca2354
Reviewed-on: https://pdfium-review.googlesource.com/33630
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL changes the JS error produced by the CFXJSE_Class when a method
call returns with error. Instead of outputing something like:
JS Error: resolveNode.:
we will now get:
JS Error: Root.resolveNode:
which at least lets us know we're looking at the Root class.
Bug: pdfium:1097
Change-Id: I4982109398e290d9ebc2763fcc2421a642c581a5
Reviewed-on: https://pdfium-review.googlesource.com/34090
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I773ff83b45ffbd736f064daedb1010c8d01a99d5
Reviewed-on: https://pdfium-review.googlesource.com/34050
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This proves that m_EventContextArray is, in fact, a stack.
Tidy one function by using AutoRestorer while at it.
Change-Id: I319538b4eadcd9ce83319aa73861635dd5eb8c36
Reviewed-on: https://pdfium-review.googlesource.com/33970
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
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>
|
|
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>
|
|
Consistency with file naming conventions.
No functional change.
Change-Id: I596c4be5bbf0510950c44a7d9d80f59537739c3b
Reviewed-on: https://pdfium-review.googlesource.com/33593
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Precursor to removing some more v8::Context slot dependency.
There's a cost to maintaining the set of observers, but since these
objects are tied to V8 lifetimes, not C++ lifetimes, we want to be
very wary of the document going away unexpectedly.
Change-Id: I579f58a460aa50b88cb861227c9aca9a8a83ce12
Reviewed-on: https://pdfium-review.googlesource.com/33471
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Small step towards deprecating FXJS's use of v8::Context slots.
Reduces some string constant storage size while were at it by
avoiding wide literals for ascii strings.
Change-Id: Ibc651cff264302681645fde7c53bf77517b97651
Reviewed-on: https://pdfium-review.googlesource.com/33470
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This reverts commit f0d9d28a034fe3650c3c2d662090c1e8687ddb16.
Reason for revert: avoid parsing page.
Change-Id: Id3478f7e38f1cbe95d098e00158b1d7d9dc6f76e
Reviewed-on: https://pdfium-review.googlesource.com/33750
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
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>
|
|
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>
|
|
These guards are using #if, when they should be using #ifdef. Caught
using Clang's static analyzer.
Change-Id: I86e99c5e4142cf84fff5f2365ad534f09ae40511
Reviewed-on: https://pdfium-review.googlesource.com/33510
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
TBR=dsinclair@chromium.org
Change-Id: I6f2a4a4b39c38a1bcfcf817a5c2aa51414291ad9
Reviewed-on: https://pdfium-review.googlesource.com/33451
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Allows FXJS to be entered directly from V8 when the variable context
gets a reference to an FXJS object.
Bug: pdfium:1066
Change-Id: I48e39ed9104cc6df31c19d94fa7e0f8c7760932f
Reviewed-on: https://pdfium-review.googlesource.com/33450
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Methods are not called, removed.
Bug: pdfium:1097
Change-Id: I0c7bc8ded070002dd5eb980a4705eabb829fb6ec
Reviewed-on: https://pdfium-review.googlesource.com/33390
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
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>
|
|
This CL writes any JS exceptions to the console in XFA if running in
Debug mode. This makes it possible to see when an error happens in JS
execution.
Bug: pdfium:1097
Change-Id: Ida14050328c5e6e85ab2704bb5dddfec370dddf1
Reviewed-on: https://pdfium-review.googlesource.com/33154
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
We cache pages not by page number, which can bounce around as pages
are inserted or removed, but by page dictionary's object number.
Since the page may be created under one function and used under
another, we can't take the shortcut of not instantiating a render
cache nor not parsing the page.
Change-Id: I9a325cda8b3141153544ac53e78a51a44e6b411a
Reviewed-on: https://pdfium-review.googlesource.com/32830
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL adds the necessary plumbing to propagate the change information
for a text widget from FWL out to JS and handle the returned value as
necessary.
Bug: pdfium:1066
Change-Id: I78fd81761b90294f1836e9f09dba12ed238963cc
Reviewed-on: https://pdfium-review.googlesource.com/33070
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Small step to reducing the differences between XFA and non-XFA. We
still use the RetainPtr pretty much as if it were an unique_ptr, in
that we're not yet caching pages and handing out multiple pointers
to the same page in the non-XFA case.
The one change is in page view cleanup, where we no longer need a
boolean and can take (sufficient) page ownership with a RetainPtr.
Tidy up some document.h -> page.h -> document.h circular inclusion
while we're at it.
NOTE: Wait for imminent branch to pass before landing. We'll want
this to bake a while.
Change-Id: I64a2f12ac3424ece1063d40583995b834117cf34
Reviewed-on: https://pdfium-review.googlesource.com/32790
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
When an xfa.event is sent it is possible to change the selStart, selEnd
and change values of the event. This should cause the value of newText
to be changed as needed.
This CL removes m_wsNewText from CXFA_EventParam and instead generates
the new text based on the previous text, the selection and the change.
Bug: 1066
Change-Id: I35d126fad9771c8980654a8af64d2b98989bff3f
Reviewed-on: https://pdfium-review.googlesource.com/32970
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This CL adds the missing cancleAction property from the xfa.event
object.
Bug: 1066
Change-Id: I7d38956e2985c1f6ac0eba6de090874f1f72003c
Reviewed-on: https://pdfium-review.googlesource.com/32950
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This CL adds bounds checking for the selStart and selEnd settings of the
event object. The selEnd is not allowed to be less then selStart. They
are also not allowed to be negative. This also clamps them to the length
of the prevText string.
Bug: 1066
Change-Id: Ifc9113c669c83a4a97655554affbbce30c2bfc64
Reviewed-on: https://pdfium-review.googlesource.com/32933
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
According to the XFA Spec only the cancelAction, selStart, selEnd and
change properties of xfa.event are editable. This CL adds checking to
early out if attempting to set any of the other properties.
Bug: 1066
Change-Id: Ie6129e1f65de7584f0b5f3072a1acf6e25d44a2c
Reviewed-on: https://pdfium-review.googlesource.com/32932
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|