summaryrefslogtreecommitdiff
path: root/pdf/pdf_form.c
AgeCommit message (Collapse)Author
2013-05-06Fix formatting.Tor Andersson
2013-03-25Support creation of Ink annotations in MuPDF libraryPaul Gardiner
2013-03-22Squash some warnings.Robin Watts
Some -Wshadow ones, plus some 'set but not used' ones.
2013-03-18Auto-generate appearance streams for strikeout, underline, highlightPaul Gardiner
This fixes bug #693664, and also simplifies app code. The example file attached to the bug produces strange results, but that is because the QuadPoint information is incorrect.
2013-03-04Avoid interactive features causing bloat in mutoolPaul Gardiner
2013-02-26Implement annotation deletion, with necessary changes to partial updatePaul Gardiner
2013-02-22Add fz_get_annot_typePaul Gardiner
2013-02-19Fix whitespace.Tor Andersson
2013-02-06Change to pass structures by reference rather than value.Robin Watts
This is faster on ARM in particular. The primary changes involve fz_matrix, fz_rect and fz_bbox. Rather than passing 'fz_rect r' into a function, we now consistently pass 'const fz_rect *r'. Where a rect is passed in and modified, we miss the 'const' off. Where possible, we return the pointer to the modified structure to allow 'chaining' of expressions. The basic upshot of this work is that we do far fewer copies of rectangle/matrix structures, and all the copies we do are explicit. This has opened the way to other optimisations, also performed in this commit. Rather than using expressions like: fz_concat(fz_scale(sx, sy), fz_translate(tx, ty)) we now have fz_pre_{scale,translate,rotate} functions. These can be implemented much more efficiently than doing the fully fledged matrix multiplication that fz_concat requires. We add fz_rect_{min,max} functions to return pointers to the min/max points of a rect. These can be used to in transformations to directly manipulate values. With a little casting in the path transformation code we can avoid more needless copying. We rename fz_widget_bbox to the more consistent fz_bound_widget.
2013-01-31Add support for annotation creationPaul Gardiner
2013-01-30Improve exception handling in fz_bound_t3_glyphPaul Gardiner
Also simplify some other functions using pdf_dict_puts_drop
2013-01-30Always pass value structs (rect, matrix, etc) as values not by pointer.Tor Andersson
2013-01-25Silence some warnings.Tor Andersson
2013-01-04Make token enum a type to ease debuggingSebastian Rasmussen
2013-01-02Bug 693503: Fix memory leak in forms handlingRobin Watts
An unused dictionary reference could be left dangling. Simple fix is to drop the reference after use. Problem found in a test file, 2785.pdf.asan.6d.1985 supplied by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google Security Team using Address Sanitizer. Many thanks!
2012-12-19Bug 693503: 'Flatten' display list for all type3 glyphs.Robin Watts
It is perfectly allowable to have type3 glyphs that refer to other type3 glyphs in the same font (and in theory it's probably even possible to have type3 glyphs that refer back and forth between 2 or more type3 fonts). The old code used to cope with this just fine, but with the change to 'early loading' of the glyphs to display lists at interpret time a problem has crept in. When we load the type 3 font, we load each glyph in turn. If glyph 1 tries to use glyph 2, then we look up the font, only to find that that the font has not been installed yet, so we reload the entire font. This gets us into an infinite loop. As a fix for this, we split the loading of the type3 font into 2; we load the font as normal, then allow the font to be inserted into the list of current fonts. Then we run through the glyphs in the font 'preparing' them (turning them into display lists). This solves the infinite loop issue, but causes another problem; recursive references (such as a font holding a display list that contains a text node that contains a reference to the original font) result in us never being able to free the structures. To avoid this, we insist on never allowing type3 glyphs to be referenced within a type3 display list. The display lists for all type3 glyphs are therefore 'flat'. We achieve this by adding a 'nested' flag to the pdf command stream interpreter structure, and setting this in the case where we are running a glyph stream. We check for that flag in the type3 glyph render function, and if present, we force the 'render_direct' path to be used. Finally, we ensure that fz_text groups are not needlessly created with no contents. Problem found in 2923.pdf.asan.22.2139, a test file supplied by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google Security Team using Address Sanitizer. Many thanks!
2012-12-13Forms: refactor form resetPaul Gardiner
The way the forms to be reset is specified is used also in form submission. This commit pulls out that selection method as a separate function that returns the set of affected forms as a pdf array object.
2012-11-30Bug 693290: Various fixes found from fuzzing.Robin Watts
Thanks to zeniko for finding various problems and submitting a patch that fixes them. This commit covers the simpler issues from his patch; other commits will follow shortly. * Out of range LZW codes. * Buffer overflows and error handling in image_jpeg.c * Buffer overflows in tiff handling * buffer overflows in cmap parsing. * Potential double free in font handling. * Buffer overflow in pdf_form.c * use of uninitialised value in error case in pdf_image.c * NULL pointer dereference in xps_outline.c
2012-11-21Forms: ensure changed widgets are marked dirty rather than parent fieldPaul Gardiner
09+20computer+20fx-fo-dx-adr-mx.pdf has a "PROJECT TITLE" field that appears on every page, but needs setting only on one page. This commit makes that field update correctly.
2012-11-20Obsess about whitespace.Tor Andersson
2012-11-08Forms: correctly handle setting the value of a checkbox fieldPaul Gardiner
2012-11-08Forms: handle all color types in Field.setTextColorPaul Gardiner
2012-11-07Javascript: implement Field.namePaul Gardiner
2012-11-01Forms: extend setFillColor implementation to include text widgetsPaul Gardiner
Also update pdf_dict_puts so that passing NULL to val deletes the terminal key. Update pdfapp.c to update the screen between passing a mouse event and invoking a dialog box for value entry Extend javascript wrapper to handle all color spaces
2012-10-31Forms: add focus and blur actionsPaul Gardiner
2012-10-29Add fz_update_pagePaul Gardiner
Regenerate dirty appearance streams and report changed annotations since last call. Also include a partial revert of changes in 96f335bc, that turn out not to be necessary. fz_update_page must now be called between each document-changing event and the next render. pdfapp.c and the android app have been updated to do so, but do not yet take advantage of the possibility to render only the updated areas of the screen.
2012-10-29Forms: always use inherited version of default appearanceSebastian Rasmussen
2012-10-16Forms: avoid the need to reload the page on every changePaul Gardiner
Add pdf_update_annot, which is called before rendering an annotation, and checks that the annotation structure has correct information. There are three reasons the information can be out of date. Attributes of a field may have been changed such that its appearance stream needs updating. In this case the field will have have "Dirty" added to its dictionary The mouse may have changed state over the field, and a different appearance stream needs selecting. The annotation structure now records the mouse states for which the current appearance stream is acceptable. The field may have changed state as recorded by its "AS" value, and a different appearance stream needs selecting.
2012-09-19Forms: handle print request, both from javascript and from named actionPaul Gardiner
Currently the app windows app responds with a message box explaining that the MuPDF library passes print requests to the app, but the app does not implement printing.
2012-09-19Forms: handle 'additional' actions for mouse up and mouse downPaul Gardiner
2012-09-19Forms: correct bug in form resetPaul Gardiner
If the 'fields' parameter is not present then all fields should be reset
2012-09-18Forms: improve cpp/c interface regarding exceptionsPaul Gardiner
Three alterations: We were previously being careful to avoid throwing exceptions in the DOM-implementation callbacks because these were being called directly from C++. This commit adds three veneers that turn exceptions into warnings, hence allowing the callbacks to be written in usual mupdf style. Protect the "field" callbacks from executing with a NULL field. Ensure that the event object is set up before executing A actions
2012-09-04Forms: mass renaming for the sake of consistencyPaul Gardiner
2012-08-31Forms: rework form reset action to use new method introduced for JSPaul Gardiner
2012-08-31Forms: implement javascript doc.resetForm methodPaul Gardiner
2012-08-31Forms: don't focus hidden fieldsPaul Gardiner
2012-08-31Forms: keep checkbox and radio button values up to datePaul Gardiner
2012-08-29Forms: implement javascript Field.display propertyPaul Gardiner
2012-08-29Merge branch 'master' into formsPaul Gardiner
Conflicts: cbz/mucbz.c pdf/pdf_parse.c pdf/pdf_form.c xps/xps_zip.c
2012-08-24Forms: avoid javascript action execution when engine not availablePaul Gardiner
This was necessary to avoid indirecting through a NULL pointer returned from pdf_js_get_event, but is a generally sensible restriction. Also separate the execution of the document-level javascript actions from the pdf_js contstructor, so that doc->js is set during those actions. Also add a missing const
2012-08-16Forms: correct the mechanism for detecting failed field validationsPaul Gardiner
2012-08-16Silence some warnings.Robin Watts
Avoid the C++ code complaining about casting string literals to non-const char *'s.
2012-08-16Forms: respond to failed validation in windows appPaul Gardiner
2012-08-10Forms: handle Keystroke and Validate actionsPaul Gardiner
2012-08-10Forms: move js-side event setup out of execute_actionPaul Gardiner
Makes it easier to alter the setup for some action types
2012-08-10Forms: alter the handling of the javascript event objectPaul Gardiner
2012-08-07Forms: simple appearance generation for choice widgetsPaul Gardiner
2012-08-07Forms: for choices with a single selection avoid an unnecessary arrayPaul Gardiner
Also delete the 'I' element to avoid the indexes and values disagreeing.
2012-08-07Forms: mark choice field dirty after value change (and fix error handling)Paul Gardiner
2012-08-02Forms: add document dirty flagPaul Gardiner