Age | Commit message (Collapse) | Author |
|
This CL cleans up formatting and simplifies logic in CFDE_TextOut.
Change-Id: Ib675a35da79df77854f51e86bf24e5dc90b33b06
Reviewed-on: https://pdfium-review.googlesource.com/11334
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Idc9dfcafe6727c1689443ce8f9568567e55d51c8
Reviewed-on: https://pdfium-review.googlesource.com/11114
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change some related code to take a const CFX_Matrix* since it is not
immediately obvious if the matrix can be made into a const-ref.
Change-Id: I15c840222b575cc479b1f6f0b6d3b3c0e50d5515
Reviewed-on: https://pdfium-review.googlesource.com/11113
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Also remove an unused method and move a bunch of internal methods into
an anonymous namespace.
Change-Id: Ic7b4a975852cc2a7384bf3f681b953a5bf7e7d29
Reviewed-on: https://pdfium-review.googlesource.com/11112
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Constify parameters as well.
Change-Id: I7e87b11cc73b133b04d49ceed1c46f5afcb89d1a
Reviewed-on: https://pdfium-review.googlesource.com/11111
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I6ea062bf5def0bc5fea7c52323198209dcf4c3e9
Reviewed-on: https://pdfium-review.googlesource.com/11110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Remove friendship.
De-virtualize.
Nest enum inside class.
Make copy-assignable and pass by const ref.
Make pack better on 64-bits.
Change-Id: I1ae3b6d03756fa5780e9023795db6648e8b8299a
Reviewed-on: https://pdfium-review.googlesource.com/11290
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Due to the recursive nature of the FormCalc parser, deeply nested
expressions can lead to memory being exhausted. This check is being
added to have the parser exit early instead of running out of
memory. This should reduce the number of false positives about
addressing issues being found by fuzzers.
BUG=chromium:752433
Change-Id: I511ecfb07e32073555e1fd1658f3b8b47f1a5a91
Reviewed-on: https://pdfium-review.googlesource.com/11170
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This class is actually an accidentally renamed interface. There is only
one concrete class so fold the interface back into the concrete class.
Change-Id: If921a34595fad85750389f071ffdc9a5eae09f8e
Reviewed-on: https://pdfium-review.googlesource.com/11150
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:754982
Change-Id: I41da6828c714d3ed12fe796ae7e228d87b168962
Reviewed-on: https://pdfium-review.googlesource.com/10890
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This method duplicates the behaviour of the const [] operator and
doesn't offer any additional safety. Folding them into one
implementation.
SetAt is retained, since implementing the non-const [] operator to
replace SetAt has potential performance concerns. Specifically many
non-obvious cases of reading an element using [] will cause a realloc
& copy.
BUG=pdfium:860
Change-Id: I3ef5e5e5a15376f040256b646eb0d90636e24b67
Reviewed-on: https://pdfium-review.googlesource.com/10870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This CL removes CFDE_RenderDevice. For most of the proxy'd calls we call
the CFX_RenderDevice directly now. To set the clip rect an overload was
added to accept a CFX_RectF and handle the casting to FX_RECT. The one
needed method, DrawString, is move to a static on CFDE_TextOut.
Change-Id: I95ea7e1fa1fd4702074b797c06423c9c9cb51db9
Reviewed-on: https://pdfium-review.googlesource.com/10951
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL removes CFDE_RenderContext and moves the ::Render method to be
::RenderText on the CFWL_Edit class which was the only caller.
Change-Id: Ic940a3f0d10cfce169f5e491de90803fc8a7940d
Reviewed-on: https://pdfium-review.googlesource.com/10950
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL replaceds FDE_TTOSTYLE defines with a FDE_TextStyle struct which
is used to set the needed flags. The FDE_TTOALIGNMENT defines are
replaced with an enum class and unused members have been removed.
Change-Id: Ib0e2818a82e7f1961de57f8d15703477f8235a03
Reviewed-on: https://pdfium-review.googlesource.com/10530
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Specifically the index parameter passed in to GetAt(), SetAt() and
operator[] are now being tested to be in bounds.
BUG=chromium:752480, pdfium:828
Change-Id: I9e94d58c98a8eaaaae53cd0e3ffe2123ea17d8c4
Reviewed-on: https://pdfium-review.googlesource.com/10651
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This CL removes CFDE_Path. There is only one method, AddLine which is
required, the rest can be removed. That method is moved to CFX_PathData
which is what CFDE_Path is appending to anyway.
Change-Id: If50af8cf856a9f7379791fe1999174db5fd13e38
Reviewed-on: https://pdfium-review.googlesource.com/10454
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
These classes just hold a color value. Instead of creating the class to
pass the color we just pass the colors.
Change-Id: I7f65ca4100bfbdcb02171c1e7e46150508e338f4
Reviewed-on: https://pdfium-review.googlesource.com/10451
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
The xfa/fde/css code has no other links into xfa/. This CL moves the css
code to core/fxcrt/css and sets to only build when pdf_enable_xfa is
enabled.
Change-Id: Iefd208e1f83a28b80b567c574e841e87bce310be
Reviewed-on: https://pdfium-review.googlesource.com/9251
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The existing behaviour was to clamp the provided index to the valid
bounds. This would lead to programming errors being hidden, since
inserting would still do something even if the index calculation was
wrong. The behaviour of these methods has been changed to instead
early return when this occurs, returning the old length value. The
caller can check if the call to Insert actually did anything by
comparing the returned value to the length before calling insert.
All of the existing calls to Insert have been tested by running all of
the tests with asserts in the Insert method to check the index is in
bounds. Additionally the call sites have been manually inspected. The
majority of them are of the form Insert(0, foo) and the rest tend to
be in a loop advancing from 0 to length.
Convenience methods InsertAtFront/InsertAtBack have been added to
handle calling Insert when the intent is for the character to be added
to the beginning or end of the string. Existing call sites to Insert
that do this have been converted.
This work was originally being performed to check if there would be
any issues in these methods with making FX_STRSIZE unsigned.
BUG=pdfium:828
Change-Id: I60cee5ad45338aa8ed46569de7bcc78a76db18f7
Reviewed-on: https://pdfium-review.googlesource.com/9870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Currently Find() and other methods that return a FX_STRSIZE return -1
to indicate error/failure. This means that there is a lot of magic
numbers and magic checks floating around. The standard library for
similar operations uses a npos constant. This CL implements
FX_STRNPOS, and replaces usages of magic number checking. It also does
some type cleanup along the way where it was obvious that FX_STRSIZE
should be being used.
Removing the magic numbers should make eventually changing FX_STRSIZE
to be unsigned easier in the future.
BUG=pdfium:828
Change-Id: I67e481e44cf2f75a1698afa8fbee4f375a74c490
Reviewed-on: https://pdfium-review.googlesource.com/9651
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This change also removes some variable shadowing that was going on
here.
BUG=chromium:750013
Change-Id: I7314166af3ecd55ea5e1105afbe171443b1b22ae
Reviewed-on: https://pdfium-review.googlesource.com/9630
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
The various string/byte classes support Mid(), Left(), and Right() for
extracting substrings. Mid() can handle all possible cases, but Left()
and Right() are useful for common cases and more explicit about what
is going on.
Calls like Mid(offset, length - offset) can be converted to
Right(length - offset). Calls like Mid(0, length) can be converted to
Left(length).
If the substring being extracted does not extend all the way to one of
the edges of the string, then Mid() still needs to be used.
BUG=pdfium:828
Change-Id: I2ec46ad3d71aac0f7b513e103c69cbe8c854cf62
Reviewed-on: https://pdfium-review.googlesource.com/9510
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This support is being removed from CFX_ByteString, CFX_ByteStringC,
CFX_WideString, and CFX_WideStringC. This standardizes all of these
classes to only have one Mid method that takes in 2 params, offset and
count. Count now must be positive. The old behaviour of calculating
the length for the user if -1 is passed in for the count has been
removed. This work is in preperation for converting these classes to
not accept negative lengths anywhere and thus make the underlying size
type unsigned.
BUG=pdfium:828
Change-Id: I5f15e7b7b00b264231817f143e2da88ee6f69e7b
Reviewed-on: https://pdfium-review.googlesource.com/9430
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Minor nit I had with this code and want to fix.
Bug:
Change-Id: I2494667d580bf982a4359153123d9e8afb75e349
Reviewed-on: https://pdfium-review.googlesource.com/9370
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Bug: pdfium:731
Change-Id: I3b7e4e88d44afcb8590ce4b7e7de7c0eccdc623a
Reviewed-on: https://pdfium-review.googlesource.com/7350
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
0 is not actually in the spec for characters and was only included due
quirks in how the lexing code was written. Due to changes in the
lexer, it is no longer needed and a potential source of errors.
Bug:
Change-Id: I6fbba027e40aaa286ed4c89a6c569d26e3d4cd8b
Reviewed-on: https://pdfium-review.googlesource.com/9350
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Removed 'case 0xf00:' to either be the character being checked or
moved to a IsWhitespaceCharacter() check.
BUG=pdfium:815
Change-Id: I34727a00f6d54ecf8de2f9e4eb785b3c10b6c521
Reviewed-on: https://pdfium-review.googlesource.com/9310
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
This CL rewrites how FMLexer returns errors, instead of having a flag
that gets flipped and needs to be checked, it now returns nullptr for
NextToken() when an error occurs. The Lexer's behaviour has also been
changed to only return nullptr once an error has occurred, instead of
advancing the lexing on further calls.
FMParse now checks the returned value from the lexer instead of
testing the error flag on the parser object. For any operation that
might cause the error state of the parser to change, i.e. consuming a
token, an error check has been added. In the event this check fails
the related function returns nullptr. This will cause the parse to
short circuit and exit.
BUG=pdfium:814
Change-Id: I669012c4732c18d13009be7cd7bf1ae682950904
Reviewed-on: https://pdfium-review.googlesource.com/8950
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This is to aid with debugging, since the getting
things like the type is a pain due to it being a enum.
Bug:
Change-Id: I89bae7103b476d7fd09ba78699367a1a413ee700
Reviewed-on: https://pdfium-review.googlesource.com/9190
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
The CFGAS_FontMgr is being provided to the CSS style selector in order
to pas it to the RulesCollection. The RulesCollection does not use the
font manager so remove the font manager from the CSS code.
Change-Id: I61a4a5060053615935902cb31fbc12d9856acded
Reviewed-on: https://pdfium-review.googlesource.com/9270
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
XFA_FM_KeywordToString is no longer used, and there are no plans to
use it in the future, so should be removed.
Bug:
Change-Id: I44652a40f6396b25262f840c42036fb00a14aca1
Reviewed-on: https://pdfium-review.googlesource.com/9210
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The TagProvider is only used in CXFA_TextParser. This CL moves the code
to a private inner class and renames to TagProvider.
Change-Id: Idd1926250fc59592cc923fde9ec6f8750cb10abf
Reviewed-on: https://pdfium-review.googlesource.com/9231
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Iaa34127aaf616a0a7bdf7ccc8f8f001d34abcca1
Reviewed-on: https://pdfium-review.googlesource.com/7371
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This CL removes the pattern used in the lexer of passing the lexing
member variables around as args to methods. Instead it uses the fact
that they are member variables in the methods.
This CL also includes renaming of variable and function names to
remove unneeded details or make them more precise.
BUG=pdfium:814
Change-Id: Id4c592338db9ff462835314252d39ab3b4b2b2ab
Reviewed-on: https://pdfium-review.googlesource.com/8850
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The existing methods had either very bare passive or in some cases
misleading names, so this CL changes them active names that describe
what they do. This also extracts the IsKeyword method into a helper
function since it is actually static.
BUG=pdfium:816
Change-Id: I47a113bc9ea8d88a77822a4441266ec56e6b4cbc
Reviewed-on: https://pdfium-review.googlesource.com/8730
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Throughout the lexer there is use of a pattern where a character is
extracted from the location currently being pointed at in the input
and tests are done on this value. This is uneeded, since normally the
pointer isn't being modified while the character is stored, so the
pointer can be dereferenced directly.
This CL also cleans ups the implementation of string extraction from
the input to be easier to read, since it did depend on the character
being extracted to work. The IsFooCharacter methods are also
changed to take in a character instead of a pointer, since they are
only testing the character value not the pointer.
BUG=pdfium:814
Change-Id: I8eda01e0af59ff1f6c6e97d6fb504856c7a08a24
Reviewed-on: https://pdfium-review.googlesource.com/8690
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
There currently exists a weird split where some files exist in xfa/fxfa
and some files exist in xfa/fxfa/app. This CL removes the app/ folder
and moves all files up to the parent directory.
Change-Id: I00c87851a1ebc5a7a636eb9a17b58ba3f1708a84
Reviewed-on: https://pdfium-review.googlesource.com/8810
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Since there is no guarantee of termination if the StringC was
extracted from a snippet of another string. Make it more obvious
that things like
strlen(str.unterminated_c_str())
might be a bad idea.
Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2
Reviewed-on: https://pdfium-review.googlesource.com/8170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
PDFium doesn't strip BOMs during parsing, but we should strip BOMs when
retrieving parsed strings in CPDF_NameTree to ensure consistency and
appropriate function behavior. See the bug for more info.
As outlined in Bug=pdfium:593, the solution is to call GetUnicodeText()
instead of GetString(). I added a GetUnicodeTextAt() function in
CPDF_Array, which is symmetrical to GetUnicodeTextFor() in
CPDF_Dictionary.
I then changed the input variable types to CPDF_NameTree functions to
be CFX_WideString instead of CFX_ByteString, and modified all the
calls to them.
I also added a unit test for nametree, which would fail prior to this
change. Nametrees with non-unicode names are already tested by embedder
tests.
Bug=pdfium:820
Change-Id: Id69d7343632f83d1f5180348c0eea290f478183f
Reviewed-on: https://pdfium-review.googlesource.com/8091
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
|
|
This makes the lexer stricter on valid characters for identifiers, and
conform to the grammar in the FormCalc spec. This should remove a
class of inputs that ClusterFuzz is attempting that are breaking later
stages of the transpile.
BUG: chromium:736234, pdfium:783, pdfium:784
Change-Id: I3987d6778a82b71d768fa751035993c0af2577ee
Reviewed-on: https://pdfium-review.googlesource.com/8010
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
These files were originally renamed thinking they'd move with the
colour class up to core/. It was decided that CPWL_Color was a better
core colour class the the xfa colour so these are being renamed back to
XFA based names to make it clear where they live.
Change-Id: Ie89f2306be0609add29bd445e719567e7b439211
Reviewed-on: https://pdfium-review.googlesource.com/7754
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL renames CFX_Color to CXFA_Color. The class has some XFA specific
things like shadings and patterns in it and doesn't make sense as the
colour base class.
Change-Id: I1d2230b9f03a1017777ce673419926429b769e7c
Reviewed-on: https://pdfium-review.googlesource.com/7752
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Ic81df89078241c75ae2da6309b22022ba225100f
Reviewed-on: https://pdfium-review.googlesource.com/7370
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Cleanup of code I changed earlier last week, to match the style
recommended in later reviews and make it more readable.
BUG=pdfium:786
Change-Id: I2ff8b980a229718e389ad1a8063bd5059aedb66c
Reviewed-on: https://pdfium-review.googlesource.com/7212
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
BUG=pdfium:786
Change-Id: I7a852566cdde301ee896c12d9d29043047c31ad4
Reviewed-on: https://pdfium-review.googlesource.com/7211
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=pdfium:786
Change-Id: I0779dccb6db0e6ea3933279914153ef7961d9a5b
Reviewed-on: https://pdfium-review.googlesource.com/7152
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
BUG=pdfium:786
Change-Id: I84f4012b5225f81df604fcc6e0836ac5d19f1414
Reviewed-on: https://pdfium-review.googlesource.com/7153
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
- Simplify if (cond) return true; return false; pattern.
- Use size_t in CXFA_FFDocView::RunCalculateRecursive().
Change-Id: I1c426556bc927a118cb062999812ab06bbfcfec7
Reviewed-on: https://pdfium-review.googlesource.com/7130
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The bool returned by Start was not being used and the method was always
called right after the constructor, so it should be in the constructor.
Change-Id: I98abf9f7c11fbe42b3aa15ec5e46731198aa23d5
Reviewed-on: https://pdfium-review.googlesource.com/7151
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Removing hand rolled hash table and binrary search.
BUG=pdfium:786
Change-Id: Iac18f02c9f560f484b974762474dbb51597d2353
Reviewed-on: https://pdfium-review.googlesource.com/7092
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|