summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-04-12Fix string passing coventions in xfa_fm2jscontext.hchromium/3070Tom Sepez
Change-Id: Ibcb3a95a52ab67c4c9c397ff9c4eab483ef1fcc3 Reviewed-on: https://pdfium-review.googlesource.com/3954 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-12Fold CFGAS_Stream into CFGAS_TextStream.Dan Sinclair
Every CFGAS_Stream is wrapped inside a CFGAS_TextStream. This CL folds the two classes together and merges the methods where needed. Change-Id: Ic56449b36baa51254d8d600ce631f285ba2cbb80 Reviewed-on: https://pdfium-review.googlesource.com/4057 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-12Cache TypeFace instead of FontCary Clark
Skia tracks the font passed so it can use it later to draw. In XFA's case, the font is discarded after Skia sees it, but before it draws with it. Track the TypeFace instead, which remains available across the XFA lifetime. R=dsinclair@chromium.org Bug: 705193 Change-Id: I4fc9fee4a7d96ea25f242975f6c0d10941f5c549 Reviewed-on: https://pdfium-review.googlesource.com/4058 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-12Some fixes to the fallback font code.Nicolas Pena
This CL applies several fixes to the fallback font code. - PDFium uses -1 to indicate that no glyph index was found, but freetype uses 0. In CPDF_TrueTypeFont, an index of 0 indicates a freetype failure, which means we should try to find the glyph from a fallback font. - Improve the fallback glyph calculation by going from original font charcode to unicode to fallback font charcode. - Consider the m_ExtGID on Mac when deciding the fallback. Bug: chromium:665467 Change-Id: I2be34983e0d768d9a598043f84edd2d70f033c86 Reviewed-on: https://pdfium-review.googlesource.com/4055 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-12No gradient to draw if clip is emptyCary Clark
If a clip with bounds (0, 0, 0, 0) is used to specify the limits of a gradient, the clipping rectangle will be degenerate. Leave the clip empty in this case. R=dsinclair@chromium.org Bug: 705736 Change-Id: I4a5845459c1527f2c643563d6bef4d6dcc6781d3 Reviewed-on: https://pdfium-review.googlesource.com/4071 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-04-12Remove params from CFGAS_StreamDan Sinclair
This Cl removes members from CFGAS_Stream which just mirror values that are stored in the stream impl or values which aren't used. Change-Id: Ia2da5a645f4dd3399b3452fd56d833fed341390c Reviewed-on: https://pdfium-review.googlesource.com/4056 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-12Remove text buffer for CFGAS_TextStreamDan Sinclair
The ::ReadString method appears to only be called in the CFDE_XMLSyntaxParser. The reads happen with a buffer size of 32k which seems like we won't have to call this too many times. Change-Id: I3ff522cdb081777b0b0433926392fb1a03455df3 Reviewed-on: https://pdfium-review.googlesource.com/4054 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-12Remove m_iStart which is always zeroDan Sinclair
The m_iStart flag in CFGAS_Stream is always set to 0. This CL removes the variable and cleans up the supporting code. Change-Id: I6f8fa5e97cbcc49802f28f8e1de3eb4792f18183 Reviewed-on: https://pdfium-review.googlesource.com/4053 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-12Fold CXFA_WideTextRead into IFGAS_StreamDan Sinclair
This Cl moves CXFA_WideTextRead to be in the anonymous namespace of IFGAS_Stream and adds a IFGAS_Stream::CreateWideStringReadStream() method. This is done so we have all the implementations of IFGAS_Stream centralized. Change-Id: I9fbbf0a493fc2dd05fcd544e344268214a75d8a1 Reviewed-on: https://pdfium-review.googlesource.com/4052 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-12Pull in the latest PartitionAlloc fixes from upstream.Chris Palmer
BUG=pdfium:691 Change-Id: If6f1e200e763827ec640b2b79171f3899ea7927e Reviewed-on: https://pdfium-review.googlesource.com/4050 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-04-12Remove MakeSeekableReadStreamDan Sinclair
This Cl removes the MakeSeekableReadStream call and, at the one place it's used, creates an IFX_MemoryStream which is a seekable read stream. Change-Id: I6b0b23636eff47f8caca5432313ba99703e21e4d Reviewed-on: https://pdfium-review.googlesource.com/4037 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-12Clip stack management was off by one.Cary Clark
To help find future bugs, add printf and checking to see that the skia clip stack and the pdfium clip stack are in sync. Bug: 705783,795821 Change-Id: I3ed39cbe2514ab18e5bee6eb363cc2d0f042bff5 Reviewed-on: https://pdfium-review.googlesource.com/4090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-12Remove the FGAS Buffered StreamDan Sinclair
This CL removes the FGAS buffered stream. The only user was unittests which have been converted to use a ReadStream. Change-Id: I5af9d3bdf570a307502ea01eef6029db1c8fecef Reviewed-on: https://pdfium-review.googlesource.com/4036 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-12Minor text change in README.Dan Sinclair
TBR=npm@chromium.org Change-Id: I86451ff849644056b7d86ea642a11b5987a33830 Reviewed-on: https://pdfium-review.googlesource.com/4051 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Refactor CFX_Palettechromium/3069Nicolas Pena
The pointer members point to owned arrays. Avoid FX_Free in CFX_Palette. Use std::pair and avoid the use of a buggy quicksort. Change-Id: I5d5471d56dbfd32800e204c84664c436d1fbab08 Reviewed-on: https://pdfium-review.googlesource.com/4038 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-11Remove vestigial GYP_GONE test targets.jbudorick
BUG=pdfium:702 Review-Url: https://codereview.chromium.org/2814743003
2017-04-11Remove the STREAMTYPE define.Dan Sinclair
There are only two types of streams created _File and _Buffer. This CL simplifes the code by removing other stream types and removes code which is for those types. The CFGAS_Stream creation was also inverted to pass in the impl instead of accepting and setting the stream type. Change-Id: I73f207d0f458818ab59db915b256c6fdd633a336 Reviewed-on: https://pdfium-review.googlesource.com/4035 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Avoid long assignment chain in FM parserNicolas Pena
We only parse FM right before translating to JS. Our current implementation of assignment will duplicate to first expression's ToJavascript. So having a long chain of assignments will result in a huge ToJavascript. Bug: chromium:665087 Change-Id: I542371b5787113be2f2d686153ed0a6c48191bab Reviewed-on: https://pdfium-review.googlesource.com/4030 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-11Remove unneeded stream access flagsDan Sinclair
This Cl removes all of the steam access flags other then write. Flags which were always set were removed. Change-Id: I96df4fa0c95d89f4f454db050f3f032bc163e498 Reviewed-on: https://pdfium-review.googlesource.com/4034 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Remove unused loading code from IFGAS_StreamDan Sinclair
Remove unused loading methods, fold Create method back into caller. Change-Id: If3b7b3d1cdaf3d58fc7c07c3e96cf9ac89b61bd4 Reviewed-on: https://pdfium-review.googlesource.com/4033 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Disabiguate CreateStream callsDan Sinclair
This CL creates a CreateReadStream and CreateWriteStream method instead of having a single overloaded method. This removes the need for the cast at the call sites. The access parameter has been rolled into the method as it was always passed the same way to each Create*Stream method. Change-Id: I845951c3fe386b8051daf4f6b2ee5ba29b5c7d54 Reviewed-on: https://pdfium-review.googlesource.com/4032 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Guard against negative shift in nVal calculationDan Sinclair
It's possible for the nVal to become negative as it is shifted. This Cl changes nVal to be a checked_numeric and bails out if the shift is invalid. Bug: chromium:708504 Change-Id: Ia2ebbc828ece7f7d443432542784b39defe6a897 Reviewed-on: https://pdfium-review.googlesource.com/4010 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-10Remove unused CreateTextStreamDan Sinclair
This CL removes the CreateTextStream method as it is not called. Change-Id: I628aec2e8f488ad549b3497344ac08c5bb24de51 Reviewed-on: https://pdfium-review.googlesource.com/4014 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-10Remove unused CreateSharedStreamDan Sinclair
The CreateShreadStream code is not called, remove. Change-Id: I62871ce190e50598b7c82ab3b43355dbde6b8b4b Reviewed-on: https://pdfium-review.googlesource.com/4013 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Use checked_numeric to guard shiftDan Sinclair
It's possible for the RANGELEN[NTEMP] value to be larger then 32. This will make the shift invalid if the 1 is an int. This CL changes to 1L and uses the CheckedNumeric to validate that the result is inside the needed range for an int. Bug: chromium:708439 Change-Id: I1f0359985c2d7769367bd0edcf5e081f5bb58816 Reviewed-on: https://pdfium-review.googlesource.com/3991 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-10Do not treat push button as fillable fieldWei Li
Only fillable fields should show highlights. Push button should not do that. Doing so results in lighter color or extra layer of light color. BUG=chromium:638626 Change-Id: I6b4d129e1f60bf44ff5a297d4b9db823d6be8079 Reviewed-on: https://pdfium-review.googlesource.com/3790 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Wei Li <weili@chromium.org>
2017-04-10Guard against negative shift in jbig2 huffman initializationDan Sinclair
Depending on the code table, it's possible to have the largest PREFLEN value in the huffman table to be > 32. This will, potentially, cause the calcuation of ((FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1 to overflow the int value and cause a negative shift. This Cl checks the shift value and failes the initialization if we would shift a negative value. Bug: chromium:709781 Change-Id: Ia165a01ba9412e31c5e5a43717d415fcb42eafe5 Reviewed-on: https://pdfium-review.googlesource.com/3990 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Fix windows skia component builddan sinclair
The skia build on Windows is not producing a shared .lib file when building skia. This Cl updates the Skia component build to correctly generate the needed shared library. Bug: pdfium:701 Change-Id: I9545b8fcf76c8622624780ee3cc9ba794f4a842d Reviewed-on: https://pdfium-review.googlesource.com/3971 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Wei Li <weili@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Fix bytestring passing conventions, part 2.Tom Sepez
Change pass by reference to const reference or pointer. Change-Id: Ic007f14e6569679a846980a96cc627eac4ecd5d6 Reviewed-on: https://pdfium-review.googlesource.com/3953 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-10Remove unreachable code in CFX_ScanlineCompositorchromium/3068Nicolas Pena
m_Transparency is set in the Init method of the CFX_ScanlineCompositor. After the removal of the icc transform, it is clear that m_Transparency can only take values strictly less than 64. Change-Id: I6c33b9971b3b8a1ec45fbf50901f9815f323a2a5 Reviewed-on: https://pdfium-review.googlesource.com/3970 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-08Add title (/T) extraction for PDF tagged structureschromium/3067chromium/3066dan sinclair
This CL adds the ability to extract the title from a tagged structure element if one exists. Bug: pdfium:672 Change-Id: I22e2a8371db4f08b8a70dd77002f1befab97f530 Reviewed-on: https://pdfium-review.googlesource.com/3819 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-07Create initializer-list ctor for strings.Tom Sepez
Also use safe arithmetic for two-arg ctor. Change-Id: I5d541d9b2d5fe5b939f4cc8c22cf034f5cb01176 Reviewed-on: https://pdfium-review.googlesource.com/3955 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Cleanup string passing in core/fpdf*Tom Sepez
Return strings where possible. Add missing consts to strings passed by ref. Convert non-const cases to pointers. Rename a few methods to be clearer. Change-Id: I86569bc1744f539e6dd67fc73649b272c016328c Reviewed-on: https://pdfium-review.googlesource.com/3951 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-07Tweak CFDF_Font::AppendChar()Tom Sepez
Pass in/out argument as a pointer. Avoid pointless malloc just to copy in multibyte case. Then we can avoid special-casing the single-byte case. Change-Id: I3dd2d57e08ef6ad7b78ea38398b228fa41a9b3e6 Reviewed-on: https://pdfium-review.googlesource.com/3950 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Remove the ICC transform where it is never initialized.Nicolas Pena
- All callers of CFX_DIBitmap methods use nullptr as the ICC Transform. - The CFX_ScanlineCompositor is always initialized with a null ICC transform. Many of its methods call TranslateScanline from the ICC module. This method casts just uses ((CLcmsCmm*)pTransform)->m_hTransform, and this should not be done when pTransform is nullptr. Change-Id: I1b846d1f20699fa017cb9a276be3214eb8fabd4b Reviewed-on: https://pdfium-review.googlesource.com/3931 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-07Remove the "old way" of performing FlateUncompress.Tom Sepez
Repeated looping over Realloc() with a linearly increasing buffer size is going to be O(N^2) which is why it was limited to small cases. But it's wrong to do it anyways, and it kicks out a lurking issue in PartitionAlloc as it turns out. See https://crbug.com/709271, but this doesn't actually fix that issue, it just avoids it. Change-Id: I39d8f8df0d5fc358b7b9caa15c507a8f57e45004 Reviewed-on: https://pdfium-review.googlesource.com/3910 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Gitignore jinja2 and markupsafeNicolas Pena
Change-Id: I9c05ddc2ca2e3377cc8a9d13c3e4faa2f17a49a5 Reviewed-on: https://pdfium-review.googlesource.com/3930 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-07Use libjpeg-turbo instead of our own copy of libjpeg.Lei Zhang
Check out libjpeg-turbo via DEPS. Also checkout yasm via DEPS and copy some yasm build files from Chromium. BUG=chromium:541704,pdfium:389 Change-Id: Ic7af415f002a3ca2acd9223ed3474dedf3930b32 Reviewed-on: https://pdfium-review.googlesource.com/3470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-07Use CFX_MaybeOwned on the buffer of CFX_DIBitmapNicolas Pena
Change-Id: Ia4181a2838de60e4e177165b3689338c86f45771 Reviewed-on: https://pdfium-review.googlesource.com/3817 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Fix unit tests to initialize PartitionAlloc.Chris Palmer
Tests need to be subclasses of FPDF_Test. BUG=pdfium:700 Change-Id: I317ec2c49567e58cb57c6222e387574226f594b3 Reviewed-on: https://pdfium-review.googlesource.com/3890 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-04-06Clean up CBC_QRCoderVersion and friends.Lei Zhang
Change-Id: Iff738c99fb4fe38d35515c280057b489624d734f Reviewed-on: https://pdfium-review.googlesource.com/3752 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-06Remove stale gn arg to avoid undeclared argument warning.chromium/3065Dale Curtis
v8_enable_inspector was removed recently. Clean up remnants. BUG=645890 TEST=none Change-Id: I501d33bfaa1bf0a03f83b9ed3b4b183301d38d63 Reviewed-on: https://pdfium-review.googlesource.com/3871 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Cleanup CFX_BitmapComposerNicolas Pena
Remove default params, use more unique_ptr, and fix some nits. Change-Id: I4ed9a576fb3ebd9afd64c6544d1f6a1103e9d270 Reviewed-on: https://pdfium-review.googlesource.com/3872 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Cleanup nits from previous XML Cldan sinclair
Change-Id: I1e0b84a8b208d92aff3f02b6461b3a20f60f4d1e Reviewed-on: https://pdfium-review.googlesource.com/3870 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Cleanup tagged code.dan sinclair
This Cl removes a bunch of unused tagged code. Some of this will need to come back in the future (like the attr code) but we can add it back with tests when needed. Bug: pdfium:672 Change-Id: I7aaed79963910b336f42ce665790408038c39ba4 Reviewed-on: https://pdfium-review.googlesource.com/3830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-06Cleanup the tagged codedan sinclair
This CL removes the IPDF_Struct* classes in favour of their only implementation. The tagged code was split out into files matching the classes they contain. The friendship between CPDF_StructTree and CPDF_StructElement was broken in favour of accessors. Bug: pdfium:672 Change-Id: Iade83b608fb7168b3b0f41338d10d5fd8ab91a6e Reviewed-on: https://pdfium-review.googlesource.com/3820 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-06Remove the length reference from XMLSyntaxParserdan sinclair
This Cl removes the reference to the length of the CFX_BlockBuffer that was stored and manipulated in CFDE_XMLSyntaxParser. Methods have been added to BlockBuffer to satisify the usages in the syntax parser. Change-Id: I1107c343ce267283c4c45aa3ae1bbfa93c24079f Reviewed-on: https://pdfium-review.googlesource.com/3816 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-06Change the CFDE_XMLSyntaxParser start and end typesNicolas Pena
This CL changes m_pStart and m_pEnd to FX_FILESIZE. This is the appropriate type because the values are used as such by the CFDE_XMLParser. Change-Id: I6988c5e520f52c39053d682d9e2ce713883c8b54 Reviewed-on: https://pdfium-review.googlesource.com/3850 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-06Convert XMLSyntaxParser buffer to vector.dan sinclair
This Cl updates the m_pBuffer pointer to a vector. Change-Id: Ib971d224376122a1d5ebf5bb0e712db552df2342 Reviewed-on: https://pdfium-review.googlesource.com/3815 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-06Change some fxbarcode to use return values.Lei Zhang
No caller cares about the exception values anyway. Remove the unused ones. Also use more std::unique_ptr to stop potential leaks. Change-Id: Ic5955fb0d879f55e1c6a005c0204df50246dab19 Reviewed-on: https://pdfium-review.googlesource.com/3715 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>