summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-09-13Remove more strcmp/memcmp usage.tsepez
Review-Url: https://codereview.chromium.org/2340513002
2016-09-13Split fsdk_mgr files apart.dsinclair
This CL separates the CPDFDoc_Environment, CPDFSDK_Document and CPDFSDK_PageView classes into their own h and cpp files. Review-Url: https://codereview.chromium.org/2335243002
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-12Fix some leaks associated with memory allocatorchromium/2859weili
Use CFX_DefStore to only replace CFX_FixedStore, but not CFX_StaticStore, since CFX_StaticStore has different behaviors. CFX_StaticStore doesn't require its users to explicitly call free(), it frees all the allocated memory during destruction. Use CFX_DefStore to replace CFX_StaticStore would cause leaks. Also remove two undeclared, but defined, functions. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2328403002
2016-09-12Fix leaked value object in NamedPropertySetterCallback()weili
When setting a new value for a V8 object property, the passed along pointer of CFXJSE_Value is only used, but needs to be released by the original owner. Use unique_ptr to have the pointer released automatically. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2328273004
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-12Verify value of prec before usingdsinclair
The fx_codec_jpx_opj code will attempt to do a 1 << (prec - 1). If the prec value is >=32 then that shift will overflow the int value. This CL adds a check that prec is < 32 before attempting the shift. BUG=chromium:633208 Review-Url: https://codereview.chromium.org/2334823002
2016-09-12Refactor CPDF_Document by creating new methodsnpm
- Methods GetPagesDict, ProcessNonbCJK, CalculateFlags, and CalculateEncodingDict created to reduce duplicated code. - Code nits Review-Url: https://codereview.chromium.org/2323793003
2016-09-12Make javascript field observe sdk documenttsepez
Review-Url: https://codereview.chromium.org/2337583002
2016-09-12Make wrapped JS Document observe C++-side object.tsepez
First of several patches to ensure JS objects don't track stale C++ objects. Review-Url: https://codereview.chromium.org/2323903002
2016-09-12change memcpy to memmove for potential nearby addressestracy_jiang
BUG=645186 Review-Url: https://codereview.chromium.org/2326103002
2016-09-12fix some uninitialized variableshong_zhang
BUG=627399 Review-Url: https://codereview.chromium.org/2328003002
2016-09-12Make CFX_Obeservable::Observer into a pointer-ish type;tsepez
This may be a better design because it avoids having a level of indirection that the Observer required. Review-Url: https://codereview.chromium.org/2326763002
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-09Delete unused methods and definitions from fxet_editnpm
Review-Url: https://codereview.chromium.org/2331453002
2016-09-08CPWL_Color::ConvertColorType should compare current color type with the ↵jaepark
given convert color type. Previously, it compred the given convert color type with itself. So CPWL_Color::ConvertColorType never converted the color into the given type. Review-Url: https://codereview.chromium.org/2326883002
2016-09-08explicit operator bool for CFX_RetainPtr and CFX_CountRefchromium/2855tsepez
Review-Url: https://codereview.chromium.org/2324733003
2016-09-08Reland of Fix leaked internal fontweili
Reland of Fix leaked internal font (patchset #2 id:60001 of https://codereview.chromium.org/2297303004/ ) In CFGAS_FontMgrImp::LoadFont(), a new internal font is created which is never released. It needs to be correctly marked as internal font to be released. Fix this by adding a new method to take the ownership of the font and mark it as internal font properly. The previous revert was caused by memory management errors which were fixed at https://codereview.chromium.org/2322043002/ BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2320213002
2016-09-08Delete unused methods in CPDF_Documentnpm
Review-Url: https://codereview.chromium.org/2323933002
2016-09-08Fix CPDFSDK_PageView cleanup.dsinclair
In https://pdfium.googlesource.com/pdfium/+/461eeafe191068ac8c32f2717907fc6a22a667d2 we moved the map cleanup for the page view to happen before the page view was destroyed and before we killed the annotation focus. The map removal must happen before the pageview is destroyed, but must happen after we've killed the annotation focus in order to not create duplicate page views which point to the same page. BUG=chromium:645122 Review-Url: https://codereview.chromium.org/2320253002
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-08Fix memory management errors for font loading and copyingweili
A few issues are fixed: --Change variable |m_bLogic| in CFX_Font to |m_bShallowCopy| to reflect its meaning better; --For a shallow copy of font, we must guarantee that the copied font will not be deleted until the shallow copy is deleted. So need to increase the src font's refcount when copying it; --The stream |m_pOwnedStream| needs to have matched new/delete These errors need to be fixed before we can properly delete all the fonts to address the leaks. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2322043002
2016-09-08Pass CFX_WideString further down widget callerstsepez
Avoid a couple of places where we copy the raw string back into a brand-new widestring. There are a few places where the difference between a null ptr and an empty string control the logic, and I left these as-is. Other places can just take the string by const ref. Review-Url: https://codereview.chromium.org/2323493002
2016-09-08Remove unused context parameter from JSGetStringFromIDtsepez
Clean up before using IDS_STRING_JSBADOBJECT in nearly all JS callbacks, which will happen in the next CL when we watch C-side object destruction. Add a "no permission" message as well. Review-Url: https://codereview.chromium.org/2319543003
2016-09-08Replace CJS_Runtime::Observer with CFX_Runtime<CJS_Runtime>::Observertsepez
Previously, the observer set a flag which conditionalized a null pointer return. Now, we just clear the pointer. Destruction order matters, so add a method to trigger notifications. Review-Url: https://codereview.chromium.org/2322743002
2016-09-08Switch to ValueOrDiedsinclair
We know the values are always valid at this point, so use ValueOrDie instead of ValueOrDefault. BUG=chromium:637984 Review-Url: https://codereview.chromium.org/2319343003
2016-09-08Fix leaks in class CFGAS_FontMgrImpweili
Two leak cases are addressed here: --In CFGAS_FontMgrImp::LoadFont(), calling LoadFace() is unnecessary since the following LoadFile() does the exact same thing. Calling LoadFace() without releasing the loaded face results in a leak; --|m_Hash2Fonts| in class CFGAS_FontMgrImp owns all the fonts stored in it. The fonts need to be deleted along with the container. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2322483003
2016-09-07Fix spelling of "Formated" in several variableschromium/2854tsepez
Review-Url: https://codereview.chromium.org/2318423002
2016-09-07Make Observers into a templated classtsepez
Review-Url: https://codereview.chromium.org/2311343003
2016-09-07Verify image dimentions before usingdsinclair
Verify the provided image size is within bounds before loading. BUG=chromium:639160 Review-Url: https://codereview.chromium.org/2323473002
2016-09-07Verify pattern start values.dsinclair
When calculating the starting x and y for a pattern it is possible to overflow the int value. Use checked math to make sure we don't overflow. BUG=chromium:637984 Review-Url: https://codereview.chromium.org/2317283002
2016-09-07Fixup CPDFSDK_PageView and CPDF_Page interactions.dsinclair
There are several issues when CPDFSDK_PageView and CPDF_Page interact, especially around deletion. This Cl fixes up several places where things go wrong working with these objects. BUG=chromium:632709 Review-Url: https://codereview.chromium.org/2319663002
2016-09-07Maybe avoid a copy in CPDF_RenderStatus::SelectClipPathtsepez
Use the shared copy-on-write version instead of the underlying CFX_GraphStateData since it may not always get modified. Review-Url: https://codereview.chromium.org/2316823002
2016-09-07Cleanup page when unloading in embedder testsdsinclair
When unloading a page in the embedder tests we need to cleanup the internal page map so if we load the page a second time we don't get a previously unloaded page. Review-Url: https://codereview.chromium.org/2322523002
2016-09-07Add observer for BAAnnots from Javascriptdsinclair
This Cl moves the observer code from the CPDFSDK_Widget up into the CPDFSDK_Annot base class and then adds a second observer for CPDFSDK_BAAnnot objects. This allows us to attach an observer to the Annot javascript class which will update its internal pointer to the BAAnnot if the BAAnnot is destroyed by the CPDFSDK_PageView being destroyed. BUG=chromium:642307 Review-Url: https://codereview.chromium.org/2306663002
2016-09-06Make CPDF_TextStateData private to CPDF_TextState.chromium/2853tsepez
Review-Url: https://codereview.chromium.org/2313083002
2016-09-06Do not re-create the page view when accessing from Document::removeField.dsinclair
When removing a field from the document we can force the recreation of a CPDFSDK_PageView by passing |true| as the last parameter to |GetPageView|. This will force a new page view to be created so we can delete a field from it and, we then end up with a dangling PageView. This CL passes |false| to |GetPageView| and skips removing the widget if we do not receive a pageView back from the document. BUG=chromium:644219 Review-Url: https://codereview.chromium.org/2312023004
2016-09-06Fix gn --check complaints about fxcrt. (try 2)thestig
Previous attempt: https://codereview.chromium.org/2289263005 It failed for the PDFium inside Chromium use case. This time the paths are relative. Review-Url: https://codereview.chromium.org/2308873002
2016-09-06Move CPDF_GraphState to CFX_GraphStatetsepez
The FX layer is spying on its private data, so make the job of ref-counting it live in FX as well, instead of up a layer at pdfapi. Pre-cursor to making this private and passing the graph state itself everywhere. Review-Url: https://codereview.chromium.org/2314223002
2016-09-06Make CPDF_ContentMarkData private to CPDF_ContentMarktsepez
Review-Url: https://codereview.chromium.org/2312743005
2016-09-06Make ColorStateData private to CPDF_ColorStatetsepez
Review-Url: https://codereview.chromium.org/2311313002
2016-09-06Use new Skia .gni file for sources, remove .gypis.brettw
This incorporates the changes from the following Chrome Skia build modifications: https://codereview.chromium.org/2301233002/ This file is provided by the Skia repo so the GN Chrome build doesn't have to make assumptions about the location and layout of Skia's GYP files. https://codereview.chromium.org/2299033006 Remove Skia GYP files from Chromium tree. Inlines the contents into the GN build. Review-Url: https://codereview.chromium.org/2316653003
2016-09-06Avoid leaking params if any entry bad.dsinclair
The call to png_set_pCAL can call into png_error for several reasons. This CL verifies that the params are valid before calling into png_set_pCAL. BUG=chromium:636214 Review-Url: https://codereview.chromium.org/2292313003
2016-09-06Move CFX_Font definition to its own file and clean upnpm
- Rename fx_ge_font.cpp to cfx_font.cpp - Deleted unused CONTRAST_RAMP_STEP in fx_ge_text.cpp - Move CFX_Font definitions and auxiliary methods in fx_ge_text to cfx_font - Remove extern "C", static, and underscore prefixes in new namespace methods in cfx_font.cpp Review-Url: https://codereview.chromium.org/2304493005
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-03Use safe bool conversion operators in fpdf_page/chromium/2852chromium/2851chromium/2850tsepez
Review-Url: https://codereview.chromium.org/2310693002
2016-09-02Clean up redundant code in PDF_ENABLE_XFA guard in FFLCommon.chromium/2849jaepark
Review-Url: https://codereview.chromium.org/2307243002
2016-09-02Make CPDF_ClipPath have a CPDF_ClipPathData rather than inheriting.tsepez
Make Data private to the ClipPath class which manages it transparently for its callers. This prevents the callers from having to remember to make a copy before dirtying the shared data, since the operations that modify state will do this under the covers for us. Review-Url: https://codereview.chromium.org/2301263003