Mark CFWL_Event and its subclasses stack-only types.
They are already used only in this manner.
-- Forward declare class and fix IWYU.
Bug: pdfium:1563
Change-Id: I3ebb2786cf0e1e8ef1ec7176b76880c10c586199
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72919
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_event.h b/xfa/fwl/cfwl_event.h
index 832c01f..7dca5ac 100644
--- a/xfa/fwl/cfwl_event.h
+++ b/xfa/fwl/cfwl_event.h
@@ -7,10 +7,14 @@
#ifndef XFA_FWL_CFWL_EVENT_H_
#define XFA_FWL_CFWL_EVENT_H_
-#include "core/fxcrt/observed_ptr.h"
-#include "xfa/fwl/cfwl_widget.h"
+#include "core/fxcrt/fx_system.h"
+#include "v8/include/cppgc/macros.h"
+
+class CFWL_Widget;
class CFWL_Event {
+ CPPGC_STACK_ALLOCATED(); // Allow Raw/Unowned pointers.
+
public:
enum class Type {
CheckStateChanged,
@@ -33,13 +37,13 @@
virtual ~CFWL_Event();
Type GetType() const { return m_type; }
- CFWL_Widget* GetSrcTarget() const { return m_pSrcTarget.Get(); }
- CFWL_Widget* GetDstTarget() const { return m_pDstTarget.Get(); }
+ CFWL_Widget* GetSrcTarget() const { return m_pSrcTarget; }
+ CFWL_Widget* GetDstTarget() const { return m_pDstTarget; }
private:
const Type m_type;
- ObservedPtr<CFWL_Widget> const m_pSrcTarget;
- ObservedPtr<CFWL_Widget> const m_pDstTarget;
+ CFWL_Widget* const m_pSrcTarget = nullptr;
+ CFWL_Widget* const m_pDstTarget = nullptr;
};
#endif // XFA_FWL_CFWL_EVENT_H_
diff --git a/xfa/fwl/cfwl_eventtextwillchange.h b/xfa/fwl/cfwl_eventtextwillchange.h
index a1bfe8c..069a234 100644
--- a/xfa/fwl/cfwl_eventtextwillchange.h
+++ b/xfa/fwl/cfwl_eventtextwillchange.h
@@ -7,6 +7,7 @@
#ifndef XFA_FWL_CFWL_EVENTTEXTWILLCHANGE_H_
#define XFA_FWL_CFWL_EVENTTEXTWILLCHANGE_H_
+#include "core/fxcrt/widestring.h"
#include "xfa/fwl/cfwl_event.h"
class CFWL_EventTextWillChange final : public CFWL_Event {
diff --git a/xfa/fwl/cfwl_eventvalidate.h b/xfa/fwl/cfwl_eventvalidate.h
index 26e3c7f..6cf5816 100644
--- a/xfa/fwl/cfwl_eventvalidate.h
+++ b/xfa/fwl/cfwl_eventvalidate.h
@@ -7,6 +7,7 @@
#ifndef XFA_FWL_CFWL_EVENTVALIDATE_H_
#define XFA_FWL_CFWL_EVENTVALIDATE_H_
+#include "core/fxcrt/widestring.h"
#include "xfa/fwl/cfwl_event.h"
class CFWL_EventValidate final : public CFWL_Event {