summaryrefslogtreecommitdiff
path: root/xfa/fxfa
AgeCommit message (Collapse)Author
2018-06-01Rename CPDFXFA_Context::GetTimerMgr() to NewTimerMgr()Tom Sepez
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>
2018-06-01Clean up some issues found in CXFA_TextLayoutRyan Harrison
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>
2018-06-01Return unique_ptr from CPDFXFA_Context::GetTimerMgr()Tom Sepez
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>
2018-06-01Remove ununused startAngle and sweepAngle variablesRyan Harrison
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>
2018-05-29[xfa] Propagate the xfa change data for text to JS and back.Dan Sinclair
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>
2018-05-29Get rid of FXARGB_MAKE macro.Lei Zhang
ArgbEncode() does the same thing. Change-Id: Ibb05ed4aae720c0a5ba66771699c0d7e11230921 Reviewed-on: https://pdfium-review.googlesource.com/32230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-25Replace some #ifdefs PDF_ENABLE_XFA, part 2.Tom Sepez
Tidy some code encountered along the way in cpdfsdk_helpers.cpp Remove one ifdef from xfa-only file. Restore some option flag processing (probably wrong to remove). Flip some #ifndef to #ifdef (#ifndef PDF_ENABLE_XFA is an anti-pattern and should be treated with suspicion since XFA should always be "additive"). Change-Id: I564a28401e20e6269c85ea610da8c96f8c8dd737 Reviewed-on: https://pdfium-review.googlesource.com/32834 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-25[xfa] Generate CXFA_EventParam.newText dynamicallyDan Sinclair
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>
2018-05-25[xfa] Add missing xfa.event.cancelAction propertyDan Sinclair
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>
2018-05-24Improve constness for more CPDF_Objects pointers.Lei Zhang
Most of them can be marked const. A couple are marked non-const because eventually something inside gets modified. Change-Id: I5415ca8d1efdac451cde340272436cd1e6ec433f Reviewed-on: https://pdfium-review.googlesource.com/32184 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-22Fix spaces too wide in XFA Dropdown.Henrique Nakashima
CFGAS_PDFFontMgr::GetCharWidth() is only used for spaces, for no good reason I could find. It's broken in this case too, returning a default value of 600 for any character. This CL removes this method and its only usage that led to finding this issue. Bug: pdfium:1083 Change-Id: I954de45101715b5af05169612fb5eca1b1a170b4 Reviewed-on: https://pdfium-review.googlesource.com/32740 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-18Fix issues with XFA font loadingRyan Harrison
This fixes two partially interrelated bugs with font loading in XFA documents. First, it adds falling back to the builtin fonts if there are no viable embedded or installed font for the top-level XFA font manager. Additionally it changes the load font code path in CXFA_FWLTheme to use the top level XFA font manager, instead of the one that just handles the system installed fonts. The main visible issue that this patch fixes is that currently using --font-dir with pdfium_test on a XFA PDF can cause text to not be displayed in widgets and/or NOTREACHED asserts. This occurs if there isn't a needed fonts embedded in the document or in the font directory, since currently PDFium will not correctly fall back to the builtins. BUG=pdfium:1008,pdfium:1020 Change-Id: I451a8aede63d639e401c0cc076443e61d8b7a2f8 Reviewed-on: https://pdfium-review.googlesource.com/32730 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-17Make CXFA_LayoutProcessor an UnownedPtr in CXFA_FFDocViewDan Sinclair
The LayoutProcessor is owned by the CXFA_Document. Make the ownership explicit with an UnownedPtr. Change-Id: I100af9e2e029e0a5db4ee365e11977016ffdcd70 Reviewed-on: https://pdfium-review.googlesource.com/32670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-17Add comment about cleaning binding nodesDan Sinclair
The reason for calling ReleaseBindingNodes() has changed but the code comment hadn't. This CL updates the code comment to make it clearer why this release has to happen. Change-Id: I0c08c7580ef7c8508cd4db7b8930d5f2cd595b1b Reviewed-on: https://pdfium-review.googlesource.com/32690 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-17Update third_party/base/compiler_specific.h.Lei Zhang
Import Chromium's base/compiler_specific.h from r537069. Now that FALLTHROUGH is available via compiler_specific.h, remove FX_FALLTHROUGH. Change-Id: I8b9631a4f007673e10e0c26951dfd61e9dcada30 Reviewed-on: https://pdfium-review.googlesource.com/32639 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-16Convert Formcalc ToJavascript to a pointer WideTextBufDan Sinclair
This CL converts the WidetextBuf reference to a pointer in the formcalc ToJavaScript methods. Change-Id: Ia05c7255a99a2eaa3d9a57f77580969896ad90a0 Reviewed-on: https://pdfium-review.googlesource.com/32612 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-14Use internal wcstof instead of system wcstod in formcalc lexerDan Sinclair
This CL switches the usage of wcstod to use the FXSYS_wcstof to determine if a given string is a valid floating point number. Using the internal method makes linux slightly slower (10's of ms) makes mac a lot faster 900ms to 60ms for the test case in the bug. The FXSYS_wcstof method has been extended to handle the parsing of float exponents. Unittests were added for FXSYS_wcstof. Bug: chromium:813646 Change-Id: Ie68287a336e3b95a0c0b845d5bf39db6fc82b39c Reviewed-on: https://pdfium-review.googlesource.com/32510 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-10Cleanup formcalc method generationchromium/3427Dan Sinclair
This CL simplifies the FormCalc method call generation when converted to JavaScript. Currently we output the same chunk of code to run the given method on an array or object per method call. This CL pulls out the common execution code to a pfm_method_runner function which is used instead. An embedder test has been added to verify that method invocation from formcalc works correctly. Bug: chromium:814848 Change-Id: I1ec052eab051053fedcb464d57e0e15228b8c5a2 Reviewed-on: https://pdfium-review.googlesource.com/32372 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-10Clean up post review commentsRyan Harrison
Cleaning up some nits that came in after my previous codec CL had gone into the CQ. BUG=pdfium:1080 Change-Id: I3845136d370f73c9c96ef732e95b8cf0c9c79d91 Reviewed-on: https://pdfium-review.googlesource.com/32351 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-10Do not build BMP when codec is disabledRyan Harrison
Currently all of the BMP related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the BMP codec code if support for BMP is turned off. BUG=pdfium:1080 Change-Id: I56d40639a5a3631f9c601a1eef3f98873feac94f Reviewed-on: https://pdfium-review.googlesource.com/32370 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-10Change formcalc javascript method outputDan Sinclair
This CL changes the formcalc JS conversion code so that method calls no longer generate exponential amounts of JavaScript. Previously we'd duplicate the code to call into a method twice. This would then generate twice once for arrays and once for other types of object. This CL changes the code to wrap the actual method call into a JavaScript function which will be used from both the array and non-array calling code. For the referenced bug, the generated JS originally needed a buffer of 365meg to generate. With this CL, it needs a buffer of 7.5k. Bug: chromium:814840 Change-Id: Ibb5993fa52b7c13b20b325cf8848a306f82ae014 Reviewed-on: https://pdfium-review.googlesource.com/32312 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-09Do not build GIF when codec is disabledRyan Harrison
Currently all of the GIF related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the GIF codec code if support for GIF is turned off. This also catches a few missed cases from previous CLs. BUG=pdfium:1080 Change-Id: Ie7fe2d894d2ae2f8f36ae05e0ff256f2ce6ef8d4 Reviewed-on: https://pdfium-review.googlesource.com/32330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-09Do not build PNG when codec is disabledRyan Harrison
Currently all of the PNG related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the PNG codec code if support for PNG is turned off. BUG=pdfium:1080 Change-Id: I9c5247145fcadbcb1bd2243aa83350304ba421ff Reviewed-on: https://pdfium-review.googlesource.com/32270 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-09Do not build TIFF when codec is disabledRyan Harrison
Currently all of the TIFF related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the TIFF codec code if support for TIFF is turned off. It also fixes cases in the code base where tif was being used instead of tiff. BUG=pdfium:1080 Change-Id: If6aaa8af5160fdd5b261e63bab7d5984196efcc9 Reviewed-on: https://pdfium-review.googlesource.com/32193 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-05-08[fm2js] Create fewer CFX_WideTextBuf classesDan Sinclair
This CL modifies the formcalc transpiler to create less CFX_WideTextBuf classes as we convert to JavaScript. This can take some pathalogical formcal from 20sec to convert to .5sec. Bug: chromium:834575 Change-Id: I428883297bbc3a6a325a4ab0ad51834f2f02ab82 Reviewed-on: https://pdfium-review.googlesource.com/32154 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-08[fm2js] Fail transpiling if lexer has left over dataDan Sinclair
If there is remaining data after the lexer has said it's complete then something has gone wrong while lexing the formcalc data. This CL changes the transpiler to return an error in the case of the lexer havign extra data. Bug: chromium:834575 Change-Id: I8a1288a7f01cc69faf2033829d68246d815258de Reviewed-on: https://pdfium-review.googlesource.com/32130 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-07Restore logic of CreateChildUIAndValueNodesIfNeeded().Henrique Nakashima
CreateUIChild() was changed and renamed to CreateChildUIAndValueNodesIfNeeded() in: https://pdfium-review.googlesource.com/c/pdfium/+/24390 This caused some bugs but it's too far back for a rollback. This cl restores the logic of CreateUIChild() keeping the new signature. Bug: chromium:838994 Change-Id: I44ce741fdb90f8b0fd11379b5e881e376c307f0c Reviewed-on: https://pdfium-review.googlesource.com/32090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-03Use pointers instead of refs in CXFA_TextLayout params.Henrique Nakashima
Change-Id: Iaca5983f080d8a05d2d4e9f79c335c4ebcdc6899 Reviewed-on: https://pdfium-review.googlesource.com/31994 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-03[xfa] Verify we can get a font manager before setting up XFADan Sinclair
When setting up an XFA document we need to create a font manager. That font manager requires the CFGAS_FontMgr to be provided, and ASSERTs to that fact. It's possible for the CFGAS_FontMgr to be nullptr if we fail to enumerate the system fonts. This CL verifys we can get the needed manager and fails out of the XFA OpenDoc method if we have no font manager. Bug: chromium:835693 Change-Id: I806f265075dcc355e0a7aeb4b3ae8eb950aa5eee Reviewed-on: https://pdfium-review.googlesource.com/32052 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-03[xfa] Verify field count before accessingDan Sinclair
When processing items for layout it's possible for the iBlockIndex*3 value could be larger then the field split count. If this is the case we'll walk off the end of the split array. This CL verifys that we have enough data before attempting to walk the splits and returns early if we don't have enough data. Bug: chromium:837585 Change-Id: I534298b4ee354ce079442d893202f811431155a0 Reviewed-on: https://pdfium-review.googlesource.com/32051 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Use pointer instead of ref for XFA_RectWithoutMargin param.chromium/3418Henrique Nakashima
Removed many null checks since XFA_RectWithoutMargin already checks if the margin is null internally. Change-Id: I21f5101fe38559eb02f4c3aaf081ff29ce293e47 Reviewed-on: https://pdfium-review.googlesource.com/31993 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Use pointer instead of ref for CXFA_Box::GetPathArcOrRounded param.Henrique Nakashima
Change-Id: I1bfada610b8bf2e1f8e0f79a9421db9ebedc7311 Reviewed-on: https://pdfium-review.googlesource.com/32010 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Use pointers instead of refs for GetPopupPos() params.Henrique Nakashima
Change-Id: Ic19b91f91f08b1867437b22de04a2c54045ce8ae Reviewed-on: https://pdfium-review.googlesource.com/31992 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Pass DPI as CFX_Size in XFA_DrawImage.Henrique Nakashima
Change-Id: Ifbcb727402c1c28a6e8abe02511d6da6828c02f7 Reviewed-on: https://pdfium-review.googlesource.com/31915 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Cleanup XFA document properly on failed loadDan Sinclair
When we fail to parse an XFA document we would free the XML document that is created immediately. This causes issues because the XML nodes may have been set into the CXFA_Document already. This CL changes ParseDoc to always save the XMLDocument and then triggers the CloseDoc() logic if the ParseDoc method fails. This should properly cleanup any resources on a failed document load. Bug: chromium:837578 Change-Id: I8af7e6e34e3b756455c58ea50b22af414ffa6cbf Reviewed-on: https://pdfium-review.googlesource.com/31710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Add a CFX_XMLDocument class.Dan Sinclair
This CL adds a CFX_XMLDocument to act as the XML node container. All nodes are now owned by the document and the document is returned by the CFX_XMLParser. Classes which parse XML files now store the document instead of the root node. BUG: chromium:835636 Change-Id: I1e07d6115cf14714911d6fd4c3fa920c94fd5faf Reviewed-on: https://pdfium-review.googlesource.com/31313 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-02Remove out params from CalculateAccWidthAndHeight. Return CFX_Size.Henrique Nakashima
Change-Id: I1088abd4ce8f6276043213218867c4d6fb0a46a9 Reviewed-on: https://pdfium-review.googlesource.com/31914 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Remove int out params from reference to pointer in CXFA_Node.Henrique Nakashima
Return a CFX_Size instead. Change-Id: I3bef1093fbc887237aa69dc942f878af27b4e8e9 Reviewed-on: https://pdfium-review.googlesource.com/31911 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-01Transform float out params from reference to pointer in CXFA_Node.Henrique Nakashima
Change-Id: I4039917c5342f6a4c6568029a293066901bb5db4 Reviewed-on: https://pdfium-review.googlesource.com/31870 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-01Transform size out param from reference to pointer in CXFA_Node.Henrique Nakashima
Change-Id: I3ed6cbadeb9da756b30634b48ffdd1026a70b8a0 Reviewed-on: https://pdfium-review.googlesource.com/31853 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-01Transform rect out param from reference to pointer in XFA code.Henrique Nakashima
Change-Id: Ib5f8b8754bca8198d9122700d7d876b45d1428da Reviewed-on: https://pdfium-review.googlesource.com/31852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Fix last character missing from strings in XFA Month Calendar.Henrique Nakashima
This was a bug introduced in a refactor a long, long time ago. A line was removed (probably unintentionally). https://chromiumcodereview.appspot.com/2435603003/diff/40001/xfa/fxfa/app/xfa_fwltheme.cpp Bug: pdfium:751 Change-Id: I0e3d094a543bd0e31010a8093387906d62c0a5dc Reviewed-on: https://pdfium-review.googlesource.com/31830 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Fixes XML Instruction handling in CXFA_DocumentParser.Dan Sinclair
This CL fixes issues with handling XML instructions in CXFA_DocumentParser. Unittests were added to verify the behaviour. Change-Id: Iff8d51d0e6d411419473c9b2c32c700d4bbf86f5 Reviewed-on: https://pdfium-review.googlesource.com/31810 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Fix focused day disappears in XFA MonthCalendar.Henrique Nakashima
Bug: pdfium:751 Change-Id: I27c4cf96c1b0d314ace8461ca6020c1034eff646 Reviewed-on: https://pdfium-review.googlesource.com/31650 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Add DEPS include_rules for xfa/fwl.Lei Zhang
BUG=pdfium:507 Change-Id: I28eeb9a5f6d7099eef6d8e7e37d425cd4613c49c Reviewed-on: https://pdfium-review.googlesource.com/31430 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-26Replace some c-style cast with static_cast<>Tom Sepez
Change-Id: I9dd6a36770f77f3df6c4395572785d37402eadc2 Reviewed-on: https://pdfium-review.googlesource.com/31350 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-25Replace reinterpret_cast with static_cast where possibleTom Sepez
Change-Id: Ic62f1def8e043494c9fa6c08a937d7d872513567 Reviewed-on: https://pdfium-review.googlesource.com/31314 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-25Use local for return value in factory methodRyan Harrison
Follow requested in review after submit. BUG=chromium:835608 Change-Id: I958a35f1cdaadbdb21e7c86b8c5b297ef01a2503 Reviewed-on: https://pdfium-review.googlesource.com/31316 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-25Allow failing to build CFXA_FWLTheme if unable to load fontsRyan Harrison
The current implementation of this class potentially does a lot of work in the constructor. Specifically when getting a calendar font it might cause the whole font loading pipeline to run. This can fail if it is unable to load fonts. Breaking out the font loading part, so that the factory method can return nullptr if it fails. Additionally adding a guard for the case the font manager fails to load, which is the root cause of the crash in the bug. BUG=chromium:835608 Change-Id: I05b987aaad6f0814907066904331610a7fbb7f70 Reviewed-on: https://pdfium-review.googlesource.com/31330 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-24Switch declaration order to prevent UAFRyan Harrison
This is occuring when the variables go out of scope, due to C++s first in, last out destruction policy. BUG=chromium:808333 Change-Id: I44f37520a22720bc23df4c8a72ff73994c37eea1 Reviewed-on: https://pdfium-review.googlesource.com/31278 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>