summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-09-15Add short-cut in CFX_{Byte,Wide}String::Operator<()tsepez
Strings are never less than themselves, and this will occur given the shared CoW nature of these strings. Review-Url: https://codereview.chromium.org/2347433004
2016-09-15Rename dictionary set and get methodsdsinclair
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005
2016-09-14Delete unused parameter nWordStyle from GetCharWidth()chromium/2861npm
Deleted parameter from callers, who also do not use it. Review-Url: https://codereview.chromium.org/2337973004
2016-09-14Remove FFI_ from CPDFSDK_Environment method namesdsinclair
The prefix doesn't add anything when used in CPDFSDK_Environment, remove. Review-Url: https://codereview.chromium.org/2338303002
2016-09-14Map glyph bitmap in LookUpGlyphBitmap even when unsuccessfulnpm
CFX_FaceCache::LookUpGlyphBitMap should remember its unsuccessful glyph bitmap calculations. This is especially important if there are a lot of repeated requests for the same glyph with large bitmaps (which means long calculations in freetype). With this CL, the pdf in the bug below will be rendered quickly. BUG=chromium:638856 Review-Url: https://codereview.chromium.org/2338883004
2016-09-14Rename CPDFDoc_Environment to CPDFSDK_Environmentdsinclair
CPDFDoc_Environment does not fit with the general naming scheme of the rest of the files in fpdfsdk. This CL updates the naming to CPDFSDK_Environment to better fit with the surrounding files. Review-Url: https://codereview.chromium.org/2333413003
2016-09-14Split CPDFXFA_Document apartdsinclair
[DO NOT COMMIT] This CL renames IXFA_DocProvider to IXFA_DocEnvironment to better describe the purpose. Then, CPDFXFA_Document has all of the IXFA_DocEnvironment methods removed and placed in CPDFXFA_DocEnvironment. The CPDFXFA_Document then has a CPDFXFA_DocEnvironment. This splits the code related to the document apart from the XFA callback methods to work with that document. Review-Url: https://codereview.chromium.org/2328573002
2016-09-14Cleanup CPDFXFA_Document.dsinclair
Remove unused params and methods. Cleanup formatting. Review-Url: https://codereview.chromium.org/2322003002
2016-09-14Remove unused code in CPDFXFA_Documentdsinclair
Remove methods that always just return without doing any work. Clean up the IXFA_DocProvider interface calls for those methods and cleanup the callers that were calling the methods. Review-Url: https://codereview.chromium.org/2323523002
2016-09-13Sort include entries.dsinclair
This CL updates all of the includes to be correctly sorted. A PRESUBMIT warning is added (from chromium) that will warn if the includes are in the wrong order on upload. Review-Url: https://codereview.chromium.org/2337293002
2016-09-13Add check for trivial string equalitytsepez
BUG= Review-Url: https://codereview.chromium.org/2338623005
2016-09-13Remove inner FX_DATETIME struct from CPDFSDK_DateTimetsepez
There's a separate, different FX_DATETIME in XFA. Once we remove memcpy(), there's no reason to have the inner struct for sizing. Review-Url: https://codereview.chromium.org/2333213005
2016-09-13CFX_FloatPoint default constructor and equals operatorschromium/2860tsepez
Review-Url: https://codereview.chromium.org/2341453002
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