summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
AgeCommit message (Collapse)Author
2016-09-13Stop converting widestring -> c_str -> widestring in several places.tsepez
Avoids a needless alloc and copy. Review-Url: https://codereview.chromium.org/2338553002
2016-09-13Get rid of memcmp in CFieldTree::Lookup()tsepez
Wide strings compare just fine on their own. Review-Url: https://codereview.chromium.org/2331233002
2016-09-13Make ipdf_formnotify a pure virtual interfacetsepez
Removes some unused code for the default implementation, Review-Url: https://codereview.chromium.org/2332983002
2016-09-12Remove GetDictBy("DR") from annot/field dictionariesnpm
We should not use DR field from annotation/field dictionaries, since these are not supposed to have one. In PDF spec 1.7, DR is defined only for the form dictionary, in 8.6.1. In addition, note 118 in Appendix H says "In PDF 1.2, an additional entry in the field dictionary, DR, was defined but was never implemented. Beginning with PDF 1.5, this entry is obsolete and should be ignored." The changes in CBA_FontMap fix the bug below. The changes in cpvt_generateap do not affect the bug but follow the reasoning from the above paragraph. BUG=pdfium:538 Review-Url: https://codereview.chromium.org/2337673002
2016-09-09Define behaviors of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw.chromium/2858chromium/2857chromium/2856jaepark
Previously, PDFium only supported widget annotations to draw forms. As we've implemented other annotations, the behavior of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw changed. So, this CL clearly defines what needs to be done in FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. This CL first assumes that PDFium users will always call FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw to render PDF pages, because otherwise they are not able to support PDF forms. FPDF_RenderPageBitmap_Retail should only deal with non-widget annotations, such as highlight, underline, text, etc. If FPDF_ANNOT flag is passed, non-widget annotations are drawn. Otherwise, they are hidden. FPDF_FFLDraw should only deal with annotations that requires user-interaction, such as widget annotations and popup annotation. Since popup annotation is associated with non-widget annotation, they should not be drawn if the associated annotation is hidden. Thus, if FPDF_ANNOT flag is passed, popup annotations are drawn. Otherwise, they are hidden. Widget annotations should be always drawn regardless of FPDF_ANNOT flag since they need to be always displayed for PDF forms. Also, roll DEPS for testing/corpus to 8485b30. BUG=pdfium:594 Review-Url: https://codereview.chromium.org/2323203002
2016-09-08Check whether the annotation content is empty using CFX_WideString.jaepark
CFX_ByteString cannot properly check whether the contents string is empty because the first two bytes of text strings encoded in Unicode are always ASCII 254 followed by 255. So if we get contents in CFX_ByteString, the length will always be 2. Also, roll DEPS for testing/corpus to 608bf04. Review-Url: https://codereview.chromium.org/2293403003
2016-09-06Make CPDF_ContentMarkData private to CPDF_ContentMarktsepez
Review-Url: https://codereview.chromium.org/2312743005
2016-09-06Move ShouldGenerateAPForAnnotation check to CPDF_Annot::GenerateAPIfNeededtonikitoo
By doing this, we simplify the code in cpvt_generateap.cpp, and avoid calling CPVT_GenerateAP methods altogether, when it is known that they are bailing out. This is a preparation to fix pdfium bug 585. BUG=pdfium:585 Review-Url: https://codereview.chromium.org/2310873002
2016-09-01Fix leaks due to created popup annotationschromium/2847weili
When we create popup annotations, we also create the dictionary associated with it. For regular annotations, the dictionary associated with an annotation is not owned by annotation, and will be released separately. But our created dictionary is not associated with any other data structure, it would be leaked if not released by the associated annotation. Add a boolean to indicate the ownership to the dictionary, and release the owned dictionary during the destruction of an annotation. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2301613002
2016-09-01Make CPDF_ContentMark have a CPDF_ContentMarkData.tsepez
This one doesn't require an explict Emplace(), as the object seems to get constructed only as a side-effect of making a private copy. Review-Url: https://codereview.chromium.org/2298953002
2016-08-31Use enum class for subtypes of CPDF_Annot.jaepark
Comparing CFX_ByteString for annotation subtypes is inefficient and error-prone. This CL uses enum class to compare annotation subtypes. Also, remove unused IPDFSDK_AnnotHandler::GetType() and FSDK_XFAWIDGET_TYPENAME. Review-Url: https://codereview.chromium.org/2295953002
2016-08-29Display content of the annotation when mouse hover.jaepark
Each annotation has its contents, and users should be able to see the contents. In this patch, PDFium creates a Popup annotation for each annotation and stores the author and the content. When a user mouse hover on the annotation, PDFium draws the corresponding Popup annotation and displays the content. Also, roll DEPS for testing/corpus to 5867fa6. BUG=62625 Review-Url: https://codereview.chromium.org/2273893002
2016-08-29Move CFX_SubstFont and CTTFontDesc into their own filesnpm
Review-Url: https://codereview.chromium.org/2292503002
2016-08-26Rename CPDFSDK_Annot::GetType to CPDFSDK_Annot::GetAnnotSubtype.jaepark
CPDFSDK_Annot::GetType should be renamed to GetAnnotSubtype as it returns annotation subtype. Also, CPDFSDK_Annot::GetSubType is only used to check if the annotation is signature widget. Thus, change the method to IsSignatureWidget. Lastly, rename CPDF_Annot::GetSubType to CPDF_Annot::GetSubtype to match with spec. Review-Url: https://codereview.chromium.org/2287703002
2016-08-26Revert "Remove the document tagged code as it is unused."npm
The code that was deleted is being used by Android foxit viewer This reverts commit dbfc3522a6ee24d17f2c50a5dcc465db52a280ee and updates the #includes Review-Url: https://codereview.chromium.org/2281083002
2016-08-25CPDF_Annot::GetRect() should return CFX_FloatRect.jaepark
Avoid using reference argument and return CFX_FloatRect instead. Review-Url: https://codereview.chromium.org/2278153005
2016-08-25Fix infinite loops in FPDF_GetFullName().thestig
BUG=444446 Review-Url: https://codereview.chromium.org/2271373003
2016-08-24Lazy generate an "AP" when an Annot's hidden state changestonikitoo
Now that Document::getAnnot works and annotation instances can have its properties changed, consider the following scenario: - A PDF content has an annotation without AP and CPVT_GenerateAP is called to generate one. - However the annotation also has its hidden flag set (/F 2), and CPVT_GenerateAP bails out earlier, not generating an AP. - When the PDF's Javascript runs, it acquires an instance of this annotation object, bounded to JS using Document::getAnnot(), and set its "hidden" flag to false. - At this point, the annotation should get drawn, but it does not because its "AP" was never generated. CL fixes this scenario by making PDFium able to lazy generate APs, if needed. BUG=pdfium:492 Review-Url: https://codereview.chromium.org/2265313002
2016-08-23Fix stack overflow in object Clone() functionsweili
For some complex objects such as CPDF_Dictionary, CPDF_Array, CPDF_Stream, and CPDF_Reference, Clone() could be executed with infinite recursion to cause the stack overflow. Fix this by checking already cloned objects to avoid recursion. BUG=pdfium:513 Review-Url: https://codereview.chromium.org/2250533002
2016-08-22Generate default AP stream for text annotation.jaepark
This patch generates a default AP stream for text annotation. The AP stream only draws a symbol, which represents the presence of text annotation at the point. Also, roll DEPS for testing/corpus to afbac94 to test text annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2270493002
2016-08-16Hidden annotations should not be drawntonikitoo
Now that PDFium supports drawing of more annotation types, it should also respect the "hidden" flag that annotations might feature. For instance, in IE/Acroread if an annotation is flagged as "hidden" it does not get drawn. CL adds a check for the specific "hidden" flag, not drawing annotation that are flagged with it, in order to match IE + acrobat reader behavior. The "flags" definition can be seen by looking at "/F {value}" syntax in a PDF file source, where {value} is an predefined integer value. Test: PDF files being added in [1]. [1] https://codereview.chromium.org/2239713003/ BUG=62625 Review-Url: https://codereview.chromium.org/2239853002
2016-08-10Move CFX_RenderDevice, CFX_FxgeDevice, and CFX_GraphStateData into their own ↵npm
files. This is the third CL to separate fx_ge into classes, one per file. All fx_ge.h includes had to be replaced with new includes The method definitions for CFX_FxgeDevice were not moved to a single file. These methods are defined in two folders different from fxge/ge, so they were left untouched for now. Review-Url: https://codereview.chromium.org/2223213002
2016-08-09Generate default AP stream for ink annotation.jaepark
This patch generates a default AP stream for ink annotation so that ink annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to 4119f8e to test ink annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2232553002
2016-08-09Fix typos of the word outer.thestig
Review-Url: https://codereview.chromium.org/2226003003
2016-08-09Generate default AP stream for circle annotation.jaepark
This patch generates a default AP stream for circle annotation so that circle annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to 71d1f22 to test circle annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2228093002
2016-08-09Generate default AP stream for square annotation.jaepark
This patch generates a default AP stream for square annotation so that square annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to 7f07c22 to test square annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2219683002
2016-08-08Add CPDF_Array::IsEmpty().jaepark
Using IsEmpty() is more readable than using GetCount() == 0. Review-Url: https://codereview.chromium.org/2226113002
2016-08-08Move CFX_ClipRgn and CFX_PathData into their own files.npm
This is the second CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files. CFX_ClipRgn is moved to core/fxge/ge because it is only used in core/fxge. The header for CFX_PathData is left in core/fxge/include since it is used elsewhere. Review-Url: https://codereview.chromium.org/2216853004
2016-08-04Remove unnecessary casting in CPVT_GenerateAP.jaepark
Since CFX_BinaryBuf::GetBuffer() returns uint8_t*, casting to uint8_t* is unnecessary. Review-Url: https://codereview.chromium.org/2218633002
2016-08-03Generate default AP stream for squiggly annotation.jaepark
This patch generates a default AP stream for squiggly annotation so that squiggly annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to a89e4fb to test squiggly annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2206773004
2016-08-02Generate default AP stream for strike out annotation.jaepark
This patch generates a default AP stream for strike out annotation so that strike out annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to ddc1938 to test strike out annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2206083002
2016-08-02Generate default AP stream for underline annotation.jaepark
This patch generates a default AP stream for underline annotation so that underline annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to cae29d1 to test underline annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2205543002
2016-08-02Splitting fpdfdoc/doc_* part III.dsinclair
This CL cleans up the remaining doc_* files, splitting into .h and .pp files as needed. Review-Url: https://codereview.chromium.org/2190983002
2016-08-02Use PaintOperation instead of bFillOrStroke in CPVT_GenerateAP.jaepark
Also, use PaintOperation instead of bStrokingOperation in CPDF_DefaultAppearance. Review-Url: https://codereview.chromium.org/2197353002
2016-08-02Splitting fpdfdoc/doc_* part II.dsinclair
This splits the doc_ocg, doc_vt and doc_basic files into individual class files. Review-Url: https://codereview.chromium.org/2187073005
2016-08-02Splitting fpdfdoc/doc_* part Idsinclair
The first of several CLs to split the core/fpdfdoc/doc_* files up to individual class files. Review-Url: https://codereview.chromium.org/2192823002
2016-08-01Support PDF highlight annotation with opacity.jaepark
BUG=62625 Review-Url: https://codereview.chromium.org/2202063002
2016-07-29Generate default AP stream for highlight annotation.jaepark
This patch generates a default AP stream for highlight annotation so that highlight annotations without AP stream can be displayed. BUG=62625 Review-Url: https://codereview.chromium.org/2193983002
2016-07-29Use bool instead of FX_BOOL as return values in CPVT_GenerateAP.jaepark
Review-Url: https://codereview.chromium.org/2196903002
2016-07-28Remove the document tagged code as it is unused.dsinclair
The fpdf_tagged.h, tagged_int.h and doc_tagged.cpp code is currently unused and can be removed. Review-Url: https://codereview.chromium.org/2188213002
2016-07-28Split fpdfdoc/include/fpdf_doc.h into individual classes.dsinclair
This CL splits the header file apart. The cpp files are not touched as part of this CL, they will be done as a followup. This de-duplicates the fpdf_doc.h BUG=pdfium:249 Review-Url: https://codereview.chromium.org/2183313004
2016-07-26Use smart pointer for CPDF_Form in CPDF_Annot.jaepark
CPDF_Annot owns CPDF_Form, so use std::unique_ptr for memory management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2189463003
2016-07-20Move CPDF_Annot and CPDF_AnnotList to their own header.jaepark
Review-Url: https://codereview.chromium.org/2163133002
2016-07-20Pass CPDF_Document instead of CPDF_AnnotList when constructing CPDF_Annot.jaepark
CPDF_AnnotList in CPDF_Annot is only used for getting CPDF_Document. Review-Url: https://codereview.chromium.org/2166883002
2016-07-18Remove default params in CPDF_VariableText.dsinclair
This Cl cleans up the default params and any supporting code if necessary. Review-Url: https://codereview.chromium.org/2146993002
2016-07-18Removing default params from CFX_Edit.dsinclair
This CL removes all of the default params from CFX_Edit. They are either moved to the callsite or removed completely if unused. Review-Url: https://codereview.chromium.org/2152473002
2016-07-13Remove RichText support from fpdfsdk/fxedit.dsinclair
This CL removes the support code for RichText from fxedit as it is currently unused. Review-Url: https://codereview.chromium.org/2146503002
2016-07-12Rename methods in CPDF_Interform.jaepark
EnableUpdateAP acutally sets s_bUpdateAP to the given parameter. So SetUpdateAP is accurate method name. Review-Url: https://codereview.chromium.org/2140423002
2016-07-11Use smart pointers for class owned member variablesweili
Replace raw member variables to smart pointer type to better maintain the ownership and to ease the management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2136683002
2016-06-21Use FXFONT defines in place of integers.thestig
Fix nits along the way. Review-Url: https://codereview.chromium.org/2083943003