From ae82b696f236bc5bd1375532bcf867fcc6aa9126 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 29 Jun 2018 16:19:59 +0000 Subject: Use more UnownedPtr<> in cxfa_ffwidget Change-Id: Iae962711f522ad52e77f19201d00d9ab86096ca4 Reviewed-on: https://pdfium-review.googlesource.com/36510 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- xfa/fxfa/cxfa_ffwidget.cpp | 10 +--------- xfa/fxfa/cxfa_ffwidget.h | 11 ++++++----- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index a81063b335..05330a9a51 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -349,7 +349,7 @@ void CXFA_FFWidget::DrawBorderWithFlag(CXFA_Graphics* pGS, void CXFA_FFWidget::InvalidateRect() { CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused); rtWidget.Inflate(2, 2); - m_pDocView->InvalidateRect(m_pPageView, rtWidget); + m_pDocView->InvalidateRect(m_pPageView.Get(), rtWidget); } bool CXFA_FFWidget::OnMouseEnter() { @@ -583,14 +583,6 @@ bool CXFA_FFWidget::PtInActiveRect(const CFX_PointF& point) { return GetWidgetRect().Contains(point); } -CXFA_FFDocView* CXFA_FFWidget::GetDocView() { - return m_pDocView; -} - -void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) { - m_pDocView = pDocView; -} - CXFA_FFDoc* CXFA_FFWidget::GetDoc() { return m_pDocView->GetDoc(); } diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index f8d97dc551..283c8cbbc7 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -140,8 +140,11 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual FormFieldType GetFormFieldType(); - CXFA_FFPageView* GetPageView() const { return m_pPageView; } + CXFA_FFPageView* GetPageView() const { return m_pPageView.Get(); } void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; } + CXFA_FFDocView* GetDocView() const { return m_pDocView.Get(); } + void SetDocView(CXFA_FFDocView* pDocView) { m_pDocView = pDocView; } + const CFX_RectF& GetWidgetRect() const; const CFX_RectF& RecacheWidgetRect() const; uint32_t GetStatus(); @@ -149,8 +152,6 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { CXFA_Node* GetNode() const { return m_pNode.Get(); } - CXFA_FFDocView* GetDocView(); - void SetDocView(CXFA_FFDocView* pDocView); CXFA_FFDoc* GetDoc(); CXFA_FFApp* GetApp(); IXFA_AppProvider* GetAppProvider(); @@ -182,8 +183,8 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { bool IsButtonDown(); void SetButtonDown(bool bSet); - CXFA_FFDocView* m_pDocView = nullptr; - CXFA_FFPageView* m_pPageView = nullptr; + UnownedPtr m_pDocView; + UnownedPtr m_pPageView; UnownedPtr const m_pNode; mutable CFX_RectF m_rtWidget; }; -- cgit v1.2.3