summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_textprovider.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-22 21:09:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-22 21:09:48 +0000
commit19991292768336013649c61dd56976d0698aa804 (patch)
tree5aeb7b6734b7627bd86ebe94086ef7d5b6640527 /xfa/fxfa/cxfa_textprovider.cpp
parentec06e1186d0dc1b5bcac6a0d73c5d51e8a4682df (diff)
downloadpdfium-19991292768336013649c61dd56976d0698aa804.tar.xz
Convert CXFA_TextProvider to use a CXFA_Node
This CL changes CXFA_TextProvider to accept a CXFA_Node instead of a CXFA_WidgetAcc. The internal uses were updated as needed. Change-Id: Iaa9e4024371a3ae9521caf1444b298fb3710f829 Reviewed-on: https://pdfium-review.googlesource.com/23390 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_textprovider.cpp')
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp44
1 files changed, 19 insertions, 25 deletions
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 6e5db65b57..9ea083831f 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -28,6 +28,7 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
+#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/parser/cxfa_caption.h"
#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_items.h"
@@ -43,9 +44,8 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
bRichText = false;
if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
- CXFA_Node* pElementNode = m_pWidgetAcc->GetNode();
CXFA_Value* pValueNode =
- pElementNode->GetChild<CXFA_Value>(0, XFA_Element::Value, false);
+ m_pNode->GetChild<CXFA_Value>(0, XFA_Element::Value, false);
if (!pValueNode)
return nullptr;
@@ -60,7 +60,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
}
if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
- CXFA_Node* pBind = m_pWidgetAcc->GetNode()->GetBindData();
+ CXFA_Node* pBind = m_pNode->GetBindData();
CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode);
for (CFX_XMLNode* pXMLChild =
@@ -78,8 +78,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) {
CXFA_Caption* pCaptionNode =
- m_pWidgetAcc->GetNode()->GetChild<CXFA_Caption>(0, XFA_Element::Caption,
- false);
+ m_pNode->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
if (!pCaptionNode)
return nullptr;
@@ -98,8 +97,8 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
return pChildNode;
}
- CXFA_Items* pItemNode = m_pWidgetAcc->GetNode()->GetChild<CXFA_Items>(
- 0, XFA_Element::Items, false);
+ CXFA_Items* pItemNode =
+ m_pNode->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
if (!pItemNode)
return nullptr;
@@ -118,28 +117,28 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
CXFA_Para* CXFA_TextProvider::GetParaIfExists() {
if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
- return m_pWidgetAcc->GetNode()->GetParaIfExists();
+ return m_pNode->GetParaIfExists();
- CXFA_Caption* pNode = m_pWidgetAcc->GetNode()->GetChild<CXFA_Caption>(
- 0, XFA_Element::Caption, false);
+ CXFA_Caption* pNode =
+ m_pNode->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
return pNode->GetChild<CXFA_Para>(0, XFA_Element::Para, false);
}
CXFA_Font* CXFA_TextProvider::GetFontIfExists() {
if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
- return m_pWidgetAcc->GetNode()->GetFontIfExists();
+ return m_pNode->GetFontIfExists();
- CXFA_Caption* pNode = m_pWidgetAcc->GetNode()->GetChild<CXFA_Caption>(
- 0, XFA_Element::Caption, false);
+ CXFA_Caption* pNode =
+ m_pNode->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
CXFA_Font* font = pNode->GetChild<CXFA_Font>(0, XFA_Element::Font, false);
- return font ? font : m_pWidgetAcc->GetNode()->GetFontIfExists();
+ return font ? font : m_pNode->GetFontIfExists();
}
bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() {
- XFA_Element eType = m_pWidgetAcc->GetNode()->GetUIType();
+ XFA_Element eType = m_pNode->GetUIType();
if (eType != XFA_Element::CheckButton)
return false;
- return !m_pWidgetAcc->GetNode()->TryWidth();
+ return !m_pNode->TryWidth();
}
bool CXFA_TextProvider::GetEmbbedObj(bool bURI,
@@ -152,11 +151,9 @@ bool CXFA_TextProvider::GetEmbbedObj(bool bURI,
if (!bURI)
return false;
- CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode();
- CXFA_Node* pParent = pWidgetNode->GetParent();
- CXFA_Document* pDocument = pWidgetNode->GetDocument();
+ CXFA_Node* pParent = m_pNode->GetParent();
+ CXFA_Document* pDocument = m_pNode->GetDocument();
CXFA_Node* pIDNode = nullptr;
- CXFA_WidgetAcc* pEmbAcc = nullptr;
if (pParent)
pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringView());
@@ -165,12 +162,9 @@ bool CXFA_TextProvider::GetEmbbedObj(bool bURI,
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)),
wsAttr.AsStringView());
}
- if (pIDNode)
- pEmbAcc = pIDNode->IsWidgetReady() ? pIDNode->GetWidgetAcc() : nullptr;
-
- if (!pEmbAcc)
+ if (!pIDNode || !pIDNode->IsWidgetReady())
return false;
- wsValue = pEmbAcc->GetValue(XFA_VALUEPICTURE_Display);
+ wsValue = pIDNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display);
return true;
}