summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
AgeCommit message (Collapse)Author
2018-10-26Pass CreateParams to CPWL_Wnd constructor.chromium/3595chromium/3594Tom Sepez
The previous reshuffling means we always have the create params earlier, so pass them in at create time. Clean up two forward declarations that were not needed as noticed in the process. Change-Id: I5d3861f3c1e3508e0d25950e919859244fac5f8b Reviewed-on: https://pdfium-review.googlesource.com/c/44710 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-26Pass unique_ptr to CPWL_Wnd::AddChild().Tom Sepez
But stop short of updating the underlying data structures. Change-Id: I7d8edc74f71725005b81359484d30caddbe958d7 Reviewed-on: https://pdfium-review.googlesource.com/c/44693 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-26Remove pParentWnd field entirely from CreateParams.Tom Sepez
Put it into CPWL_Wnd directly, and set/clear it when a child is added/removed from a parent. Change-Id: I7a8cd0cf22dbd6173e64bec5d844df56ad373722 Reviewed-on: https://pdfium-review.googlesource.com/c/44692 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-26Stop transfering ownership of |this| as CPWL_Wnd::Create() side-effectTom Sepez
Instead, make it an explicit method called on the parent outside of create. Rename Create() to Realize() to be sure to catch all usages, and add the new required call. Attachment to the parent now takes place a little earlier on in the life-cycle as a result but should be ok. Precursor to converting to smart pointers. Change-Id: I45c459fcd28b5d03c428ce5809d0432506cf4ec6 Reviewed-on: https://pdfium-review.googlesource.com/c/44690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-25Make CPWL_Wnd own its pAttachedData.Tom Sepez
This requires moving it out of CreateParams, since that must be a copyable struct, and implies that currently there is some questionable sharing going on. To resolve this, introduce a Clone() method so that each window gets its own copy. Make GetAttachedData() return a const pointer, so that callers can't free it behind our back. Tidy initializations along the way. Change-Id: Iadc97688b4692bf4fafefe8cff88af88672f7110 Reviewed-on: https://pdfium-review.googlesource.com/c/44590 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-04Remove CPWL_EditCtrl::m_pEdit null checks.Tom Sepez
It is always non-null. Move initializers to header while we're at it. Change-Id: I64f59ab1d5ffee9256f87e4712e46fb71f14ef08 Reviewed-on: https://pdfium-review.googlesource.com/c/43473 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-19Add public APIs for undo / redo in forms.Lei Zhang
Add FORM_CanUndo(), FORM_CanRedo(), FORM_Undo(), and FORM_Redo(). BUG=chromium:764260 Change-Id: I1d9ea67152d9b35d9b8e1d7ef7d019706fdfa30a Reviewed-on: https://pdfium-review.googlesource.com/30872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-17Add a virtual CPWL_Wnd::GetText() method.Lei Zhang
Most CPWL_Wnd subclasses already have GetText() implementations. Change-Id: I61858019c59f915df422afaca97b8abde345575b Reviewed-on: https://pdfium-review.googlesource.com/30860 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-10-05Remove CPVT_SectionDan Sinclair
The CPVT_Section only contained a single rect which was used in one place. The place it was used never used the variable it assigned it too. Removed. Change-Id: I5c3fccff4fad6deca4945e301bffb5348692b23c Reviewed-on: https://pdfium-review.googlesource.com/15675 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Fix UAF in SetVisible().Henrique Nakashima
SetVisible() may be called during Destroy() which may be called during SetVisible(). This fixes the latest in a family of bugs that happen after an instance is freed by code triggered by JS code while it's executing a method. The CL has a lot of protection for many of these points where JS may be executed and potentially destroy objects. The return types of many methods that may execute JS have been changed to bool, indicating whether the instance is still alive after the call. Bug: chromium:770148 Change-Id: If5a9db4d8d6aac10f4dd6b645922bb96c116684d Reviewed-on: https://pdfium-review.googlesource.com/15190 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: 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-15Move CPWL_CREATPARAM to CPWL_Wnd::CreateParamsTom Sepez
This nesting makes so much more sense when I read the code. Fix member naming for this in CPWL_Wnd. Pass in/out CreateParams arg as pointer. Kill Reset() method, only called during destroy and nothing needs explicit cleanup. Change-Id: If50e403e11c131e7656da09c0cb36866223d64c6 Reviewed-on: https://pdfium-review.googlesource.com/14070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-08-15Remove default argument from CPWL_Wnd::InvalidateRect().Lei Zhang
Change-Id: I529925b10fa43d4c9c6c9d398265d2ae7eccf93d Reviewed-on: https://pdfium-review.googlesource.com/10853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-31Add FORM_ReplaceSelection() and embedder tests.Diana Gage
This method replaces the selected text in a user-editable form text area with another text string (which can be empty or non-empty). If there is no selected text, FORM_ReplaceSelection() will append the replacement text after the current caret position. BUG=chromium:59266 Change-Id: I76448ef757d107888c33ebd5656457ebac93b952 Reviewed-on: https://pdfium-review.googlesource.com/8812 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Diana Gage <drgage@google.com>
2017-07-25Move fpdfsdk/pdfwindow to fpdfsdk/pwlDan Sinclair
This makes it clearer what the directory contains. Change-Id: I34fc38dd30b8e0f6e057052ea33c8b5a10f1b9c3 Reviewed-on: https://pdfium-review.googlesource.com/8791 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>