From 31781107f6bda92e732fed805f62e8512bc78149 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Mon, 16 Jul 2018 21:17:46 +0000 Subject: Fix crash when typing letters into an XFA datetime field. The root of the issue is that CXFA_FFDateTimeEdit inherits from CXFA_FFTextEdit and methods in the former treat its widget as a CFWL_Edit, while it can be a CFWL_DateTimePicker. Bug: chromium:857521 Change-Id: I764b6c03095b16f6a9cf72ff36768ca4c57c4070 Reviewed-on: https://pdfium-review.googlesource.com/37910 Reviewed-by: Ryan Harrison Commit-Queue: Henrique Nakashima --- xfa/fxfa/cxfa_ffdatetimeedit.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'xfa/fxfa/cxfa_ffdatetimeedit.h') diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.h b/xfa/fxfa/cxfa_ffdatetimeedit.h index a549cbb80f..8041b313de 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.h +++ b/xfa/fxfa/cxfa_ffdatetimeedit.h @@ -16,6 +16,7 @@ enum XFA_DATETIMETYPE { XFA_DATETIMETYPE_DateAndTime }; +class CFWL_DateTimePicker; class CFWL_Event; class CFWL_Widget; @@ -35,12 +36,31 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { int32_t iMonth, int32_t iDay); + // CXFA_FFWidget + bool CanUndo() override; + bool CanRedo() override; + bool Undo() override; + bool Redo() override; + bool CanCopy() override; + bool CanCut() override; + bool CanPaste() override; + bool CanSelectAll() override; + Optional Copy() override; + Optional Cut() override; + bool Paste(const WideString& wsPaste) override; + void SelectAll() override; + void Delete() override; + void DeSelect() override; + WideString GetText() override; + private: bool PtInActiveRect(const CFX_PointF& point) override; bool CommitData() override; bool UpdateFWLData() override; bool IsDataChanged() override; + CFWL_DateTimePicker* GetPickerWidget(); + uint32_t GetAlignment(); }; -- cgit v1.2.3