summaryrefslogtreecommitdiff
path: root/xfa
AgeCommit message (Collapse)Author
2018-03-07[formcalc] Consider width along with depth of treeDan Sinclair
When building the formcalc parser trees we need to limit on width along with depth. It's possible to generate a tree of a single depth but is more then 20k nodes wide. This will eventuall cause stack overflow issues. This CL re-uses the depth check for the grammar expressions in which we're extending the width of the tree we count that against our depth check. Bug: chromium:813346 Change-Id: I01f6567a75776a75374465eacc1ff546db46cac1 Reviewed-on: https://pdfium-review.googlesource.com/28170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-07[formcalc] Handle bad elseif conditionalschromium/3365Dan Sinclair
This Cl adds checking for the conditionals of if and elseif expressions. If the conditional fails to parse we should return nullptr. This already happens by accident in the if() case, but with elseif() conditions we'll fail the ASSERT in the CXFA_FMIfExpression constructor and crash. This CL explicitly checks for the expressions and early exists if they failed to parse. Bug: chromium:819509 Change-Id: I9a90182c7709c8c4c0d3ae17d6be67cb668c0c6a Reviewed-on: https://pdfium-review.googlesource.com/28131 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-06Remove axial gradients from XFA widgets.Henrique Nakashima
Most of the CPU time when moving around XFA forms is spent rendering these gradients. Bug: chromium:592748 Change-Id: I08c68c60996755a2be25243dfd2143b6cbb13af9 Reviewed-on: https://pdfium-review.googlesource.com/28090 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-06Rename IFX classes in core/fxge to Ifacechromium/3364Dan Sinclair
This CL renames IFX classes in core/fxge to Iface. Change-Id: I137167ddd4ff1563d8002d9501222c27183408cc Reviewed-on: https://pdfium-review.googlesource.com/27990 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-06Rename core/fxcrt IFX files to IfaceDan Sinclair
This CL renames the 3 IFX files in core/fxcrt to Iface instead. Change-Id: I7cee6836650b71bc5c5729a8147fda62f0910fe3 Reviewed-on: https://pdfium-review.googlesource.com/27970 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-06[formcalc] Allow empty declaration bodiesDan Sinclair
This CL removes the checks for empty declaration bodies. Change-Id: I06a8f602f49d7709bce86442cae2d38991fa5d82 Reviewed-on: https://pdfium-review.googlesource.com/27950 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-05[formcalc] Simplify function signature parsingchromium/3363Dan Sinclair
This CL refactors the signature parsing for formcalc functions. Change-Id: I69634968ab1cbd9698a3ce3ae321e14bafe918c6 Reviewed-on: https://pdfium-review.googlesource.com/27930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-05[formcalc] Cleanup m_error handlingDan Sinclair
This CL cleans up the setting of m_error. In most cases we don't need to set m_error it will be set when we bubble up the nullptr return from the various parse methods. The m_error was set inconsitently previously and was confusing on if it needed to be set or not. Change-Id: I8648b6296ef15239bd2663e6543a960b88177721 Reviewed-on: https://pdfium-review.googlesource.com/27910 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-05Cleanup CFWL_ScrollBar::Timer::Run.Henrique Nakashima
Change-Id: Icd76a6a98a66c977e45ed82663b68f6b05479e76 Reviewed-on: https://pdfium-review.googlesource.com/27891 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-03-05Fix crash when dragging scrollbar in XFA form.Henrique Nakashima
Bug: chromium:809612 Change-Id: I171d836927fc707388444726d3918b2cbbb39002 Reviewed-on: https://pdfium-review.googlesource.com/27890 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-27Move XFA pixel tests under pixel/chromium/3358chromium/3357Ryan Harrison
This removes the need for them to have their own runner. Due to other upstream changes some of the expectation files needed to be updated. The suppressions have been updated to make sure the tests do not run for non-XFA builds. Having these tests run on the bots surfaced an MSAN issue in the XFA code, which is fixed in this CL. BUG=pdfium:1020,pdfium:1008 Change-Id: I44e2fa1cba2d07f30f56f5792749acbe1ebf4b62 Reviewed-on: https://pdfium-review.googlesource.com/27710 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-02-26Shrink some tables and kill dead code in xfa.Tom Sepez
Change-Id: Ic1260417e7d1475dd518655b2ab08f0184955d88 Reviewed-on: https://pdfium-review.googlesource.com/27170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-26Get rid of some static variables.Tom Sepez
These are generally cheap enough to compute as needed, rather than keeping around in memory all the time (plus the memory for the static flag the compiler generates to check if initialized). Change-Id: If3a5365521f6a7781e66fb11f04883a5c673ee11 Reviewed-on: https://pdfium-review.googlesource.com/27150 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-26Add some more missing consts.chromium/3356Tom Sepez
Get things out of the .data section. Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683 Reviewed-on: https://pdfium-review.googlesource.com/27130 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-22[formcalc] Cleanup function handlingDan Sinclair
This CL creates a CXFA_FMAST root for the AST tree instead of overloading the CXFA_FMFunctionDefinition. This Removes the m_global from FunctionDefinition and simpifies the code. Change-Id: I9347769a291ef1753539701f334cc8dd69b7187e Reviewed-on: https://pdfium-review.googlesource.com/27590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-22Jumbo fixesDan Sinclair
Change-Id: I5b81a483c57b97598a0d36ceaebc382016e95ae3 Reviewed-on: https://pdfium-review.googlesource.com/27591 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-21[formcalc] Cleanup if expression parsing.Dan Sinclair
This CL simplifies the if expression parsing. The elseif construct has been split into its own list of IfExpressions and no longer gets stuffed into the elseExpression. A loop was added into the output methods for the elseif expressions, which also means we can go from having: if () { } else { if () { } else { } } to if () { } else if () { } else { } Which is a bit nicer. Change-Id: I6edf75215500d6a32a8d7218d477b6960f03de51 Reviewed-on: https://pdfium-review.googlesource.com/27571 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-21[formcalc] Add elseif expression to parser testDan Sinclair
This extends the test case for slightly more coverage. Change-Id: I97613c2d8df416b37718ff747d218dd61ea02b37 Reviewed-on: https://pdfium-review.googlesource.com/27570 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-21[formcalc] Minor parser cleanupschromium/3352Dan Sinclair
This CL makes minor clarity cleanups to the formcalc parser and attempts to record the productions each method is processing. Change-Id: Ie12bb55647abf06251d1734fd05d08a964a32ebc Reviewed-on: https://pdfium-review.googlesource.com/27550 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-21[formcalc] Use default destructorsDan Sinclair
This CL switches the empty destructors in the FormCalc expressions to use default. Change-Id: I0a2ea520c89a96d29a2e2564572a7cf345f9f31a Reviewed-on: https://pdfium-review.googlesource.com/27510 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-21[formcalc] Remove the ParseBlockExpression methodDan Sinclair
In all the places we call ParseBlockExpression we really mean to parse an ExpressionList. Using ParseBlockExpression is confusing because the formcalc grammar has a BlockExpression defined which corresponds to our ParseDoExpression. This CL converts the use of ParseBlockExpression into calls to ParseExpressionList and then builds the BlockExpression class as needed. Change-Id: Iab9b6e783f01d35df905539d4dbc20ba18a7b0f9 Reviewed-on: https://pdfium-review.googlesource.com/27470 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-20[formcalc] Remove unused expression typeDan Sinclair
The expression type is no longer used, removed. Change-Id: I4c8b17ed1644560afd7fc87a7fb6c7d893b9de5c Reviewed-on: https://pdfium-review.googlesource.com/27450 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-20[formcalc] Treat elseif and else the same during outputDan Sinclair
This CL combines the elseif and else output code for formcalc. This causes an extra set of {}'s to be output in the else case but should be syntactically the same. Change-Id: Ie30a51efadae2034d117f4bf280b9f7abc950a23 Reviewed-on: https://pdfium-review.googlesource.com/27431 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-20[formcalc] Do not convert if to an identifierDan Sinclair
The if token in formcalc is an internal keyword and can not be used as an identifier. The current if parsing code will turn if into an identifier if it fails to find the 'then' statement after the argument list. This should be a failed parse instead of coverting if to an identifier and resetting the lexer. Change-Id: Ieebf6a1aabc27482fcaeaf7a9bd4be40fc01e9ad Reviewed-on: https://pdfium-review.googlesource.com/27430 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-20[formcalc] Remove unused line parameterDan Sinclair
The recorded line number from the formcalc parse is never used. This Cl removes the parameter and removes the need to pass it through all of the constructors. Change-Id: Ice716cc4880dd17dc05bffcdce1dc1e4745108ea Reviewed-on: https://pdfium-review.googlesource.com/27412 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-20[formcalc] Split literal parsing to its own methodDan Sinclair
This Cl moves the code to create literals in the AST from ParsePrimaryExpression to ParseLiteral. Change-Id: I41ba20f28f1cb1d76d753c5baec790872acdf1da Reviewed-on: https://pdfium-review.googlesource.com/27411 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-20Remove extra static qualifier.Dan Sinclair
Change-Id: I11ede1eb4f984b516275f03798996e6fc34880dc Reviewed-on: https://pdfium-review.googlesource.com/27410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-20Fix typo in method name FillSoildRect().Nico Weber
No behavior change. Bug: none Change-Id: I59a40e5d38d561da1ebf20a40feb3933f7fef14a Reviewed-on: https://pdfium-review.googlesource.com/27390 Commit-Queue: Nico Weber <thakis@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-20[formcalc] The if token is a keyword and should not be made an identifierDan Sinclair
This CL removes the code from PrimaryExpression which converts the if token into an indentifier. if() is a reserved keyword and can't be used as an indentifier according to the spec. Change-Id: I5644cdbe57ef62f4089b4704e1b8d196927e68a4 Reviewed-on: https://pdfium-review.googlesource.com/27370 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-20Tighten up assignment instructions in formcalc.Dan Sinclair
The assignment operator can not be chained. This Cl removes the while loop for assignments and changes it to an if(). We also can not have an assignment inside ()'s so remove that option. Bug: chromium:779349 Change-Id: I6934e18815f843ae8241023df6c03d8bbcd8168d Reviewed-on: https://pdfium-review.googlesource.com/27350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-19Remove extraneous HasError checksdan sinclair
Duplicate checks, remove. Change-Id: Ic2f49651c50ed66328233817bc8cd24f7c9636c2 Reviewed-on: https://pdfium-review.googlesource.com/27330 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19FormCalc Assignment is not a SimpleExpressiondan sinclair
Currently the parser builds assignment statements as part of the SimpleExpression declaration. This isn't correct according to the grammar where AssignmentExpression and SimpleExpression are siblings. This CL moves the assignment calculation into the ExpExpression declaration to make it a sibling of the SimpleExpression. Change-Id: I6afac2379ab6783b84ee619863c8308ca0db454d Reviewed-on: https://pdfium-review.googlesource.com/27310 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Cleanup FormCalc inheritancedan sinclair
This CL cleans up the FormCalc inheritance. The binary and unary items all share ToJavaScript methods now. Change-Id: I7bf0978449395fa2eb90b954cf2118d7aa3f71c6 Reviewed-on: https://pdfium-review.googlesource.com/27290 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Remove base class ToJavaScript methods in FormCalcdan sinclair
This CL removes the Loop base class as it adds no functionality. Other base classes have had their ToJavaScript methods set as pure virtual and their constructors made protected. Change-Id: I5c77b8734d23c576dd52db7f72396ecdf2f7bd22 Reviewed-on: https://pdfium-review.googlesource.com/27270 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Cleanup JS generation in formcalc.dan sinclair
This CL cleans up some of the JS generation code to make it easier to see what JavaScript is begin created. Change-Id: I4265226cca0e4de400d05cc0fea3f8c76608115e Reviewed-on: https://pdfium-review.googlesource.com/27250 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Inline FormCalc method namesdan sinclair
This CL inlines the FormCalc method names instead of using a lookup array. Many of the names were only referenced once and this makes the code a lot simpler to read. Change-Id: Ib80f5bfa0097e4f1bad232e7de452f067db2a758 Reviewed-on: https://pdfium-review.googlesource.com/27211 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Inline some formcalc identifiersdan sinclair
This CL inlines the RUNTIMEFUNCTIONRETURNVALUE and EXCLAMATION_IN_IDENTIFIER defines to make the output code easier to read. Change-Id: I4a86da2aefc75ff137d9a7cff0351515b275f1b1 Reviewed-on: https://pdfium-review.googlesource.com/27230 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Merge FormCalc to JavaScript methodsdan sinclair
This CL merges the ToJavaScript and the ToImpliedJS methods in the FormCalc expressions. The type of return is passed as a paramter to ToJavaScript. Change-Id: Idff83677bc70b964d95aa6ff6b0e2c1bf8c603ea Reviewed-on: https://pdfium-review.googlesource.com/27210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-19Simplify CXFA_FMToken creationdan sinclair
This CL converts the CXFA_FMToken usages into an object instead of a pointer. A copy constructor has been added. The line number was removed from the token and is retrieved from the lexer where needed. Change-Id: I94c632653e9bf1439d2ddf374a816ae0d10b5b67 Reviewed-on: https://pdfium-review.googlesource.com/27192 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-19Skip font loading in formcalc embedder testsdan sinclair
This CL changes XFA to skip font loading for embedder tests. This takes the runtime for the CFXJSE_Formcalc_ECFXJSE_FormCalcContextEmbedderTest run from ~25sec to ~5sec. Change-Id: If9989c5a3474cccd3915ec3f5c178d7af48aae37 Reviewed-on: https://pdfium-review.googlesource.com/27191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-19Simplify formcalc token listdan sinclair
The keyword list in the formcalc lexer is only used to match identifiers. We don't need to store the non-identifier tokens in the list, so they're removed. The hash is removed and the list is compared by string instead. The token names have been moved to DEBUG so they won't be included in Release builds. Change-Id: Ieec00e9944960e559079083a605e3249c4128841 Reviewed-on: https://pdfium-review.googlesource.com/27190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-16Avoid 100 blank FX_FONTDESCRIPTOR entries.Tom Sepez
Change-Id: Ibaf53ee27eefc692ac4f002c3ab28b7738676b31 Reviewed-on: https://pdfium-review.googlesource.com/26991 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-16m_pEnumerator only ever has one value, indirection not needed.Tom Sepez
Change-Id: Ic1d63e8ef54a820b01d67dbf1dd6f6f72a06b77c Reviewed-on: https://pdfium-review.googlesource.com/26990 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-16Fix fallthroughs in XFA code.chromium/3350Henrique Nakashima
Change-Id: I1fd4bf85cd709de1c14ed2895d045018f79bc61f Reviewed-on: https://pdfium-review.googlesource.com/26950 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-15Make the CFX_XMLNode a MaybeOwned pointerDan Sinclair
This CL removes the HasOwnXML flag from the CXFA_Node objects and instead uses a MaybeOwned pointer to keep track of the XML nodes. Change-Id: Ie678258247ec21ecb15c639647b189e140586d25 Reviewed-on: https://pdfium-review.googlesource.com/26811 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-15Add limit to number of formcalc expressionsDan Sinclair
Currently it's possible to create a formcalc script which creates a large number of expressions. This will eventually cause stack exhaustion as we try to allocate the needed expression objects. This CL limits the number of parsed expressions in the PostExpression section in order to keep from failing due to stack overflow. Bug: chromium:799721 Change-Id: I69fca35db7f75ef97aec21c22fc06d926dfe2df6 Reviewed-on: https://pdfium-review.googlesource.com/26870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-14Set node to owning elementDan Sinclair
When the document creates anew data root element it assigns it into the CXFA_Node but fails to set that node as owing the XML node. The XML node is never inserted into another XML tree so it ends up being leaked. This CL sets the CXFA_Node to own the XML data tree node so it will be cleaned up properly. Bug: chromium:807863 Change-Id: I72a1b8f7b1f1a50bf7139d8bd0ecc8e504ccfc91 Reviewed-on: https://pdfium-review.googlesource.com/26790 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Cleanup some CXFA_Node flags and methods.Dan Sinclair
This CL removes one unused flag and inlines the check for if the node has an owned XML node. Change-Id: Id750192b37f09901a81e2faaa929a81d2262d4c7 Reviewed-on: https://pdfium-review.googlesource.com/26770 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Cleanup CXFA_Node::SetFlagDan Sinclair
The SetFlag method has a signature of (flag, bool) which, looking at the callsites makes you think it will set the flag to the boolean. This isn't what happens, the flag is always set to true and the boolean decides if we execute some notification code. This CL splits SetFlag into SetFlag(flag) and SetFlagAndNotify(flag) to make it a lot clearer what is happening. Change-Id: I3e067c87532cce10b94bda10cc88feb62b948eb0 Reviewed-on: https://pdfium-review.googlesource.com/26750 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Cleanup CXFA_Document const-nessDan Sinclair
This CL marks methods const where possible and removes redundant methods from CXFA_Document. Change-Id: I34804425469dfd52469daba68f64a4b511e5d4d0 Reviewed-on: https://pdfium-review.googlesource.com/26730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>