Make all CXFA_FFWidget observe their CXFA_FFPageview. Although a very blunt technique, the cost shouldn't be terrible in memory given the size of the CXFA_FFWidget itself, and shouldn't be terrible in runtime give the rarity of the notification case. Ideally, future memory work would improve this situation, but this safely adding more test cases at present to guard against regressions. Bug: chromium:1042915, chromium:1010844 Change-Id: Idd02967a8297d3bce7d35451db9ae05f79cdf3ac Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65870 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/bug_1042915.evt b/testing/resources/javascript/xfa_specific/bug_1042915.evt new file mode 100644 index 0000000..c0cea89 --- /dev/null +++ b/testing/resources/javascript/xfa_specific/bug_1042915.evt
@@ -0,0 +1,8 @@ +mousedown,left,0,0 +mouseup,left,0,0 +keycode,9 +keycode,9 +mousedown,left,0,0 +mouseup,left,0,0 +mousedown,left,0,0 +mouseup,left,0,0 \ No newline at end of file
diff --git a/testing/resources/javascript/xfa_specific/bug_1042915.pdf b/testing/resources/javascript/xfa_specific/bug_1042915.pdf new file mode 100644 index 0000000..36a2c8b --- /dev/null +++ b/testing/resources/javascript/xfa_specific/bug_1042915.pdf Binary files differ
diff --git a/testing/resources/javascript/xfa_specific/bug_1042915_expected.txt b/testing/resources/javascript/xfa_specific/bug_1042915_expected.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testing/resources/javascript/xfa_specific/bug_1042915_expected.txt
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 881218c..61a1950 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -23,7 +23,6 @@ #include "xfa/fxfa/cxfa_ffapp.h" #include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/cxfa_ffdocview.h" -#include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidgethandler.h" #include "xfa/fxfa/cxfa_imagerenderer.h" #include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 4c362c1..3bb96f4 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -17,6 +17,7 @@ #include "xfa/fwl/cfwl_messagemouse.h" #include "xfa/fwl/cfwl_widget.h" #include "xfa/fxfa/cxfa_eventparam.h" +#include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/layout/cxfa_contentlayoutitem.h" @@ -146,7 +147,7 @@ CXFA_ContentLayoutItem* GetLayoutItem() const { return m_pLayoutItem.Get(); } void SetLayoutItem(CXFA_ContentLayoutItem* pItem) { m_pLayoutItem = pItem; } CXFA_FFPageView* GetPageView() const { return m_pPageView.Get(); } - void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; } + void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView.Reset(pPageView); } CXFA_FFDocView* GetDocView() const { return m_pDocView.Get(); } void SetDocView(CXFA_FFDocView* pDocView) { m_pDocView = pDocView; } @@ -194,7 +195,7 @@ UnownedPtr<CXFA_ContentLayoutItem> m_pLayoutItem; UnownedPtr<CXFA_FFDocView> m_pDocView; - UnownedPtr<CXFA_FFPageView> m_pPageView; + ObservedPtr<CXFA_FFPageView> m_pPageView; UnownedPtr<CXFA_Node> const m_pNode; mutable CFX_RectF m_rtWidget; };