Move CXFA_Node::UpdateUIDisplay() to CFXA_FFDocView::UpdateUIDisplay()
Removes knowlege of CXFA_FFWidget from cfxa_node.h.
Change-Id: Iae3f84235e160aab04f5503e07a5e26772bc345b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63811
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index ba05835..84a58a1 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -15,6 +15,7 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_value.h"
@@ -146,7 +147,7 @@
if (!m_pNode->SetValue(XFA_VALUEPICTURE_Edit, pPicker->GetEditText()))
return false;
- m_pNode->UpdateUIDisplay(GetDoc()->GetDocView(), this);
+ GetDoc()->GetDocView()->UpdateUIDisplay(m_pNode.Get(), this);
return true;
}
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 97a2883..7c21efb 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -194,6 +194,19 @@
UnlockUpdate();
}
+void CXFA_FFDocView::UpdateUIDisplay(CXFA_Node* pNode, CXFA_FFWidget* pExcept) {
+ CXFA_FFWidget* pWidget = GetWidgetForNode(pNode);
+ for (; pWidget; pWidget = pWidget->GetNextFFWidget()) {
+ if (pWidget == pExcept || !pWidget->IsLoaded() ||
+ (pNode->GetFFWidgetType() != XFA_FFWidgetType::kCheckButton &&
+ pWidget->IsFocused())) {
+ continue;
+ }
+ pWidget->UpdateFWLData();
+ pWidget->InvalidateRect();
+ }
+}
+
int32_t CXFA_FFDocView::CountPageViews() const {
return m_pXFADocLayout ? m_pXFADocLayout->CountPages() : 0;
}
@@ -215,7 +228,7 @@
return false;
pNode->ResetData();
- pNode->UpdateUIDisplay(this, nullptr);
+ UpdateUIDisplay(pNode, nullptr);
CXFA_Validate* validate = pNode->GetValidateIfExists();
if (!validate)
return true;
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index 092616e..04ee03a 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -54,7 +54,10 @@
int32_t DoLayout();
void StopLayout();
int32_t GetLayoutStatus() const { return m_iStatus; }
+
void UpdateDocView();
+ void UpdateUIDisplay(CXFA_Node* pNode, CXFA_FFWidget* pExcept);
+
int32_t CountPageViews() const;
CXFA_FFPageView* GetPageView(int32_t nIndex) const;
@@ -75,7 +78,6 @@
void RunDocClose();
void ProcessValueChanged(CXFA_Node* node);
-
void SetChangeMark();
void AddValidateNode(CXFA_Node* node);
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index f9cc0ca..d610cc4 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -388,12 +388,12 @@
pDocView->AddCalculateNodeNotify(pSender);
if (eType == XFA_Element::Value || bIsContainerNode) {
if (bIsContainerNode) {
- pWidgetNode->UpdateUIDisplay(m_pDoc->GetDocView(), nullptr);
+ m_pDoc->GetDocView()->UpdateUIDisplay(pWidgetNode, nullptr);
pDocView->AddCalculateNode(pWidgetNode);
pDocView->AddValidateNode(pWidgetNode);
} else if (pWidgetNode->GetParent()->GetElementType() ==
XFA_Element::ExclGroup) {
- pWidgetNode->UpdateUIDisplay(m_pDoc->GetDocView(), nullptr);
+ m_pDoc->GetDocView()->UpdateUIDisplay(pWidgetNode, nullptr);
}
return;
}
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index 5ac9f57..1754b06 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -19,6 +19,7 @@
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/parser/cxfa_barcode.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_para.h"
@@ -186,7 +187,7 @@
bool CXFA_FFTextEdit::CommitData() {
WideString wsText = ToEdit(GetNormalWidget())->GetText();
if (m_pNode->SetValue(XFA_VALUEPICTURE_Edit, wsText)) {
- m_pNode->UpdateUIDisplay(GetDoc()->GetDocView(), this);
+ GetDoc()->GetDocView()->UpdateUIDisplay(m_pNode.Get(), this);
return true;
}
ValidateNumberField(wsText);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f5fbd3c..44ff533 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -40,7 +40,6 @@
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
-#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/cxfa_textprovider.h"
#include "xfa/fxfa/parser/cxfa_accessiblecontent.h"
@@ -2398,7 +2397,7 @@
if (GetRawValue() != EventParam.m_wsResult) {
SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult);
- UpdateUIDisplay(pDocView, nullptr);
+ pDocView->UpdateUIDisplay(this, nullptr);
}
return XFA_EventError::kSuccess;
}
@@ -3070,20 +3069,6 @@
pElement->SetAttribute(L"href", wsHref);
}
-void CXFA_Node::UpdateUIDisplay(CXFA_FFDocView* pDocView,
- CXFA_FFWidget* pExcept) {
- CXFA_FFWidget* pWidget = pDocView->GetWidgetForNode(this);
- for (; pWidget; pWidget = pWidget->GetNextFFWidget()) {
- if (pWidget == pExcept || !pWidget->IsLoaded() ||
- (GetFFWidgetType() != XFA_FFWidgetType::kCheckButton &&
- pWidget->IsFocused())) {
- continue;
- }
- pWidget->UpdateFWLData();
- pWidget->InvalidateRect();
- }
-}
-
void CXFA_Node::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF* pszCap) {
CXFA_Caption* caption = GetCaptionIfExists();
if (!caption || !caption->IsVisible())
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index aded300..c8ba273 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -32,7 +32,6 @@
class CXFA_EventParam;
class CXFA_FFDoc;
class CXFA_FFDocView;
-class CXFA_FFWidget;
class CXFA_Font;
class CXFA_Keep;
class CXFA_Margin;
@@ -304,7 +303,6 @@
RetainPtr<CFX_DIBitmap> GetImageEditImage();
void SetImageImage(const RetainPtr<CFX_DIBitmap>& newImage);
void SetImageEditImage(const RetainPtr<CFX_DIBitmap>& newImage);
- void UpdateUIDisplay(CXFA_FFDocView* pDocView, CXFA_FFWidget* pExcept);
RetainPtr<CFGAS_GEFont> GetFDEFont(CXFA_FFDoc* doc);