diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2016-02-04 18:04:54 -0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2016-02-04 18:04:54 -0800 |
commit | d2941a736bfe37b792a7144cfc561e043c2bc1f0 (patch) | |
tree | d87805c14d8750c627648702c773173cf9628fef /xfa | |
parent | f7e38ede94095029b242497025413951a555e5cd (diff) | |
download | pdfium-d2941a736bfe37b792a7144cfc561e043c2bc1f0.tar.xz |
Fix an assertion failure in CXFA_DefFontMgr::GetDefaultFont()
BUG=pdfium:385
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1668813002 .
Review URL: https://codereview.chromium.org/1669193002 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdocview.cpp | 16 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdocview.h | 3 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffnotify.cpp | 51 |
3 files changed, 28 insertions, 42 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp index 345b142f47..9d8e049787 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp @@ -180,7 +180,6 @@ void CXFA_FFDocView::UpdateDocView() { this->RunCalculateWidgets(); this->RunValidate(); ShowNullTestMsg(); - m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Next; if (RunLayout() && m_bLayoutEvent) { RunEventLayoutReady(); } @@ -396,7 +395,7 @@ void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { pWidgetAcc ? pWidgetAcc->GetNextWidget(NULL) : NULL; if (SetFocus(pNewFocus)) { m_pFocusAcc = pWidgetAcc; - if (m_iStatus >= XFA_DOCVIEW_LAYOUTSTATUS_End) { + if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) { m_pDoc->GetDocProvider()->SetFocusWidget(m_pDoc, m_pFocusWidget); } } @@ -535,20 +534,15 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage* pSender, XFA_PAGEEVENT eEvent, int32_t iPageIndex) { - FX_BOOL bNofify = m_iStatus >= XFA_DOCVIEW_LAYOUTSTATUS_End; CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); if (eEvent == XFA_PAGEEVENT_PageRemoved) { - if (bNofify) { m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, XFA_PAGEVIEWEVENT_PostRemoved); - } - } else if (eEvent == XFA_PAGEEVENT_PageAdded) { - if (bNofify) { - m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, - XFA_PAGEVIEWEVENT_PostAdded); - pFFPageView->LoadPageView(); - } + return; } + m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, + XFA_PAGEVIEWEVENT_PostAdded); + pFFPageView->LoadPageView(); } void CXFA_FFDocView::LockUpdate() { m_iLock++; diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.h b/xfa/src/fxfa/src/app/xfa_ffdocview.h index a8d39b5bd6..df709251ca 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.h +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.h @@ -28,8 +28,7 @@ enum XFA_DOCVIEW_LAYOUTSTATUS { XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady, XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady, XFA_DOCVIEW_LAYOUTSTATUS_DocReady, - XFA_DOCVIEW_LAYOUTSTATUS_End, - XFA_DOCVIEW_LAYOUTSTATUS_Next, + XFA_DOCVIEW_LAYOUTSTATUS_End }; class CXFA_FFDocView : public IXFA_DocView { public: diff --git a/xfa/src/fxfa/src/app/xfa_ffnotify.cpp b/xfa/src/fxfa/src/app/xfa_ffnotify.cpp index 9dd93f387a..ebd9d06a6e 100644 --- a/xfa/src/fxfa/src/app/xfa_ffnotify.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffnotify.cpp @@ -551,7 +551,7 @@ void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender, } FX_BOOL bLayoutReady = !(pDocView->m_bInLayoutStatus) && - (pDocView->GetLayoutStatus() >= XFA_DOCVIEW_LAYOUTSTATUS_End); + (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); if (bLayoutReady) { m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); } @@ -562,7 +562,7 @@ void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender, if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) { FX_BOOL bLayoutReady = !(pDocView->m_bInLayoutStatus) && - (pDocView->GetLayoutStatus() >= XFA_DOCVIEW_LAYOUTSTATUS_End); + (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); if (bLayoutReady) { m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); } @@ -580,33 +580,28 @@ void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, FX_DWORD dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | XFA_WIDGETSTATUS_Printable; pWidget->ModifyStatus(dwStatus, dwFilter); - if (pDocView->GetLayoutStatus() >= XFA_DOCVIEW_LAYOUTSTATUS_End) { - IXFA_PageView* pPrePageView = pWidget->GetPageView(); - if (pPrePageView != pNewPageView || - (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == - (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { - pWidget->SetPageView(pNewPageView); - m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), - XFA_WIDGETEVENT_PostAdded, - pNewPageView, pPrePageView); - } - if ((dwStatus & XFA_WIDGETSTATUS_Visible) == 0) { - return; - } - if (pWidget->IsLoaded()) { - CFX_RectF rtOld; - pWidget->GetWidgetRect(rtOld); - CFX_RectF rtNew = pWidget->ReCacheWidgetRect(); - if (rtOld != rtNew) { - pWidget->PerformLayout(); - } - } else { - pWidget->LoadWidget(); - } - pWidget->AddInvalidateRect(NULL); - } else { + IXFA_PageView* pPrePageView = pWidget->GetPageView(); + if (pPrePageView != pNewPageView || + (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == + (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { pWidget->SetPageView(pNewPageView); + m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), + XFA_WIDGETEVENT_PostAdded, + pNewPageView, pPrePageView); } + if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || + !(dwStatus & XFA_WIDGETSTATUS_Visible)) { + return; + } + if (pWidget->IsLoaded()) { + CFX_RectF rtOld; + pWidget->GetWidgetRect(rtOld); + if (rtOld != pWidget->ReCacheWidgetRect()) + pWidget->PerformLayout(); + } else { + pWidget->LoadWidget(); + } + pWidget->AddInvalidateRect(nullptr); } void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, IXFA_DocLayout* pLayout, @@ -615,8 +610,6 @@ void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, void* pParam2) { CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); pDocView->DeleteLayoutItem(pWidget); - if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) - return; m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), XFA_WIDGETEVENT_PreRemoved, nullptr, pWidget->GetPageView()); |