summaryrefslogtreecommitdiff
path: root/xfa/fde
AgeCommit message (Collapse)Author
2018-10-15Split pdfium_unittests sources.Lei Zhang
Move foo_unittest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_unittests pass gn check. Change-Id: Id9f649d5d0c76fe4254f3887778516abb75fcbce Reviewed-on: https://pdfium-review.googlesource.com/c/43995 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make xfa/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: I1aad3276a6fd571071270090235b0cfb625e337b Reviewed-on: https://pdfium-review.googlesource.com/c/43986 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Split core/fxcrt build rules into core/fxcrt/BUILD.gn.Lei Zhang
Change-Id: I9b3608bd76ec4911a4bb820fcda62c5d9533fb4f Reviewed-on: https://pdfium-review.googlesource.com/c/43947 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Split xfa build rules into various BUILD.gn files in xfa/.Lei Zhang
Change-Id: I3e6624d0e7af6c4f7ec9674d5990ae25cc3954d0 Reviewed-on: https://pdfium-review.googlesource.com/c/43941 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-06-20Re-work some more c_str() usage.Tom Sepez
Many of these are converting ByteString => c_str => ByteStringView, since the ByteStringView ctor is implicit. This is unfortunate, since that involves a strlen() which the ByteString already knows if we use AsStringView() instead. This changed one test result where we can now return the string "\0" instead of "" -- since strlen no longer eats the NUL. This seems consistent, say, with String.fromCharCode(). Change-Id: I17f68d1a1f4b352960208f9148e68ab4c4d78bd2 Reviewed-on: https://pdfium-review.googlesource.com/35590 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-01Move variable into loop scopeRyan Harrison
The variable is not used outside of the loop. This was noted by tsepez@ after landing the initial CL to clean up this code. Change-Id: Id7d6713db4fa6bdfe867c151290cb28329ae7042 Reviewed-on: https://pdfium-review.googlesource.com/33590 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Remove initialization of wchar_t chRyan Harrison
This value is overwritten at the beginning of the following while loop, so the initialized value is never used and the method called is const, so should be side effect free. Issue found with Clang Static Analyzer. Change-Id: I77f27daccd3aa1edd434cfa3e0dd7bc095db06d0 Reviewed-on: https://pdfium-review.googlesource.com/33550 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-29[xfa] Propagate the xfa change data for text to JS and back.Dan Sinclair
This CL adds the necessary plumbing to propagate the change information for a text widget from FWL out to JS and handle the returned value as necessary. Bug: pdfium:1066 Change-Id: I78fd81761b90294f1836e9f09dba12ed238963cc Reviewed-on: https://pdfium-review.googlesource.com/33070 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-23[xfa] Skip text length check for empty text fieldschromium/3439Dan Sinclair
This CL sets the text edit engine to skip the length check when doing an insert if the engine is currently empty. This allows handling inserting the formatted version of strings if they have a length longer then the maximium length. Bug: 1066 Change-Id: If9799334f889b8ae0f568f1f9d5457e2b504aa1d Reviewed-on: https://pdfium-review.googlesource.com/32898 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Transform in/out params from reference to pointer in CFDE_TextOut.Henrique Nakashima
Change-Id: I192f2d0f5e0d61ff09d2e32bafa4e7518573e14e Reviewed-on: https://pdfium-review.googlesource.com/31951 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-01Transform rect out param from reference to pointer in XFA code.Henrique Nakashima
Change-Id: Ib5f8b8754bca8198d9122700d7d876b45d1428da Reviewed-on: https://pdfium-review.googlesource.com/31852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-04-26Fix caret moving to next line upon click on line break in XFA edit.Henrique Nakashima
Bug: chromium:836361 Change-Id: I40739a21a60610bd5ab0143629f87562ba834a0d Reviewed-on: https://pdfium-review.googlesource.com/31410 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-26Enter key inserts a line break correctly in XFA edits.Henrique Nakashima
Bug: chromium:836361 Change-Id: I6d86ccec813f934ed2d0ab124501527d39ce535f Reviewed-on: https://pdfium-review.googlesource.com/31390 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-24Fix edit text rendered with wrong offsets after deletion.Henrique Nakashima
Bug: chromium:835924 Change-Id: I3d6a3d1947cb1b8cda246cc74ef0b79a482b7997 Reviewed-on: https://pdfium-review.googlesource.com/31276 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-24Fix caret moving to next line on click in multiline XFA edit.Henrique Nakashima
On a mouse click after the end of a line (except for the last line) in an XFA text edit, the caret was moved to the beginning of the next line, as the position after the space was actually in the next line. This CL changes the behavior so that the caret is positioned before the space in this case. Note it's possible to click directly to that position by clicking on the beginning of the next line. Bug: chromium:832293 Change-Id: Ib376e4cca7b32a87d478d3346cb3d8f3bd825daa Reviewed-on: https://pdfium-review.googlesource.com/31110 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-19Caret moves after clicked char if closer to its right rect boundary.chromium/3401Henrique Nakashima
Bug: chromium:832293 Change-Id: Idd240010a5ec99b836d9cb90c4c2aa3027ff5f67 Reviewed-on: https://pdfium-review.googlesource.com/31013 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-19Fix duplicated text in each line in XFA widgets.Henrique Nakashima
When calculating the characters to display, the run offset was not added to the offset inside the run, so characters from the first run were always used instead of from the run that the line should display. Bug: chromium:832909 Change-Id: I4d1d284894ce6ac9c7a49976aa6a6d0cf21f1382 Reviewed-on: https://pdfium-review.googlesource.com/30993 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-19Fix caret moving to start of edit on click after the text.Henrique Nakashima
It now moves to the end of the edit text instead. In a multiline edit, clicking after the end of a line in the middle of the text moves the caret to the beginning of the next line. This is a known issue to be addressed later. Bug: chromium:832293 Change-Id: I55ca1f7eebf935fbb7d9526f115489bdfbd8ba1c Reviewed-on: https://pdfium-review.googlesource.com/31012 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-03-27Remove unused FX_TXTRUN::pIdentityDan Sinclair
Unused, removed. Change-Id: I0c7e65224777932e38ca93d81709c8321aecb1c5 Reviewed-on: https://pdfium-review.googlesource.com/29290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-27Cleanup some CFDE_Data structsDan Sinclair
Change-Id: I9bf8d55d7d3624210cd54bc93db2c3671bec3a8f Reviewed-on: https://pdfium-review.googlesource.com/29270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-07Restore assert when GetCharacterInfo is called on an empty edit.Henrique Nakashima
CFWL_Edit::UpdateCursorRect now checks if the edit is empty before getting the caret position. Bug: chromium:592750 Change-Id: I792e90537741a78141fa084a646380bfe7ce4637 Reviewed-on: https://pdfium-review.googlesource.com/25910 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-06Use temporary iterator to avoid potential OOBRyan Harrison
In the existing code pCharPos is manipulated directly without being reset. This means that for the second iteration it is at the end of the range instead of the start. This CL introduces temporary iterators that are intialized to the value of pCharPos and then manipulated to avoid this issue and having to reset pCharPos. BUG=chromium:648177 Change-Id: I5c9344c1b67a015b01470a0dc337361552ffd447 Reviewed-on: https://pdfium-review.googlesource.com/25750 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-06Fix caret not appearing in XFA Edits.Henrique Nakashima
This makes the caret appear (again?), blink, and fixes its positioning to be a little spaced from the last character. Known issue: when the edit is empty, the caret is not necessarily aligned with where the text will be. Bug: chromium:592750 Change-Id: I950b0ea236db8855c6ed50f48ec1935d97e6ccf8 Reviewed-on: https://pdfium-review.googlesource.com/25451 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-16Clean up xfa/fde/cfde_textout.h.Lei Zhang
- Move enums/structs other than CFDE_TextOut to a separate header. - Move CFDE_TTOLine into CFDE_TextOut. Change-Id: I63196ebe6c02bc88d1c20ecb625505013edbfa26 Reviewed-on: https://pdfium-review.googlesource.com/22930 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-08Pack struct FDE_TEXTEDITPIECE better.Lei Zhang
Change-Id: I3f15b3774cc279a827d7e6f497417c3d5e1b7ef2 Reviewed-on: https://pdfium-review.googlesource.com/22510 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-11Initialize FDE_TEXTEDITPIECE.chromium/3292Lei Zhang
BUG=pdfium:958 Change-Id: I7c17c327db974dacbeb3577d79c9522de348c78e Reviewed-on: https://pdfium-review.googlesource.com/20730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Explicitly return std::vector in CFDE_TextEditEngine.Lei Zhang
Some build configurations do not like the {} variant. Change-Id: I32f5a18e5b41b628d6b45ec5eb9b26eded5b7d9c Reviewed-on: https://pdfium-review.googlesource.com/15450 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-28Cleanup font definesDan Sinclair
Use methods to match font information; cleanup some font code. Change-Id: Ib99c1e466e56723cb5d264d49e1caf9bbbc0daed Reviewed-on: https://pdfium-review.googlesource.com/15072 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-28Cleanup font definesDan Sinclair
This CL removes duplicate defines between XFA and core. Several OR'd values have been coverted into individual booleans to make the code clearer. Change-Id: Ic32a71c711cffd9a0cf1136e5a22f0502e085c39 Reviewed-on: https://pdfium-review.googlesource.com/15071 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-27Move CFX_Font definition to cfx_font.hDan Sinclair
This CL moves the CFX_Font definition out of fx_font.h and into cfx_font.h to match the cfx_font.cpp implementation. Change-Id: Icc2fc7463fa4b9d0bec925e80b60a638136a83a1 Reviewed-on: https://pdfium-review.googlesource.com/14951 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-27Remove FX_STRSIZE and replace with size_tRyan Harrison
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Cleanup FX macrosDan Sinclair
This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_UnownedPtr to UnownedPtrDan Sinclair
This CL moves CFX_UnownedPtr to UnownedPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I6d1fa463f365e5cb3aafa8c8a7a5f7eff62ed8e0 Reviewed-on: https://pdfium-review.googlesource.com/14620 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Rename CFX_RetainPtr to RetainPtrDan Sinclair
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-20Implement CFDE_TextEditEngine::GetIndex* methods.Dan Sinclair
This CL adds unittests and implementations for the text edit engine methods to get various indexes based on cursor position. The |RebuildPieces| method was fixed to correctly keep track of character position when dealing with BIDI characters. Change-Id: Ie3c5ee5d63bfd00f6f0cdcb1c6fcfe6e05bba50e Reviewed-on: https://pdfium-review.googlesource.com/14430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-20Convert FindNextBreakPos to return positionDan Sinclair
This CL changes FindNextBreakPos to return the found index instead of requiring a call to GetAt(). This also fixes the issue that we may return -1 from GetAt which would cause issues in the BoundsForWordAt method when it gets shoved into a size_t variable. Change-Id: I29e09de5d0837921a027208fc2471a9b1de287f1 Reviewed-on: https://pdfium-review.googlesource.com/14293 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-19Cleanup FindNextBreakPos variablesDan Sinclair
The ePreType flag is only used if bFirst is true. After the first iteration of the loop bFirst is always false. This CL removes the updating of ePreType as it will never be used. Also bFirst is only set false at the end of the loop and the do {} while is changed into a while {} Change-Id: Iaced1b38bddcc6f5483ae20993ac69c93b2e3f97 Reviewed-on: https://pdfium-review.googlesource.com/14292 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-19Invert flag to CFDE_TextEditEngine::Iterator::IsEOFDan Sinclair
This CL changes the IsEOF flag to match the semantics of the FindNextBreakPos flag. Change-Id: I1a8aba91171baeacf80bdea4b9468d6093599c90 Reviewed-on: https://pdfium-review.googlesource.com/14291 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-19Convert selection to use count instead of end indexDan Sinclair
This CL changes the Text Edit Engine code to use a count instead of an end index for the selection range. Using count lets us differentiate a selection at the beginning of 1 character and an empty selection. A few new tests were added to test unicode word break behaviour, some are not working yet and are commented out. Change-Id: Icce8f5003102ef0a850151ccdf16d3c2226d94bf Reviewed-on: https://pdfium-review.googlesource.com/13491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-18Cleanup word break propertiesDan Sinclair
This CL attempts to clarify the contents of the gs_FX_WordBreak_Table and adds static_asserts that each entry in the WordBreakProperty table has the value we expect. Change-Id: I33c1f12a9e18240b01969be9902204eba5074eb7 Reviewed-on: https://pdfium-review.googlesource.com/13430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-14Roll clang to 4db5854chromium/3216Tom Sepez
AKA roll clang 310694:312679 Fix virtual dtor warning in xfa/fde/cfde_texteditengine.h Bug: pdfium:896 Change-Id: Ib5fb9433b2c138ca46ccb281b8c0a852daeb623e Reviewed-on: https://pdfium-review.googlesource.com/13850 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-06Merge CFX_WordBreak into CFDE_TextEditEngine::Iterator.Dan Sinclair
This CL moves the CFX_WordBreak::FindNextBreakPos into the text edit engine iterator. The word break data was moved to cfde_wordbreak_data. Change-Id: Ie022f5f761479f97b9d4bc7789f890cb2ef99106 Reviewed-on: https://pdfium-review.googlesource.com/13250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Implement word selection in CFDE_TextEditEngineDan Sinclair
This CL implements the needed logic in CFDE_TextEditEngine to handle word selection. Change-Id: I6b388c23655037fec107d68ec07d33638b959374 Reviewed-on: https://pdfium-review.googlesource.com/13211 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-08-30Rebuild CFDE_TextEditEngine.Dan Sinclair
This CL rebuilds the text edit engine in a simpler fashion. Instead of depending on multiple pages, paragraphs and buffer fields there is a single text edit engine which contains a gap buffer. This makes the code easier to understand and follow. Change-Id: I10fe85603fa9ed15a647eaac2d931f113cd0c7b0 Reviewed-on: https://pdfium-review.googlesource.com/11990 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-08-30Convert int* references to FX_STRSIZERyan Harrison
Through out the code base there are numerous places where variables are declared using a signed integer type when interacting with the string classes, since they assume that FX_STRSIZE is 'int'. As part of changing the underling type of FX_STRSIZE to be unsigned, these locations are being changed to use FX_STRSIZE. This is necessary as part of converting the type, but has been broken off into a separate CL, since it should be low risk. Some related cleanups that are low risk are included as part of this CL. BUG=pdfium:828 Change-Id: Ifaae54ad195ccde0fe8672f71271d29a6ebd65fd Reviewed-on: https://pdfium-review.googlesource.com/12210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-23Remove OnPageLoad and OnPageUnload from CFWL_EditDan Sinclair
This CL updates the text edit engine to load and unload the page directly instead of calling through the edit widget. Change-Id: I636c8e8b0e635968222430098d3d268c75224b42 Reviewed-on: https://pdfium-review.googlesource.com/11590 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-23Cleanup GetPre* methods in CFDE_TextEdtEngineDan Sinclair
This CL cleans up the GetPre* methods in CFDE_TextEdtEngine. In particular: * GetPreDeleteText was inlined as it was very simple * GetPreReplaceText was removed as unused * GetPreInsertText was renamed to InsertIntoTextCopy to make clear that this was doing the insert into a copy of the text. Change-Id: Icde0126b6ddb0ec9d4956238ebff53c9fe51c051 Reviewed-on: https://pdfium-review.googlesource.com/11531 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>