summaryrefslogtreecommitdiff
path: root/xfa
AgeCommit message (Collapse)Author
2018-09-11Make flate decode functions' buffer out parameter unique_ptrs.Lei Zhang
Change-Id: Idb14846e87a8287dd911b0a2f7a32146e86c2af7 Reviewed-on: https://pdfium-review.googlesource.com/41853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-04Remove unneeded fpdf_parser_decode.h #includes.Lei Zhang
Change-Id: I2c52828c25b4941669503328517c12a0a1dd770e Reviewed-on: https://pdfium-review.googlesource.com/41850 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-29Use pdfium::span<> in fpdf_parser_decode.h helper functions.Tom Sepez
Change-Id: Ib0a2bd21fe4304163cf9c080e07475e7c033c299 Reviewed-on: https://pdfium-review.googlesource.com/41570 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-29Move XFA_RESOLVENODE_TagName to xfa_resolvenode_rs.h.Lei Zhang
Change-Id: I600013bcbf44661fd132ce786bcd08980a7ecd4e Reviewed-on: https://pdfium-review.googlesource.com/41572 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Rename CFX_DIBSource to CFX_DIBBase.Tom Sepez
It is not a source from which you can get CFX_DIBs, but rather a base class from which all DIBs inherit. Do the same thing for the CPDF_DIBSource wrapper class. Mechanical change apart from adding a one-line comment in cfx_dibbase.h Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184 Reviewed-on: https://pdfium-review.googlesource.com/41352 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Pass unique_ptr<> to CFX_MemoryStream constructorTom Sepez
Proves we own the memory that the class will eventually free. Change-Id: Ie9523da8db738e7478a1c73e3e1a6b24aed38442 Reviewed-on: https://pdfium-review.googlesource.com/41290 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fix shadowed variablesRyan Harrison
This CL fixes instances of variable shadowing that are discovered by turning on -Wshadow. BUG=pdfium:1137 Change-Id: I418d50de89ecbeb12e85b23a358bc61e8f16e888 Reviewed-on: https://pdfium-review.googlesource.com/41150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-08-23Remove bool arg from CFWL_Widget::GetBorderSize().Tom Sepez
The arg determined returning value for X or Y dimension. Splitting into two separate methods is much clearer at the call sites. Add missing consts along the way. Change-Id: I498ea5a8fb4618166727b8a08ade6fcca2111d17 Reviewed-on: https://pdfium-review.googlesource.com/41170 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Remove m_bTruncated flag from CBC_PDF417Writer.Henrique Nakashima
The flag is unused. Change-Id: I15eb3e20e6a632ae2aa2afc19cb09d2402e607e0 Reviewed-on: https://pdfium-review.googlesource.com/41031 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-22Use UnownedPtr<> in CXFA_RenderContext.chromium/3531Tom Sepez
Change-Id: I0658f63a0d8fb8a5233e135dacedc4153532f01d Reviewed-on: https://pdfium-review.googlesource.com/41112 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-22Mark CFX_XMLNode pointers as const in various places.Lei Zhang
Change-Id: I86c6f7526e2ef4c3e8de30ebaff223095ee70fc4 Reviewed-on: https://pdfium-review.googlesource.com/40811 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-22Add GetLowerCaseElementAttributeOrDefault() helper function.Lei Zhang
CXFA_TextParser::GetEmbeddedObj() does the same thing twice in a row. Change-Id: Ia46a0a697ff667b2884cea82258399889dbb5dc6 Reviewed-on: https://pdfium-review.googlesource.com/40775 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-22Simplify GetEmbeddedObj() methods.Lei Zhang
Change-Id: I976a8841f1519310cbf934103336dc050a7c293d Reviewed-on: https://pdfium-review.googlesource.com/40773 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-21Use UnownedPtr<> to theme provider in cfwl_widgetproperties.hTom Sepez
Mark two other fields which must remain raw. Change-Id: Idcd9b074aad23f35dc6607feeaa4fa6701efffaa Reviewed-on: https://pdfium-review.googlesource.com/40916 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Use UnownedPtr<> in xfa_resolvenode_rs.hTom Sepez
Change-Id: I4420fbf7402a8b08e33ca525e98690643d59efdf Reviewed-on: https://pdfium-review.googlesource.com/40930 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Remove excessive padding above and below PDF417 barcodes.Henrique Nakashima
Bug: pdfium:1135 Change-Id: Iea16a65a5eebcb914192eb49de17a2c4eda83320 Reviewed-on: https://pdfium-review.googlesource.com/40690 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-21Change GetEmbbedObj() to return an Optional<WideString>.Lei Zhang
Change "EmbbedObj" to "EmbeddedObj". Change-Id: Ia6a8ec45b4563b3ec64b91a10e087dbf32a8d8db Reviewed-on: https://pdfium-review.googlesource.com/40751 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-21Optimize rendering of two dimensional barcodes: defer upscale.Henrique Nakashima
Defer upscaling as late as possible so that intermediary data structures are smaller. Made a couple of changes along the way to preserve the barcode correctness and fix some padding issues. For my example, this is a ~21x improvement in rendering time, down from ~190ms per barcode to ~9ms. Bug: 872907, pdfium:1135 Change-Id: If532e0f168f02fea9c31d473f34c0009da4f4612 Reviewed-on: https://pdfium-review.googlesource.com/40010 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-21Fix some IWYU issues in xfa/fxfa/.Lei Zhang
Change-Id: Ia002b26d70f5d6e5b66a3341978483636f943db8 Reviewed-on: https://pdfium-review.googlesource.com/40672 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-21Fix one-of property JS errors.Henrique Nakashima
Introduced in: https://pdfium-review.googlesource.com/c/pdfium/+/18271/13/xfa/fxfa/parser/cxfa_node.cpp Bug: 872899 Change-Id: I9e71e384cd8682dd09378f0cb92ae443138a19d8 Reviewed-on: https://pdfium-review.googlesource.com/40870 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-20Use UnownedPtr<> in CXFA_GEColor.Tom Sepez
Small size penalty in removing the union, but unions can lead to type errors. Change-Id: I8ff9fd63b1f87d05df18db17edbaf770226e1252 Reviewed-on: https://pdfium-review.googlesource.com/40790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-20Fix nits in CXFA_Node.Lei Zhang
- Make methods const or move them into the anonymous namespace. - Make GetItemLabel() return the value. Change-Id: Ic6938d14e7efa09f1851950c28d3c855690d9aaf Reviewed-on: https://pdfium-review.googlesource.com/40650 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-08-20Clean up CXFA_Graphics::SetLineDash().Lei Zhang
Fix some nits in CXFA_FFField as well. Change-Id: I6d0d4569322a01192cdd4bf9d98325ff86642abe Reviewed-on: https://pdfium-review.googlesource.com/40651 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-20Avoid an integer overflow in CFX_RTFBreak.Lei Zhang
The root cause is an extremely large reserve count. Limit it to the size of the widget. BUG=chromium:875282 Change-Id: Ia3bbb07503ce349adc2662731d22317bda7df4ef Reviewed-on: https://pdfium-review.googlesource.com/40652 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-20Use more consts in CFX_Break.Lei Zhang
Change-Id: I57cd74581849a8f434f64c4ec3c4ad3ce1f92546 Reviewed-on: https://pdfium-review.googlesource.com/40630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Remove optionals in CXFA_LayoutPageMgr methods.Tom Sepez
Change-Id: If57552b9e48d9607f84e853aadb2742a8c135b46 Reviewed-on: https://pdfium-review.googlesource.com/40470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-17Remove optionals from CXFA_NodeHelper::NodeAcc_TraverseSiblings().Tom Sepez
Change-Id: I0a20734c0ad3f6bbc83a85a53f09b5e8ccdfa548 Reviewed-on: https://pdfium-review.googlesource.com/40450 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-17Remove optionals from CXFA_TextLayout methods.Tom Sepez
Change-Id: I832b694dea58de354ef115bacc11f92e072abe80 Reviewed-on: https://pdfium-review.googlesource.com/40430 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-16Remove optional argument from CXFA_LayoutProcessor::StartLayout()Tom Sepez
Change-Id: I559d8208b8415e42e520e81114f9d2d66e74b288 Reviewed-on: https://pdfium-review.googlesource.com/40391 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-16Replace optional bool bDrawFocus with enum type.Tom Sepez
Change-Id: Ide4a972337afaf346e46edc4ede48140cd4544c1 Reviewed-on: https://pdfium-review.googlesource.com/40390 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-16Remove optional argument from ResolveNodes_GetParent().Tom Sepez
Conformity with standards. Change-Id: Ia718700526477fd1826eb4900ab333ebf4c8a517 Reviewed-on: https://pdfium-review.googlesource.com/40353 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-16Allow PDF417 barcodes to reduce modules by shaving off padding.Henrique Nakashima
The way it was working before is: Look at the width and height provided for the barcode. If the maximum number of codewords to fit in that space was within the spec limits (1 <= cols <= 30 and 3 <= rows <= 90), cram as many codewords as possible. The unused space was filled with padding. With this CL, instead look at the amount of content that needs to fit into the barcode and favor fewer codewords rather than as many as possible. Bug: pdfium:1135 Change-Id: Ia96be82ec7c5f4f920cff58def1a44000bf04761 Reviewed-on: https://pdfium-review.googlesource.com/40350 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-16Add a way to save a barcode generated bitmap to a .png.Henrique Nakashima
This is useful for debugging and validation purposes. The hashes that are in BarcodeTest are not necessarily for valid outputs. This CL refactors the code in embedder_test.png that already does this, moving it to testing/utils where unit tests can access it too. Bug: pdfium:1135 Change-Id: I6f1d70a4e133f8f04dbe52646087f99c448e95f8 Reviewed-on: https://pdfium-review.googlesource.com/40152 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-16Optimize rendering of two dimensional barcodes: deduplicate regions.Henrique Nakashima
Reduce the logical size of the barcode by removing unnecessary region duplication. As far as I can tell, the line thickness is useless and the aspect ratio causes arbitrary changes in rounding, but ultimately the dimensions of a barcode are defined by its width and height, rather than by this ratio. The improvement with this CL is from ~580ms to ~390ms per barcode, so about 1.5x. Combined with https://pdfium-review.googlesource.com/c/pdfium/+/40010 the improvement is to ~15ms, which is about 39x. This also fixes the rendering of the barcode in the pixel and corpus tests. You can verify this pointing a barcode reader app at the screen. It does not however fix every case, as the unit test is still unreadable. Bug: 872907, pdfium:1135 Change-Id: Ic28e60f54719552cfe69ace7ebc3f730c338a129 Reviewed-on: https://pdfium-review.googlesource.com/40030 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-16Do not set barcode module width and height in unittest.Henrique Nakashima
Setting these to anything outside of [1, 10] is non-op. Not sure why the test did that, but these lines have no effect. Bug: pdfium:1135 Change-Id: I175d07137674ab1b6b9c86b3bc68b4a128601b9f Reviewed-on: https://pdfium-review.googlesource.com/40250 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-15Remove optional prepend argument from matrix transformations.Tom Sepez
Callers always want one form or the other, so split into separate methods. This may save some branching. Remove forms that are not used. Put more helpful helper function in .cpp file. Change-Id: I4e025de7f69ce3f323cd290a5dc8202dd4f8ca07 Reviewed-on: https://pdfium-review.googlesource.com/40270 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-15Make CFX_MemoryStream always consecutive.chromium/3524Lei Zhang
Non-consecutive mode has questionable correctness and is not an obvious performance win. Change-Id: Idaa66e5ee5c4604628a0f55b67d5a04ab47ea5ec Reviewed-on: https://pdfium-review.googlesource.com/40050 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-14Remove CFX_BufferSeekableReadStream.Lei Zhang
Replace it with CFX_ReadOnlyMemoryStream, which does the same thing. Take some checks from CFX_BufferSeekableReadStream and add them CFX_ReadOnlyMemoryStream. Change-Id: I25554c3aec3ec96967f8df16ca68a64dba121b6f Reviewed-on: https://pdfium-review.googlesource.com/40070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-14Remove more default arg = nullptr cases.Tom Sepez
Bring in line with standards. Remove argument entirely for mac code that is always nullptr. Change-Id: I0710bdbd51fc0bc2e1d428ef44976be39a631147 Reviewed-on: https://pdfium-review.googlesource.com/40091 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-14Remove |bTakeOver| parameter from CFX_MemoryStream ctor.Lei Zhang
It is always true now. BUG=pdfium:263 Change-Id: I74fd0091f5815701718e8cd5acc6e7a0de772a85 Reviewed-on: https://pdfium-review.googlesource.com/40031 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-13Make CFX_ReadOnlyMemoryStream take a span.Lei Zhang
Change-Id: Id097320ab2d9b5d1579582e5797e29c701499501 Reviewed-on: https://pdfium-review.googlesource.com/39991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-13Use CFX_ReadOnlyMemoryStream in more places.Lei Zhang
More const pointers, less const_casts. BUG=pdfium:263 Change-Id: I47fc6d8f2f837390e40ad22d8b67946065294eaa Reviewed-on: https://pdfium-review.googlesource.com/39879 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-10Kill some optional parameters that are always supplied.Tom Sepez
No need to even bring any .cpp files in line with these headers. Change-Id: I934169d77ae09adc11f02e5ea92b1f8b078c9477 Reviewed-on: https://pdfium-review.googlesource.com/39876 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-10Remove const args and const_casts where not required.Tom Sepez
Introduce const/non-const versions of method where required. Part of the war on const_cast<>. Tidy one expression to use [] instead of .data(). Change-Id: I41e45669c79eee242ff2244c7dc3afcf6386a433 Reviewed-on: https://pdfium-review.googlesource.com/39852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-08Move ByteString::FromUnicode() to WideString::ToDefANSI()Tom Sepez
Turns out that "FromUnicode" is misleading in that, on linux, it simply removes any characters beyond 0xFF and passes the rest unchanged, so no unicode decoding actually takes place. On Windows, it passes it into the system function specifying FX_CODEPAGE_DefANSI, converting it into the so-called "default ANSI code plane", passing some characters, converting others to '?' and still others to 'A'. Either way, nothing resembling UTF8 comes out of this, so pick a better name. These now immediately look suspicious, so a follow-up CL will see which ones should really be WideString::UTF8Encode() instead. Making this a normal method on a widestring rather than a static method on a bytestring feels more natural; this is parallel to the UTF8Encode and UTF16LE_Encode functions. Add a test that shows these conversions. Change-Id: Ia7551b47199eba61b5c328a97bfe9176ac8e583c Reviewed-on: https://pdfium-review.googlesource.com/39690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-08Limit size of expression list in FormCalc parserchromium/3517Ryan Harrison
Limits the number of elements that can be added to the expressions list in the FormCalc parser. This handles cases like long strings of ! repeated, since ! is a valid identifier and identifiers are valid expression, even though it will be no-op. This is another case of something that is valid, but stupid. BUG=chromium:870385 Change-Id: I8e34ce00bcbe4499e0a45bd5dc38541793144481 Reviewed-on: https://pdfium-review.googlesource.com/39630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-07Use wide string addition in place of some Format() calls.Tom Sepez
Simpler, faster, and avoids platform idiosyncracies of wprintf(). Change-Id: I91676bc38199ca2c30936094ca145239f915bc53 Reviewed-on: https://pdfium-review.googlesource.com/39610 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-01Replace more unchecked casts with type conversion funtions.Tom Sepez
Change-Id: If3eb4396232daed28f2b63ffe1d110075c9299de Reviewed-on: https://pdfium-review.googlesource.com/39230 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-01Rename PageSetContainerLayoutItem to TraverseStrategy_PageSet.chromium/3509Tom Sepez
Provides consistency with the naming of other traverse strategies. Fix dubious casting inside the strategy. Change-Id: Ic96b1922ae1dc601a37c8c3b3dd0f118ab6b2eea Reviewed-on: https://pdfium-review.googlesource.com/39210 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>