Break CXFA_Node direct dependence on CXFA_LayoutProcessor.
Route such requests through the CXFA_FFNotifier mechanism.
Change-Id: Ibb5007d37fea5747ba6c580d06fea55f5e9f7667
Reviewed-on: https://pdfium-review.googlesource.com/c/50093
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index c32953f..ce81cdc 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -35,6 +35,7 @@
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_textlayout.h"
#include "xfa/fxfa/cxfa_textprovider.h"
+#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_barcode.h"
#include "xfa/fxfa/parser/cxfa_binditems.h"
#include "xfa/fxfa/parser/cxfa_button.h"
@@ -409,6 +410,12 @@
}
}
+void CXFA_FFNotify::OnContainerChanged(CXFA_Node* pNode) {
+ CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetLayoutProcessor();
+ if (pLayout)
+ pLayout->AddChangedContainer(pNode);
+}
+
void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) {
if (!pSender->IsFormContainer())
return;
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index 298a101..8d3b0bd 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -38,6 +38,7 @@
XFA_Attribute eAttr,
CXFA_Node* pParentNode,
CXFA_Node* pWidgetNode);
+ void OnContainerChanged(CXFA_Node* pNode);
void OnChildAdded(CXFA_Node* pSender);
void OnChildRemoved();
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 29e8f92..a816368 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -42,7 +42,6 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/cxfa_textprovider.h"
-#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_accessiblecontent.h"
#include "xfa/fxfa/parser/cxfa_acrobat.h"
#include "xfa/fxfa/parser/cxfa_acrobat7.h"
@@ -1900,10 +1899,6 @@
void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
bool bScriptModify) {
- CXFA_LayoutProcessor* pLayoutPro = GetDocument()->GetLayoutProcessor();
- if (!pLayoutPro)
- return;
-
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
return;
@@ -1998,7 +1993,7 @@
case XFA_Element::Field:
case XFA_Element::Subform:
case XFA_Element::SubformSet:
- pLayoutPro->AddChangedContainer(this);
+ pNotify->OnContainerChanged(this);
pNotify->OnValueChanged(this, eAttribute, this, this);
break;
case XFA_Element::Sharptext:
@@ -2046,7 +2041,7 @@
pParent = pParent->GetParent();
if (pParent)
- pLayoutPro->AddChangedContainer(pParent);
+ pNotify->OnContainerChanged(pParent);
}
void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) {