From 414cc9c9676b01587010ec5475d495eef6e05ba3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 23 Jan 2018 21:17:43 +0000 Subject: Remove GetWidgetAcc calls This CL removes the calls to CXFA_Node::GetWidgetAcc() as they redundantly return the node they were called upon. Change-Id: I46e66cf98137a1dee7cd3fa8bc7d379eb97fded5 Reviewed-on: https://pdfium-review.googlesource.com/23630 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffnotify.cpp | 45 +++++++++++---------------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) (limited to 'xfa/fxfa/cxfa_ffnotify.cpp') diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp index 91d1a65997..3fd06a18be 100644 --- a/xfa/fxfa/cxfa_ffnotify.cpp +++ b/xfa/fxfa/cxfa_ffnotify.cpp @@ -71,9 +71,9 @@ void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_Node* pSender, return; CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender); - for (; pWidget; pWidget = pSender->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) { if (pWidget->IsLoaded()) { - if (pSender->GetWidgetAcc()->IsListBox()) + if (pSender->IsListBox()) ToListBox(pWidget)->InsertItem(pLabel, iIndex); else ToComboBox(pWidget)->InsertItem(pLabel, iIndex); @@ -87,9 +87,9 @@ void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_Node* pSender, return; CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender); - for (; pWidget; pWidget = pSender->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) { if (pWidget->IsLoaded()) { - if (pSender->GetWidgetAcc()->IsListBox()) + if (pSender->IsListBox()) ToListBox(pWidget)->DeleteItem(iIndex); else ToComboBox(pWidget)->DeleteItem(iIndex); @@ -130,7 +130,7 @@ CXFA_ContentLayoutItem* CXFA_FFNotify::OnCreateContentLayoutItem( pWidget = new CXFA_FFCheckButton(pNode); break; case XFA_Element::ChoiceList: { - if (pNode->GetWidgetAcc()->IsListBox()) + if (pNode->IsListBox()) pWidget = new CXFA_FFListBox(pNode); else pWidget = new CXFA_FFComboBox(pNode); @@ -193,19 +193,7 @@ CXFA_ContentLayoutItem* CXFA_FFNotify::OnCreateContentLayoutItem( void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem, float& fCalcWidth, float& fCalcHeight) { - if (!pItem->GetWidgetAcc()) - return; - - pItem->GetWidgetAcc()->StartWidgetLayout(m_pDoc.Get(), fCalcWidth, - fCalcHeight); -} - -bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - float& fCalcHeightPos) { - return pItem->GetWidgetAcc() && - pItem->GetWidgetAcc()->FindSplitPos(m_pDoc->GetDocView(), iBlockIndex, - fCalcHeightPos); + pItem->StartWidgetLayout(m_pDoc.Get(), fCalcWidth, fCalcHeight); } bool CXFA_FFNotify::RunScript(CXFA_Script* script, CXFA_Node* item) { @@ -237,8 +225,6 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); if (!pDocView) return; - if (!pNode->GetWidgetAcc()) - return; pDocView->AddCalculateNode(pNode); pDocView->AddValidateNode(pNode); @@ -360,11 +346,9 @@ void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, XFA_Attribute eAttr) { return; if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) return; - if (!pSender->GetWidgetAcc()) - return; CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender); - for (; pWidget; pWidget = pSender->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) { if (pWidget->IsLoaded()) pWidget->AddInvalidateRect(); } @@ -386,15 +370,11 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, XFA_Element eType = pParentNode->GetElementType(); bool bIsContainerNode = pParentNode->IsContainerNode(); - if (!pWidgetNode->GetWidgetAcc()) - return; - bool bUpdateProperty = false; pDocView->SetChangeMark(); switch (eType) { case XFA_Element::Caption: { - CXFA_TextLayout* pCapOut = - pWidgetNode->GetWidgetAcc()->GetCaptionTextLayout(); + CXFA_TextLayout* pCapOut = pWidgetNode->GetCaptionTextLayout(); if (!pCapOut) return; @@ -415,22 +395,19 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, pDocView->AddCalculateNodeNotify(pSender); if (eType == XFA_Element::Value || bIsContainerNode) { if (bIsContainerNode) { - pWidgetNode->GetWidgetAcc()->UpdateUIDisplay(m_pDoc->GetDocView(), - nullptr); + pWidgetNode->UpdateUIDisplay(m_pDoc->GetDocView(), nullptr); pDocView->AddCalculateNode(pWidgetNode); pDocView->AddValidateNode(pWidgetNode); } else if (pWidgetNode->GetParent()->GetElementType() == XFA_Element::ExclGroup) { - pWidgetNode->GetWidgetAcc()->UpdateUIDisplay(m_pDoc->GetDocView(), - nullptr); + pWidgetNode->UpdateUIDisplay(m_pDoc->GetDocView(), nullptr); } return; } } CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pWidgetNode); - for (; pWidget; - pWidget = pWidgetNode->GetWidgetAcc()->GetNextWidget(pWidget)) { + for (; pWidget; pWidget = pWidgetNode->GetNextWidget(pWidget)) { if (!pWidget->IsLoaded()) continue; -- cgit v1.2.3