summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-04 16:53:15 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 22:08:21 +0000
commit9aeb0caba4cda9c6bd39ed079f88000a712f9890 (patch)
treecf5801fa3e5ed9194896771ca66a8a3b80fda709 /xfa
parent0545d2a5d759dbbb6ac3cce6d82bc0f2188cc4aa (diff)
downloadpdfium-9aeb0caba4cda9c6bd39ed079f88000a712f9890.tar.xz
Remove CXFA_WidgetData::{GetElementType|GetDatasets}
The GetElementType and GetDatasets methods have been removed from the CXFA_WidgetData class and we call the CXFA_Node methods directly. Change-Id: I5178be76c929ac3405eb6a65f9b8775b2f0283e2 Reviewed-on: https://pdfium-review.googlesource.com/22264 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp5
-rw-r--r--xfa/fxfa/cxfa_ffpageview.cpp3
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp10
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp2
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp18
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h3
6 files changed, 20 insertions, 21 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index a2f5ac4bb1..011e3bf8a0 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -408,8 +408,11 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
CXFA_EventParam* pParam) {
if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
+ if (!pWidgetAcc ||
+ (pWidgetAcc->GetNode() &&
+ pWidgetAcc->GetNode()->GetElementType() == XFA_Element::Draw)) {
return XFA_EVENTERROR_NotExist;
+ }
switch (pParam->m_eType) {
case XFA_EVENT_Calculate:
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index 40eeea5d9e..9708bfc606 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -73,7 +73,8 @@ bool PageWidgetFilter(CXFA_FFWidget* pWidget,
CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
if (!!(dwFilter & XFA_WidgetStatus_Focused) &&
- pWidgetAcc->GetElementType() != XFA_Element::Field) {
+ (!pWidgetAcc->GetNode() ||
+ pWidgetAcc->GetNode()->GetElementType() != XFA_Element::Field)) {
return false;
}
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 4c21c24e2e..8988cf1903 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -188,8 +188,11 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
if (eEventType == XFA_EVENT_Unknown)
return false;
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
+ if (!pWidgetAcc ||
+ (pWidgetAcc->GetNode() &&
+ pWidgetAcc->GetNode()->GetElementType() == XFA_Element::Draw)) {
return false;
+ }
switch (eEventType) {
case XFA_EVENT_Calculate: {
@@ -211,8 +214,11 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
CXFA_EventParam* pParam) {
if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
+ if (!pWidgetAcc ||
+ (pWidgetAcc->GetNode() &&
+ pWidgetAcc->GetNode()->GetElementType() == XFA_Element::Draw)) {
return XFA_EVENTERROR_NotExist;
+ }
switch (pParam->m_eType) {
case XFA_EVENT_Calculate:
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index a091baa24f..5e1b48066f 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -59,7 +59,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
}
if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
- CXFA_Node* pBind = m_pWidgetAcc->GetDatasets();
+ CXFA_Node* pBind = m_pWidgetAcc->GetNode()->GetBindData();
CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode);
for (CFX_XMLNode* pXMLChild =
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 88aaf42a55..12777b9143 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -364,14 +364,6 @@ CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_Node* pNode)
CXFA_WidgetAcc::~CXFA_WidgetAcc() = default;
-XFA_Element CXFA_WidgetAcc::GetElementType() const {
- return m_pNode ? m_pNode->GetElementType() : XFA_Element::Unknown;
-}
-
-CXFA_Node* CXFA_WidgetAcc::GetDatasets() {
- return m_pNode->GetBindData();
-}
-
void CXFA_WidgetAcc::ResetData() {
WideString wsValue;
XFA_Element eUIType = GetUIType();
@@ -452,7 +444,7 @@ void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType,
m_pNode->JSObject()->SetContent(wsData, GetFormatDataValue(wsData), true,
false, true);
- CXFA_Node* pBind = GetDatasets();
+ CXFA_Node* pBind = m_pNode->GetBindData();
if (!pBind) {
image->SetTransferEncoding(XFA_AttributeEnum::Base64);
return;
@@ -479,7 +471,7 @@ CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() {
int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_FFDocView* docView,
XFA_AttributeEnum iActivity,
CXFA_EventParam* pEventParam) {
- if (GetElementType() == XFA_Element::Draw)
+ if (m_pNode && m_pNode->GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
std::vector<CXFA_Event*> eventArray =
@@ -518,7 +510,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_FFDocView* docView,
}
int32_t CXFA_WidgetAcc::ProcessCalculate(CXFA_FFDocView* docView) {
- if (GetElementType() == XFA_Element::Draw)
+ if (m_pNode && m_pNode->GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
CXFA_Calculate* calc = GetCalculate();
@@ -733,7 +725,7 @@ WideString CXFA_WidgetAcc::GetValidateMessage(bool bError, bool bVersionFlag) {
int32_t CXFA_WidgetAcc::ProcessValidate(CXFA_FFDocView* docView,
int32_t iFlags) {
- if (GetElementType() == XFA_Element::Draw)
+ if (m_pNode && m_pNode->GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
CXFA_Validate* validate = GetValidate(false);
@@ -1582,7 +1574,7 @@ void CXFA_WidgetAcc::InitLayoutData() {
default:
break;
}
- if (GetElementType() == XFA_Element::Field) {
+ if (m_pNode && m_pNode->GetElementType() == XFA_Element::Field) {
m_pLayoutData = pdfium::MakeUnique<CXFA_FieldLayoutData>();
return;
}
diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h
index 2039d369b5..8d9bf6f753 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -62,8 +62,6 @@ class CXFA_WidgetAcc {
void ResetData();
- XFA_Element GetElementType() const;
-
CXFA_WidgetAcc* GetExclGroup();
int32_t ProcessEvent(CXFA_FFDocView* docView,
@@ -109,7 +107,6 @@ class CXFA_WidgetAcc {
void SetImageEditImage(const RetainPtr<CFX_DIBitmap>& newImage);
void UpdateUIDisplay(CXFA_FFDocView* docView, CXFA_FFWidget* pExcept);
- CXFA_Node* GetDatasets();
RetainPtr<CFGAS_GEFont> GetFDEFont(CXFA_FFDoc* doc);
float GetFontSize();
FX_ARGB GetTextColor();