summaryrefslogtreecommitdiff
path: root/xfa
AgeCommit message (Collapse)Author
2018-07-03Use more UnowendPtr<> in cfgas_formatstring.h and cfx_break.hTom Sepez
Move initializers to .h file (proves none missing). Change-Id: Iff8fe76e46634aa32a32ecd592476594a9d1bafa Reviewed-on: https://pdfium-review.googlesource.com/36950 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-07-03Use UnownedPtr<> in cfwl_notedriver.hTom Sepez
Re-order owned/unowned references to obey lifetime constraint. Change-Id: I589746b3c2e7d8c45d26d63d09eef977b095226d Reviewed-on: https://pdfium-review.googlesource.com/36970 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-03Use UnownedPtr<> in cfwl_messagekillfocus.hTom Sepez
Also make private member along the way. Change-Id: I08a006a1bcca4e8ca21834dfda695a2d77d0a431 Reviewed-on: https://pdfium-review.googlesource.com/36930 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-03Use UnownedPtr<> in cfwl_scrollbar.h and cfwl_themebackground.hTom Sepez
Change-Id: Ib65197a9cd9de173de8e77db168dcfbb43669022 Reviewed-on: https://pdfium-review.googlesource.com/36911 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-03Use UnownedPtr<> in cxfa_{ffwidgethandler,imagrenderer,loadercontext}.hTom Sepez
Change-Id: I25496c9792a99ca27d2ab84c267770ff941cf921 Reviewed-on: https://pdfium-review.googlesource.com/36912 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-07-03Use more UnownedPtr<> in cfxa_ffpageviewTom Sepez
Change-Id: Ifdb9fb23d61082b7c1b9b93c057e0881959cea2a Reviewed-on: https://pdfium-review.googlesource.com/36530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-03Remove XFA_LAYOUT_INVALIDNODETom Sepez
XFA_LAYOUT_INVALIDNODE is used in place of nullptr, but does not appear to represent a sentinel value distinct from it. Using a non-nullptr value prevents using any kind of smart pointer type in the future. Change-Id: Iab6418b3dc9c3d45780730795496ac07b67de696 Reviewed-on: https://pdfium-review.googlesource.com/36651 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-07-02Comment some raw pointers that cant become UnownedPtr<>.Tom Sepez
These appear in compile-time const data. Adding the comment makes it easier to see what work remains when using grep. Change-Id: Ibb5fe920dc9fc99dd4c866f9ddf800a58f6a67a8 Reviewed-on: https://pdfium-review.googlesource.com/36690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-02Use UnownedPtr<> in cfwl_event.h and cfwl_message.hTom Sepez
Change-Id: I1981eb23006db203e845e954a7847cfa992d5e03 Reviewed-on: https://pdfium-review.googlesource.com/36710 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-29Use UnownedPtr<CXFA_Node> or comment raw pointers as tree nodes.chromium/3479chromium/3478Tom Sepez
Part 2. Change-Id: I26fe434dac3c3f5186414440acc2a495a5f14091 Reviewed-on: https://pdfium-review.googlesource.com/36670 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-29Use UnownedPtr to CXFA_Node from outside the treechromium/3477Tom Sepez
Comment raw pointers subject to nondeterministic tree destruction order as such to avoid re-attempting to convert to the unowned mechanism. Change-Id: Ia9fe3c8a2729dc1e2b1de4a8c62ae3d2c3d7ec0a Reviewed-on: https://pdfium-review.googlesource.com/36635 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-29Use more UnownedPtr<> in cxfa_ffwidgetTom Sepez
Change-Id: Iae962711f522ad52e77f19201d00d9ab86096ca4 Reviewed-on: https://pdfium-review.googlesource.com/36510 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-27Remove CXFA_FField::UnloadWidget().Tom Sepez
It is only called during the destructor, and does things that the destructor would automatically do, like calling into the superclass. So just use destructors. Change-Id: I1196817798eeca99914b44ddee1f75781e682211 Reviewed-on: https://pdfium-review.googlesource.com/36231 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-27Use unowned ptr for IFWL_ delegatesTom Sepez
Change-Id: I1e9059242dad254394b73c6fddb010b182e969f0 Reviewed-on: https://pdfium-review.googlesource.com/36230 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-26Assert that tab width assumption holds in CFX_RTFBreak.Henrique Nakashima
Bug: chromium:844367 Change-Id: I3cbe5d97a913c734c3d54657a2fb47b30cc362fe Reviewed-on: https://pdfium-review.googlesource.com/36191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-26Fix Integer-overflow in CFX_RTFBreak::AppendChar_TabHenrique Nakashima
Bug: chromium:844367 Change-Id: Id8185ea0219c03b4f8683362a3c2a45d481a5cfb Reviewed-on: https://pdfium-review.googlesource.com/36170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-22Avoid some duplicate const/non-const getters.Tom Sepez
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>
2018-06-21Clean up constant values for JS alert and beepRyan Harrison
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>
2018-06-21Remove WideString::c_str() calls where possible.Tom Sepez
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>
2018-06-20Avoid more .c_str() usage, part 3Tom Sepez
Change-Id: I5dfadcb68e640235be6e3eb7c8d57ae3b8013d26 Reviewed-on: https://pdfium-review.googlesource.com/35691 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-20Re-work some more c_str() usage.Tom Sepez
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>
2018-06-19Move fxcrt::{Byte,Wide}Strings with std::move().chromium/3466Tom Sepez
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>
2018-06-14[formcalc] Calculate length of string when calling FXSYS_wcstofDan Sinclair
When calling the FXSYS_wctof method we currently pass in -1 from AdvanceForNumber. This tells the method to calculate the string length. This can be slow for a formcalc string with a lot of numbers. This CL changes the call to pass in the length of remaining data in the original string. This takes the MSAN runtime of the case in the linked bug from ~21seconds to ~500ms. The debug runtime goes from ~2s to ~500ms. Bug: chromium:846104 Change-Id: Idbd19a728160f35982e21c0d97567fbbeefe667a Reviewed-on: https://pdfium-review.googlesource.com/35210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-06-14Move definition of XFA_SCRIPTATTRIBUTEINFO into cjx_object.h.Peter Collingbourne
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>
2018-06-12[fm2js] Convert formcalc tests to use raw literalsDan Sinclair
This CL updates some of the formcal tests to use raw literals instead of escaping lots of things. Change-Id: I539063b6c98aae318147b7103a0fd84e6b76054f Reviewed-on: https://pdfium-review.googlesource.com/34190 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-06-06[fm2js] Fixup initialized variable conversionDan Sinclair
When converting a Var statement from formcalc to JS we would neglect to add the ; if the variable was initialized. This generated invalid JS as we'd end up with two statements smushed together. FormCalc: var s = "" Previous JS: var s = ""s = pfm.... New JS: var s = ""; s = pfm ... Bug: pdfium:1097 Change-Id: I8a869f07374cac68a06a487dace89699a4e5540c Reviewed-on: https://pdfium-review.googlesource.com/34110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-05[xfa] Make the event context available when calling back in XFADan Sinclair
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>
2018-06-05Clean up CFX_TxtBreakRyan Harrison
Removed some unused assignments and now unused variables. Also rewrote a for loop so that its secondary condition is now in the control block. The static analyzer was claiming it was possible for a division by 0, though following the control path it was claiming, I am pretty sure it should have exited early. This reorganizing of the code makes it a bit more readable and eliminates the div by 0 warning from the static analyzer. Issues found with Clang Static Analyzer. Change-Id: I91f1b42374734665b06724e9fafa6490e06bd3da Reviewed-on: https://pdfium-review.googlesource.com/33910 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-04Remove unused assignment from CFX_RTFBreakRyan Harrison
This assignment is never used, so removing it. Issue found with Clang Static Analyzer. Change-Id: I5cf4bd9626f0a0391681c3923ae1bee70ffb99c7 Reviewed-on: https://pdfium-review.googlesource.com/33791 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-04[xfa] Get properties from the non-xfa global if possibleDan Sinclair
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>
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-01Move variable into loop scopeRyan Harrison
The variable is not used outside of the loop. This was noted by tsepez@ after landing the initial CL to clean up this code. Change-Id: Id7d6713db4fa6bdfe867c151290cb28329ae7042 Reviewed-on: https://pdfium-review.googlesource.com/33590 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-06-01Remove initialization of wchar_t chRyan Harrison
This value is overwritten at the beginning of the following while loop, so the initialized value is never used and the method called is const, so should be side effect free. Issue found with Clang Static Analyzer. Change-Id: I77f27daccd3aa1edd434cfa3e0dd7bc095db06d0 Reviewed-on: https://pdfium-review.googlesource.com/33550 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Remove unused variable pDst from CFWL_Edit::OnValidateRyan Harrison
GetOuter is const, so the assignment has no side effects, and the value is never user in the method body. Issue found with Clang Static Analyzer. Change-Id: I0116726a3df38dbf611db75ed03a0a17b4449d09 Reviewed-on: https://pdfium-review.googlesource.com/33531 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Remove unneeded call to GetNextSiblingWidgetRyan Harrison
The value is stored in a local scope variable at the end of a loop, so is never used. The method is const, so is sideffect free, thus this line has no overall effect. Issue found with Clang Static Analyzer. Change-Id: Ib20c5c121c8464433c6ad6d8e1439b929033d6d6 Reviewed-on: https://pdfium-review.googlesource.com/33530 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-31Make XFA pixel tests more stablechromium/3447Ryan Harrison
When generating PDFs using the fixup script and a .in, specify them to to use Ahem.ttf as the text font. Ahem is a font designed to reduce flakiness in pixel tests due to font rendering differences between platforms. Specifically the glyphs in the font are standard size black boxes, so though the specific text content cannot be easily compared, things like layout and high level changes to the content can still be tested. Testing things like specific text changes should be done via an embedder test, where the strings in the elements can be extracted and inspected. The font itself is is CID type 2 font, which is relatively complex to correctly embed in a PDF due to subsetting and other features. Instead of embedding it in the generated PDFs, which was originally attempted, it is being supplied to pdfium_test via the --font-dir flag. This flag overrides where the binary looks for system fonts. This works correctly on Mac and Linux, but not on Windows, which is why that platform remains suppressed. BUG=pdfium:1008,pdfium:1020 Change-Id: I00811536de98f736fc599d96b397194ccf8db0cd Reviewed-on: https://pdfium-review.googlesource.com/27790 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-31Move codepage/charset methods into related places.Artem Strygin
Change-Id: I71417cc5b1bd00f77d42740198cc17487ebd686e Reviewed-on: https://pdfium-review.googlesource.com/33330 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
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-23[xfa] Skip text length check for empty text fieldschromium/3439Dan Sinclair
This CL sets the text edit engine to skip the length check when doing an insert if the engine is currently empty. This allows handling inserting the formatted version of strings if they have a length longer then the maximium length. Bug: 1066 Change-Id: If9799334f889b8ae0f568f1f9d5457e2b504aa1d Reviewed-on: https://pdfium-review.googlesource.com/32898 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-22Make friend RetainPtr<T> statements consistently public.Lei Zhang
Also make destructors private for RetainPtr sub-classes, and add missing destructors. Change-Id: I451bf0aae2dae943b1f450d0aa4ca5124dc578fd Reviewed-on: https://pdfium-review.googlesource.com/32853 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@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>