summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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>
2018-02-14Pdfium: Allow negative font sizes for PostScript printingrbpotter
Bug: chromium:806746 Change-Id: I0b642c457c55d828dd48988eadfc5fa964de1216 Reviewed-on: https://pdfium-review.googlesource.com/26630 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
2018-02-13Change return value of GetAvailInputRyan Harrison
This changes the return value from uint32_t to FX_FILESIZE, which is the type the methods is uses return. The existing code does an unguarded static cast, so something like -1 could cause a very large value being returned. This change has a cascading impact up to the top of the progressive codec, which now has to handle negative values gracefully. Change-Id: I813fb71e932dd5da014dbaed0dbf3bb28f8d4e9f Reviewed-on: https://pdfium-review.googlesource.com/26450 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-13Add last_child to CFX_XMLNodeDan Sinclair
This CL adds the list_child_ member into CFX_XMLNode to keep it consistent with other tree's in the system. Change-Id: I2e64f11fb9c7df40dd3467edcce177fc492d2cd2 Reviewed-on: https://pdfium-review.googlesource.com/26670 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-13Remove old version of InitializeV8ForPDFium().Lei Zhang
Change-Id: I5dbf1c78cf794eff817de9f5831b1fb5b49c84ab Reviewed-on: https://pdfium-review.googlesource.com/26491 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-13Teach fixup_pdf_template.py to automatically calculate stream length.Lei Zhang
BUG=pdfium:1008 Change-Id: I5136d57bd401d44b56ac19e5cfb52702afa32200 Reviewed-on: https://pdfium-review.googlesource.com/26651 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-13Split CFX_XMLNode::SaveXMLNode apartDan Sinclair
This CL removes the switch from SaveXMLNode and moves the required code into override methods in the child classes. The method is renamed from SaveXMLNode to just Save. Change-Id: I2011b80525e99635c573b4e0cf977e94f6b7cea6 Reviewed-on: https://pdfium-review.googlesource.com/26590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-13Cleanup CFX_XMLNode pointersDan Sinclair
This CL cleans up hte CFX_XMLNode pointers. Each pointer has been renamed to make the usage clearer, the NodeItems method has been removed in favour of distinct accessors and the node pointers have been made private. Change-Id: I5459a77a0ae93b08741a0cd59266ef9c81ddad75 Reviewed-on: https://pdfium-review.googlesource.com/26550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Cleanup CFX_XMLDoc::SaveXMLNodeDan Sinclair
The CFX_XMLDoc::SaveXMLNode method is almost an exact copy of the CFX_XMLNode::SaveXMLNode. This CL removes the XMLDoc variant and calls the XMLNode method directly. This Removes the need to pass the CXFA_DocumentParser into CXFA_Document and we can instead pass in the CXFA_FFNotify object directly. Change-Id: Ic3c8c66375483fe73b44dd84064a1b71b039d61c Reviewed-on: https://pdfium-review.googlesource.com/26530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Cleanup CFX_XMLNode and friendschromium/3347Dan Sinclair
This CL removes unused methods from CFX_XMLNode, adds an AppendChild to handle the case of a -1 index to InsertChildNode, removes the InsertChildNode return value which is unused and cleans up various other things. Change-Id: I3a022e4dc2afffa6893ad11014034dd7ed301f13 Reviewed-on: https://pdfium-review.googlesource.com/26510 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Cleanup CXFA_Node ownershipDan Sinclair
Currently a CXFA_Node can be owned by the CXFA_Document root pointer, the CXFA_Document Purge list or as a child of another CXFA_Node. This makes it hard to know who currently owns what. This CL moves all ownership of nodes into a CXFA_NodeOwner class which CXFA_Document subclasses. The node owner always owns all nodes and is responsible for cleaning them up upon destruction. The destruction order is not guarenteed to be in tree order as nodes can be inserted and moved around the tree. Change-Id: I6b202b8e844999ba835093dcdd1a808938b6d9a8 Reviewed-on: https://pdfium-review.googlesource.com/26434 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-13Fix nits in Python code.Lei Zhang
Change-Id: I01956bff9e7250c9df84afe6b6de96ab4e9b4851 Reviewed-on: https://pdfium-review.googlesource.com/26650 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-13Convert ASSERT to PDFIUM_IMMEDIATE_CRASHDan Sinclair
This CL changes the ASSERTs used in CXFA_Node::InsertChild and RemoveChild to PDFIUM_IMMEDIATE_CRASH. The ASSERTs are compiled out in Release mode, we want to make sure we don't accidentally build invalid node trees in Release. Change-Id: Ic96c8ab457631d1f32d36d7d12bd5888f1cf4b0a Reviewed-on: https://pdfium-review.googlesource.com/26431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Add previous sibling pointer to CXFA_NodeDan Sinclair
This CL adds a prev_sibling_ pointer into CXFA_Node and updates the code as needed. Change-Id: I3125f59780da34dc26a176c7264a31335be528fe Reviewed-on: https://pdfium-review.googlesource.com/26410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Roll v8 to 6353d168.Lei Zhang
https://chromium.googlesource.com/v8/v8/+log/ee5d9a0c..6353d168 TBR=dsinclair@chromium.org Change-Id: I46e14078fb7d3aa78723fd499d7c8280b3ae7161 Reviewed-on: https://pdfium-review.googlesource.com/26490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-13Add tests for CXFA_Node child manipulationDan Sinclair
This CL adds tests for CXFA_Node::InsertChild and CXFA_Node::RemoveChild methods. Change-Id: I6ef9e76dfbfa8a9b8246620ecf80c88812b332fc Reviewed-on: https://pdfium-review.googlesource.com/26371 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Use actual type in place of void* in V8 mapTom Sepez
Add an override so we can comment about the need for it someday. Change-Id: I344c6fd7a635aeab030f0e769bd03a86406ffdd8 Reviewed-on: https://pdfium-review.googlesource.com/26310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-12Fix signedness in CJBig2_HuffmanTable, and add overflow checkNicolas Pena
Bug: 808902 Change-Id: Iad5ab63eeedc3ea85001337ba73626178c71f8b8 Reviewed-on: https://pdfium-review.googlesource.com/26470 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-02-12Test if GC'd FXJS objects have their C-side counterparts cleaned up.Tom Sepez
Small correctness fix in other engine embeddertest. Change-Id: I6c2721921a659eef1b2f155ea1797722d37209d0 Reviewed-on: https://pdfium-review.googlesource.com/26270 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-12Convert CFX_BmpDecompressor to use CFX_MemoryStreamRyan Harrison
This also adds a Seek method to CFX_MemoryStream BUG=pdfium:1007 Change-Id: I2c7e1d3b6d8aff36e302014cb2e8ffc0f23ef7c4 Reviewed-on: https://pdfium-review.googlesource.com/26230 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-12Mark some CPDF_Dictionary pointers as const.Lei Zhang
This makes it obvious if they are dictionaries that are only read from, or if they are being modified. Also clarify some page dictionary variables names to make it obvious that they are the source or destination page. Change-Id: I1d3c769c9940296b8f159b454bde32e595a95cac Reviewed-on: https://pdfium-review.googlesource.com/26330 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-12Remove a parameter from CPDF_NPageToOneExporter::MakeXObject().Lei Zhang
It's always the same member variable. Also make a CPDF_NPageToOneExporter::FinishPage() parameter const-ref. Change-Id: Id2550115259177d72b814bf6d4afe5fb775f6b86 Reviewed-on: https://pdfium-review.googlesource.com/26290 Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-12Cleanup CXFA_Node tree pointerschromium/3346Dan Sinclair
This CL changes the CXFA_Node parent pointer back to a raw pointer from an UnownedPtr. The other tree pointers have been renamed for clarity. Change-Id: I366a0b5b41d49d87b11bec0eea9890fbc79c1c62 Reviewed-on: https://pdfium-review.googlesource.com/26370 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-12Drop -Iv8 flag from pdfium buildTom Sepez
We converted the <v8.h> includes to "v8/include/v8.h" some revs back, so we need not explicitly tell the compiler to look there. Change-Id: Id71f1bad81a969eebf418c9d97b32864ea78480b Reviewed-on: https://pdfium-review.googlesource.com/26251 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-12Allow creation of FreeText annotations.Henrique Nakashima
Bug: pdfium:1011 Change-Id: Ie12595f321888c50ae74ab22bb147aef7e20f40d Reviewed-on: https://pdfium-review.googlesource.com/26390 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-12Get rid of EmbedderTest::RenderPageWithFlagsDeprecated().Lei Zhang
Change-Id: I653619faa61181137795bb3675418fd8d0945d25 Reviewed-on: https://pdfium-review.googlesource.com/25590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-12Rearrange allocator functions to avoid unreachable codeDaniel Bratell
FX_AllocOrDie, FX_AllocOrDie2D and FX_ReallocOrDie contained unreachable code which in jumbo builds with some Visual Studio versions/configurations resulted in a compiler warning. By reordering the code, the unreachable code can be removed. Bug: pdfium:964 Change-Id: I8c040a31ea6af0ca896d8f68297e263719d6bdfa Reviewed-on: https://pdfium-review.googlesource.com/26190 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-10Renable -Wimplicit-fallthrough for PDFium.Nico Weber
Didn't find any bugs, but also doesn't require much boilerplate. Bug: TODO Change-Id: I5f30183c55216f1333c79fcb46476d281720873e Reviewed-on: https://pdfium-review.googlesource.com/26210 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
2018-02-09Use CPDF_Dictionary::SetRectFor() when appropriate.Lei Zhang
Change-Id: I4ced221fb5691927485deceb7002dac880c2c210 Reviewed-on: https://pdfium-review.googlesource.com/26110 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-09Use CFX_Size in CPDF_Page and fpdf_ppo.cpp.Lei Zhang
Instead of having separate floats for width and height. Also remove some out parameters and just return them instead. Change-Id: I798b1453910c89477d422dcb7c0805b90823bf98 Reviewed-on: https://pdfium-review.googlesource.com/26090 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-09Fix nits in ParsePageRangeString().Lei Zhang
- Fix typos. - Do not pass by value. - Return early if the page range string is empty after removing spaces. - Simplify and rearrange bits of the implementation. Change-Id: Ia4c4f43c2ca18383ad1edc8233969a7013e34722 Reviewed-on: https://pdfium-review.googlesource.com/24290 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-02-09Get rid of EmbedderTest::RenderPageDeprecated().Lei Zhang
Change-Id: I8c6d813e488b2612a85fb1973382f979728df563 Reviewed-on: https://pdfium-review.googlesource.com/25571 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-09Speculative fix for build breakageTom Sepez
Make pdfium_embeddertests explicity depend on fxjs, which exposes v8 via public_deps, and hopefully stops the compiler from instantiating v8 code in our module. TBR=rharrison@chromium.org Change-Id: If6f2750a7a3b7a508275dedacfe07235ca8727f6 Reviewed-on: https://pdfium-review.googlesource.com/26250 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-09Tidy V8TemplateMap.Tom Sepez
Change-Id: Idcba60bb36c0d47c0d2acb21ddfa3b3b46cdfe49 Reviewed-on: https://pdfium-review.googlesource.com/26170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-09Rename fxjs_v8.{h,cpp} to cfxjs_engine.{h,cpp}Tom Sepez
Place the template map definitions entirely in .cpp file. Change-Id: I2643f1b99f5582b69aa985857c4aa6f9b5ab57c8 Reviewed-on: https://pdfium-review.googlesource.com/26150 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-09Move CFX_V8 testing from embeddertest to unittest.Tom Sepez
Test the lowest layer without firing up the whole library. Requires firing up v8 in the unit test main, though. Move array buffer allocator to cfx_v8 to allow building isolates. Change-Id: I9a56d503a48e0e555d3310f2997fa12137695860 Reviewed-on: https://pdfium-review.googlesource.com/26130 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-08Split CPDF_PageOrganizer into multiple classes.chromium/3345Lei Zhang
Retain CPDF_PageOrganizer as a base class. Add CPDF_PageExporter and CPDF_NPageToOneExporter sub-classes. The sub-classes only do one type of exporting. Therefore it is much easier to understand what part of the original combined CPDF_PageOrganizer is used where. Change-Id: I424ef9c32b101d23e8397fc9a656d9b0b5da6a27 Reviewed-on: https://pdfium-review.googlesource.com/26011 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-02-08Add document getters in CPDF_PageOrganizer.Lei Zhang
This is to prepare for splitting CPDF_PageOrganizer into multiple classes. Change-Id: Ibf54342096aeb66465fd24dc1ba40c73112fb4c9 Reviewed-on: https://pdfium-review.googlesource.com/26010 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-08Do page load/unload checks in EmbedderTest for saved pages.chromium/3344Lei Zhang
Change-Id: I9286b24957f9d96da10869098eb0e04991bd6571 Reviewed-on: https://pdfium-review.googlesource.com/25570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-08Move cjs_v8.cpp to cfx_v8.cppTom Sepez
The layering should be CJS => CFXJS => CFX_V8 with the CJS name being higher up. Change-Id: Ic130f248906e9c4df641dd508389b0555786b999 Reviewed-on: https://pdfium-review.googlesource.com/26051 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-08Move XFA-specific methods out of CJS_V8.Tom Sepez
These belong more properly in CFXJS_Engine, and a small amount of casting is required to get to the sub-class. Change-Id: Id954d182b7a7d51fe0a522c04a50a1b362746c72 Reviewed-on: https://pdfium-review.googlesource.com/26050 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-08Revert "Convert CXFA_Node to store a vector of children"dsinclair
This reverts commit f0e386de64e030f6d692acfa27e2bc0a50018710. Reason for revert: After chatting with tsepez@, we've got a better direction to take these changes. Original change's description: > Convert CXFA_Node to store a vector of children > > This CL changes CXFA_Node to use a vector of nodes as children instead > of a singly linked list of siblings and child pointers. > > Change-Id: Ica8219f63d783a07d90b9541ae62a35c49166e44 > Reviewed-on: https://pdfium-review.googlesource.com/26030 > Reviewed-by: Ryan Harrison <rharrison@chromium.org> > Commit-Queue: dsinclair <dsinclair@chromium.org> TBR=dsinclair@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I115779a292d39694ad5faf0b748a617c491b40f0 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/26070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-08Make CFXJS_Engine::SetObjectPrivate() static.Tom Sepez
Avoids call to CFXJS_Engine::EngineFromIsolateCurrentContext() during the Dispose() path, which feels scary because there aren't guarantees about it having an engine at isolate "dispose" time. Fortunately, |this| is not used, so make that fact clear. Replace some c-style callbacks with std::function while we're at it. Change-Id: Ia1a1a1fcc085d8657939e6f8c8d34fc511afddfe Reviewed-on: https://pdfium-review.googlesource.com/25970 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-08Convert CXFA_Node to store a vector of childrenDan Sinclair
This CL changes CXFA_Node to use a vector of nodes as children instead of a singly linked list of siblings and child pointers. Change-Id: Ica8219f63d783a07d90b9541ae62a35c49166e44 Reviewed-on: https://pdfium-review.googlesource.com/26030 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-08Do more page load/unload checks in EmbedderTest.Lei Zhang
- Keep track of pages in a single map when calling LoadPage(). It is simpler and performance is not crucial as the number of loaded pages is usually very small. - Verify UnloadPage() is only called for loaded pages. - Verify there are no loaded pages in TearDown(). - Verify RenderLoadedPage methods are only rendering loaded pages. - Fix pages that are using FPDF_LoadPage() and FPDF_ClosePage() when they should be using LoadPage() and UnloadPage(). - Disallow calling LoadPage() for the same page number repeatedly. No caller does this and it makes verification in UnloadPage() harder. Change-Id: I58878ea8ade21dde28f1bbebd3a3304ce677561d Reviewed-on: https://pdfium-review.googlesource.com/25550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-08[v8-platform] Store the platform in a unique_ptr. (Try 2)Lei Zhang
We want to change the signature of {CreateDefaultPlatform} in the V8 API to return a unique_ptr instead of a raw pointer to indicate that the caller owns the platform. With this change we prepare pdfium for this change. In this second attempt, keep the old InitializeV8ForPDFium() method around to complete the Chromium DEPS roll. Once that lands safely, remove it from PDFium. This relands commit 608e8dd6 and commit 3355f459, which commit b3a3eaab reverts. Change-Id: Icc60b17ca202637d34ae242c0785d939194d0fe6 Reviewed-on: https://pdfium-review.googlesource.com/25950 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-07Remove some deprecated RenderPage method usage.Lei Zhang
Do some additional checks in test cases where pages were rendered but the resulting bitmap was immediately destroyed. Change-Id: I2f4678140cdc672ab4ced70f748135464447ff59 Reviewed-on: https://pdfium-review.googlesource.com/25510 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-07Split creation of ordinary object and bound objects in FXJS.chromium/3343Tom Sepez
One can be performed by the CJS_V8 layer, the other requires the full FXJS mechanism. Avoids using -1 as a special case. Change-Id: I4a14ccb6a7fea393f84b70a07ada03b1a83c7d36 Reviewed-on: https://pdfium-review.googlesource.com/25830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-07Handle removed fonts correctly in GetFontByCodePageRyan Harrison
The existing code has a couple of issues that need to be addressed. First it assumes that for a hash, there will be an entry in the map and blindly calls the [] operator and takes the address of the result. If there isn't an entry for the hash then this will cause a crash. This has been converted to a call to find and returning nullptr, which is the fail result, if it cannot find an entry for the hash. The other issue is that it assumed that the first entry in the vector would be a valid pointer. When removing fonts from the vector, RemoveFont, first nulls out entries. Once all of the entries have been removed from a vector on subsequent calls to RemoveFont, then the vector is removed from the map. Thus the first entry in the vector might not be the correct value to return. This has been changed to a linear scan of the vector for a valid pointer. BUG=chromium:648177 Change-Id: Ife758636545f0d10fb726c243e3e0a5b7c1d1138 Reviewed-on: https://pdfium-review.googlesource.com/25930 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>