From be9b8947d0090e20116822fe7caf5e7973d6b20a Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 18 May 2016 06:09:33 -0700 Subject: Pass objects instead of strings for undo/redo records. Currently the Undo/Redo records are serialized as byte strings and stored into a CFX_ByteStringArray. They are deserialized when used. This CL removes the serialization and stores the objects in a deque of unique pointers. Review-Url: https://codereview.chromium.org/1980293004 --- xfa/fwl/lightwidget/cfwl_combobox.cpp | 8 ++++---- xfa/fwl/lightwidget/cfwl_combobox.h | 4 ++-- xfa/fwl/lightwidget/cfwl_edit.cpp | 12 ++++-------- xfa/fwl/lightwidget/cfwl_edit.h | 5 +++-- 4 files changed, 13 insertions(+), 16 deletions(-) (limited to 'xfa/fwl/lightwidget') diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp index ca88a23429..d70113b18a 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.cpp +++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp @@ -140,16 +140,16 @@ FWL_Error CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { return static_cast(m_pIface)->EditDoClipboard(iCmd); } -FX_BOOL CFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { +FX_BOOL CFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { if (!m_pIface) return FALSE; - return static_cast(m_pIface)->EditRedo(bsRecord); + return static_cast(m_pIface)->EditRedo(pRecord); } -FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) { +FX_BOOL CFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { if (!m_pIface) return FALSE; - return static_cast(m_pIface)->EditUndo(bsRecord); + return static_cast(m_pIface)->EditUndo(pRecord); } FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h index 5a639e33d9..b5d0327ba9 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.h +++ b/xfa/fwl/lightwidget/cfwl_combobox.h @@ -40,8 +40,8 @@ class CFWL_ComboBox : public CFWL_Widget { int32_t GetEditLimit(); FWL_Error SetEditLimit(int32_t nLimit); FWL_Error EditDoClipboard(int32_t iCmd); - FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); - FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); + FX_BOOL EditRedo(const IFDE_TxtEdtDoRecord* pRecord); + FX_BOOL EditUndo(const IFDE_TxtEdtDoRecord* pRecord); FWL_Error SetMaxListHeight(FX_FLOAT fMaxHeight); FWL_Error SetItemData(int32_t iIndex, void* pData); void* GetItemData(int32_t iIndex); diff --git a/xfa/fwl/lightwidget/cfwl_edit.cpp b/xfa/fwl/lightwidget/cfwl_edit.cpp index f151edd7e9..f1471ea13b 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.cpp +++ b/xfa/fwl/lightwidget/cfwl_edit.cpp @@ -154,16 +154,12 @@ FWL_Error CFWL_Edit::DoClipboard(int32_t iCmd) { return static_cast(m_pIface)->DoClipboard(iCmd); } -FX_BOOL CFWL_Edit::Redo(const CFX_ByteStringC& bsRecord) { - if (!m_pIface) - return FALSE; - return static_cast(m_pIface)->Redo(bsRecord); +FX_BOOL CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { + return m_pIface && static_cast(m_pIface)->Redo(pRecord); } -FX_BOOL CFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) { - if (!m_pIface) - return FALSE; - return static_cast(m_pIface)->Undo(bsRecord); +FX_BOOL CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { + return m_pIface && static_cast(m_pIface)->Undo(pRecord); } FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h index c7001a3166..349b380670 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.h +++ b/xfa/fwl/lightwidget/cfwl_edit.h @@ -12,6 +12,7 @@ #include "xfa/fwl/lightwidget/cfwl_widget.h" class CFWL_WidgetProperties; +class IFDE_TxtEdtDoRecord; class CFWL_Edit : public CFWL_Widget { public: @@ -40,8 +41,8 @@ class CFWL_Edit : public CFWL_Widget { int32_t nLen, const CFX_WideStringC& wsReplace); FWL_Error DoClipboard(int32_t iCmd); - FX_BOOL Redo(const CFX_ByteStringC& bsRecord); - FX_BOOL Undo(const CFX_ByteStringC& bsRecord); + FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord); + FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord); FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); FWL_Error SetBackColor(uint32_t dwColor); -- cgit v1.2.3