Age | Commit message (Collapse) | Author |
|
This is called by many client to make sure CountItems() does not
crash. Moving the check to CountItems() makes HasRef() unnecessary.
Bug: pdfium:1037
Change-Id: I4f21f33a88c9aad54f0dae18a38b370c6ceaec80
Reviewed-on: https://pdfium-review.googlesource.com/37133
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This allows deciding if FPDFPageObj_GetFillColor() or
FPDFPageObj_GetStrokeColor() should be used to get the effective color
of a text object.
Change-Id: Ic6e99a9eb8512b164756da8b5fcd8cd7771271ae
Reviewed-on: https://pdfium-review.googlesource.com/36750
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This enables more complicated cleanup when an observed object
is destroyed. Use it to make documents observable and to allow
the CPDF_Avail to cleanup without the need for intermediate class.
Change-Id: I3a8e758b7ff542e0a58710eff1ac8017205cbd45
Reviewed-on: https://pdfium-review.googlesource.com/36373
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This reverts commit 35ab1bd0328a244cc2f6dcde2822c8117738b01d.
Reason for revert: Causing crashes and bad flattening.
BUG=chromium:858921,chromium:858952
Original change's description:
> Simplify CPDF_PageOrganizer::UpdateReference method.
>
> Change-Id: I52fe66472bdc2a61d7074f77627a3ee1d5646255
> Reviewed-on: https://pdfium-review.googlesource.com/35611
> Reviewed-by: dsinclair <dsinclair@chromium.org>
> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
TBR=dsinclair@chromium.org,art-snake@yandex-team.ru
Change-Id: I9a3635140867793e7109c15b64d66ec1d1a8b1f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://pdfium-review.googlesource.com/36550
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
CPDFTextObjectFromFPDFPageObject() will take the FPDF_PAGEOBJECT and
performs the same check anyway.
Change-Id: I6535ab749d5a3222c6f2e6fba648f7ee515d3ddc
Reviewed-on: https://pdfium-review.googlesource.com/36372
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I52fe66472bdc2a61d7074f77627a3ee1d5646255
Reviewed-on: https://pdfium-review.googlesource.com/35611
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Improve CPDF_Document interface.
Fix relationship between CPDF_Document and CPDF_Parser.
This CL changes CPDF_Document to internally create the CPDF_Parser
and removes the need for the CPDF_Parser to know about the CPDF_Document.
Change-Id: Iec7aef19575c90f30b9a6c919dfd4f4417e4caf2
Reviewed-on: https://pdfium-review.googlesource.com/35630
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Ideally, unowned ptrs might well be const, as updating something
through an unowned reference is best avoided.
Change-Id: Ida8111ffe0ee1e30bbf6b7718b0929dfb5cafdff
Reviewed-on: https://pdfium-review.googlesource.com/36050
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
In turn, this requires making some of the tests use an indirect
root dictionary so as to satisfy the lifetime requirements.
Change-Id: Ibdbe294a76200d4486134e5848c169a6c2d802bf
Reviewed-on: https://pdfium-review.googlesource.com/36110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
In contrast with FPDFText_GetFontSize(), this exposes the font size of
the text object according to the text state, rather than the font size
of a particular character.
Change-Id: Iac88d1aea8fb6bb5522bdaf01363aa6d32025b8f
Reviewed-on: https://pdfium-review.googlesource.com/35931
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Cleanup CL to address some comments on
https://pdfium-review.googlesource.com/c/pdfium/+/35730 that appeared
after I sent it to the CQ.
Change-Id: I7d5539101547a79d6fc3edf45720b60a1112e2e5
Reviewed-on: https://pdfium-review.googlesource.com/35951
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@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>
|
|
Move receiving "Info" dictionary form API implementation to CPDF_Document.
Also added test.
Bug: pdfium:664
Change-Id: I273980750fbdd4d20711f651245780fc9ba02789
Reviewed-on: https://pdfium-review.googlesource.com/35490
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Henrique Nakashima <hnakashima@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>
|
|
Bug: pdfium:1051
Change-Id: Ia990a47eeceb47fd2b15fe4ea7226861507484db
Reviewed-on: https://pdfium-review.googlesource.com/35115
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@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>
|
|
XFA has its own method for generating alerts in the embedder,
CPDFSDK_FormFillEnvironment::Alert, which is a slight variation of the
non-XFA CPDFSDK_FormFillEnvironment::JS_appAlert. Converting the two
instances of calls to the XFA only method to use the non-XFA method
and removing the XFA only method.
Change-Id: I60ea92b2ae69ea96ce4c216ef6d9029d79580b05
Reviewed-on: https://pdfium-review.googlesource.com/35690
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
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 is similar to FPDFPath_GetMatrix(), but works on text, not path
objects.
Change-Id: If268362b7fa4398124b953e0e2225074523f5f65
Reviewed-on: https://pdfium-review.googlesource.com/35434
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Loop through the dirty page objects and streams and regenerate all
streams that are dirty.
Bug: pdfium:1051
Change-Id: I837b5a7cd9542b7777e7c7ae7ac9cc75f69f30b5
Reviewed-on: https://pdfium-review.googlesource.com/34330
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
cpdfsdk_annot.cpp:315 and cpdfsdk_annot.cpp:338 are nearly identical,
except that the #ifdef XFA code passed along the correct type from
the argument. Prefer this behaviour even when non-XFA.
Change-Id: Id4d5fbcc773ffd10746c4ddc77a571e818e5a957
Reviewed-on: https://pdfium-review.googlesource.com/35030
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Bug: pdfium:978
Change-Id: I0dcffdfd1b19b83e5234da7791cb3f3e52cc257b
Reviewed-on: https://pdfium-review.googlesource.com/35110
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
The polymorphic IPDF_Page::GetDocument() allows getting the document
without special cases. The subsequent retrieval of the page view
via the helper function is equivalent to the inline code in the other
branch of the ifdef.
Change-Id: I8c7008c18610e11e7dcc4151fa7369cfc3625049
Reviewed-on: https://pdfium-review.googlesource.com/35070
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
So remove it and combine the XFA/non-XFA cases.
Change-Id: I13d718de13ec31bf4f5c045164ea5791bf22f92d
Reviewed-on: https://pdfium-review.googlesource.com/35050
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This is an anti-pattern when XFA can be configured at runtime.
Make it easier to find some more remaining cases.
Change-Id: I1ee8d95b2fd52be5e37ef4e859e3e9179ea25975
Reviewed-on: https://pdfium-review.googlesource.com/34990
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
From the comment of CPDF_PageObject::GetContentStream():
"""
Get what content stream the object was parsed from in its page.
This number is the index of the content stream in the "Contents" array,
or 0 if there is a single content stream. If the object is newly
created, -1 is returned.
If the object is spread among more than one content stream, this is
the index of the last one.
"""
Bug: pdfium:1051
Change-Id: I9f7804af4f263dda0422e9542e025e3320ff7c31
Reviewed-on: https://pdfium-review.googlesource.com/34250
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Now that there is a consistent underlying page type, we can unify these
actions.
Change-Id: I13fdfe775c540baaa0cd8085f8a7999fa6a3d276
Reviewed-on: https://pdfium-review.googlesource.com/34970
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
So remove the argument, and the logic dependent upon it being otherwise.
Rename function to more accurately reflect its purpose. Remove needless
null check while we're at it.
Change-Id: I7e119429fd159334eabcc250b5dac215580882ea
Reviewed-on: https://pdfium-review.googlesource.com/34950
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Make LoadDocumentImpl() logic match FPDFAvail_GetDocument() logic, so
that the XFA extension is loaded before checking unsupported features.
Add some comments along the way.
Change-Id: I040e40fcca872f7c0a46e921bce1146f0fe42588
Reviewed-on: https://pdfium-review.googlesource.com/34931
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This landed earlier as part of a larger change that got reverted for
unrelated reasons. Now re-land it by itself. See
https://pdfium-review.googlesource.com/c/pdfium/+/33370
If we don't have a document, then we can't dynamically tell if it is
an XFA doc, so there's no reason to believe it should have all permissions.
If there is an XFA doc under the covers, then the extension will give
us the value.
Change-Id: I6e007ab659914c39d2e5f3fe7a25d9d13439d358
Reviewed-on: https://pdfium-review.googlesource.com/34932
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@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>
|
|
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>
|
|
Move all the checks into the shared helper functions for getting/setting
bounding boxes.
Change-Id: I6f597f478fd3510e0528d20a0a7820949600fd2a
Reviewed-on: https://pdfium-review.googlesource.com/34692
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=pdfium:1049
Change-Id: Ie8bdb893d2af8d63420027a7ef95baf58cd97aa6
Reviewed-on: https://pdfium-review.googlesource.com/34691
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This changes the check from being for a Full XFA document to any XFA
document. Though the value correctly ends up in Chrome, adjusting the
current page appears to not be working correctly in Chrome, so this
doesn't fully resolve the related bug.
BUG=pdfium:1108
Change-Id: I2a5c37e2c64db96cabe8b5b1c277698ebca21949
Reviewed-on: https://pdfium-review.googlesource.com/34650
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: I4b61d4c7239caaf6081bcba80cc0d8ad61569474
Reviewed-on: https://pdfium-review.googlesource.com/34590
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Test FPDFPage_GetMediaBox() and FPDFPage_GetCropBox().
Change-Id: Ia5ba3d95c0c859acb5c2576781cca90d3e60b40e
Reviewed-on: https://pdfium-review.googlesource.com/34570
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Add a test PDF with multiple pages, each with a different media box and
crop box. Demonstrate how FPDFText_GetText() gets all the text on the
page, and how FPDFText_GetBoundedText() with the right bounding boxes
gets only the visible text on the page.
Also fix a small nit in CPDF_TextPage::GetTextByRect() found while
writing this CL.
BUG=pdfium:387
Change-Id: I9ce4bb181e2ba5b454ea1341bbccef9ba94c9cd8
Reviewed-on: https://pdfium-review.googlesource.com/34550
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: Icc705c23420cfbd927767013d2ba871b73ea713e
Reviewed-on: https://pdfium-review.googlesource.com/34530
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Renamed the underlying member m_pFormDict as well.
These names are misleading, as a page also uses the same field as
the page dict.
Change-Id: I52e0f1864a917a1e1b863725cb0d4f22faecacb3
Reviewed-on: https://pdfium-review.googlesource.com/34450
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
It is disabled since pdfium:1051 currently causes it to fail.
Bug: pdfium:1051
Change-Id: I99a12db0ae4a58eab46e365f2f618fc98aee363f
Reviewed-on: https://pdfium-review.googlesource.com/34210
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Adds in logging statement to related API methods and a build flag to
control enabling the feature. This is meant to be used in conjunction
with Chromium.
A developer can enable this flag, load a test PDF, and then click on
elements to determine appropriate coordinates for an .evt file.
BUG=pdfium:1057
Change-Id: I956c39f545297872a61affdb621a412b3c407ff5
Reviewed-on: https://pdfium-review.googlesource.com/34010
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: I68b88e013ac542f245dbe7b6889799c814d46eb8
Reviewed-on: https://pdfium-review.googlesource.com/33690
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@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>
|
|
This reverts commit d3d8287e143daf12a602a919c120b4e0c656abf8.
Reason for revert: Need to revert https://pdfium-review.googlesource.com/c/pdfium/+/33595 that this depends on.
Original change's description:
> Create m_ContentStream field in CPDF_PageObject.
>
> Content streams are now split and can set nonzero values to identify
> each parsed content stream.
>
> Bug: pdfium:1051
> Change-Id: Ia2cb1e0997db5264d468043af31f9b41e8d0d349
> Reviewed-on: https://pdfium-review.googlesource.com/33591
> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org
Change-Id: I5046b6a76508fccc0ff04cb7393cae6485dd091f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: pdfium:1051
Reviewed-on: https://pdfium-review.googlesource.com/33990
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Content streams are now split and can set nonzero values to identify
each parsed content stream.
Bug: pdfium:1051
Change-Id: Ia2cb1e0997db5264d468043af31f9b41e8d0d349
Reviewed-on: https://pdfium-review.googlesource.com/33591
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|