summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-18 21:02:37 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-18 21:02:37 +0000
commitbbd02f1cd05f55cabee8fbd23a645ac69ac32574 (patch)
tree7932068c2548ed977e235b8ef38d36317a560c8e
parent4aadb708642003404e666026bb6d390b5989e2b4 (diff)
downloadpdfium-bbd02f1cd05f55cabee8fbd23a645ac69ac32574.tar.xz
Move XFA_IsCreateWidget to CXFA_Object
This CL removes the free XFA_IsCreateWidget method and moves the functionality into CXFA_Object::HasCreatedUIWidget to clarify the purpose. Change-Id: Icca1f49238040b5d87fbb4eb33340f9309f5e2f3 Reviewed-on: https://pdfium-review.googlesource.com/23133 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp11
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp7
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h1
-rw-r--r--xfa/fxfa/parser/cxfa_object.h6
4 files changed, 12 insertions, 13 deletions
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 1322461875..3f41620030 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -113,11 +113,11 @@ CXFA_ContainerLayoutItem* CXFA_FFNotify::OnCreateContainerLayoutItem(
CXFA_ContentLayoutItem* CXFA_FFNotify::OnCreateContentLayoutItem(
CXFA_Node* pNode) {
- XFA_Element eType = pNode->GetElementType();
- ASSERT(eType != XFA_Element::ContentArea && eType != XFA_Element::PageArea);
+ ASSERT(pNode->GetElementType() != XFA_Element::ContentArea);
+ ASSERT(pNode->GetElementType() != XFA_Element::PageArea);
// We only need to create the widget for certain types of objects.
- if (!XFA_IsCreateWidget(eType))
+ if (!pNode->HasCreatedUIWidget())
return new CXFA_ContentLayoutItem(pNode);
CXFA_FFWidget* pWidget;
@@ -343,13 +343,12 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
if (!pDocView)
return;
- XFA_Element eType = pNode->GetElementType();
- if (XFA_IsCreateWidget(eType)) {
+ if (pNode->HasCreatedUIWidget()) {
pNode->CreateWidgetAcc();
return;
}
- switch (eType) {
+ switch (pNode->GetElementType()) {
case XFA_Element::BindItems:
pDocView->AddBindItem(static_cast<CXFA_BindItems*>(pNode));
break;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 8df7ff7782..71c45c7620 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -221,16 +221,11 @@ void XFA_RectWithoutMargin(CFX_RectF& rt, const CXFA_Margin* margin, bool bUI) {
}
CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) {
- if (XFA_IsCreateWidget(pLayoutItem->GetFormNode()->GetElementType()))
+ if (pLayoutItem->GetFormNode()->HasCreatedUIWidget())
return static_cast<CXFA_FFWidget*>(pLayoutItem);
return nullptr;
}
-bool XFA_IsCreateWidget(XFA_Element eType) {
- return eType == XFA_Element::Field || eType == XFA_Element::Draw ||
- eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup;
-}
-
CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {}
CXFA_CalcData::~CXFA_CalcData() {}
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index aa913cca99..54aa191fed 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -51,7 +51,6 @@ void XFA_RectWithoutMargin(CFX_RectF& rt,
const CXFA_Margin* margin,
bool bUI = false);
CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
-bool XFA_IsCreateWidget(XFA_Element iType);
class CXFA_CalcData {
public:
diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h
index a58a922ea2..5d5f31c647 100644
--- a/xfa/fxfa/parser/cxfa_object.h
+++ b/xfa/fxfa/parser/cxfa_object.h
@@ -72,6 +72,12 @@ class CXFA_Object : public CFXJSE_HostObject {
CJX_Object* JSObject() { return m_pJSObject.get(); }
const CJX_Object* JSObject() const { return m_pJSObject.get(); }
+ bool HasCreatedUIWidget() const {
+ return m_elementType == XFA_Element::Field ||
+ m_elementType == XFA_Element::Draw ||
+ m_elementType == XFA_Element::Subform ||
+ m_elementType == XFA_Element::ExclGroup;
+ }
void CreateWidgetAcc();
CXFA_WidgetAcc* GetWidgetAcc() { return acc_.get(); }