summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-23 21:17:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-23 21:17:43 +0000
commit414cc9c9676b01587010ec5475d495eef6e05ba3 (patch)
treec4474fdd1cd945a16eb70cb0cb24b074e2010f22 /xfa/fxfa/parser
parent9b85f4ba6fdd86c488498003a2db5854d4ece036 (diff)
downloadpdfium-414cc9c9676b01587010ec5475d495eef6e05ba3.tar.xz
Remove GetWidgetAcc calls
This CL removes the calls to CXFA_Node::GetWidgetAcc() as they redundantly return the node they were called upon. Change-Id: I46e66cf98137a1dee7cd3fa8bc7d379eb97fded5 Reviewed-on: https://pdfium-review.googlesource.com/23630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp45
-rw-r--r--xfa/fxfa/parser/cxfa_node.h5
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp37
4 files changed, 37 insertions, 55 deletions
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 434d7ed892..98e3234e40 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -15,6 +15,7 @@
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
@@ -1015,8 +1016,8 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem,
bChanged = false;
{
float fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset;
- if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(),
- fRelSplitPos)) {
+ if (pFormNode->FindSplitPos(pNotify->GetHDOC()->GetDocView(),
+ pLayoutItem->GetIndex(), fRelSplitPos)) {
bAnyChanged = true;
bChanged = true;
*fProposedSplitPos = fCurVerticalOffset + fRelSplitPos;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 988d1e2ee5..46342a883d 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1038,35 +1038,30 @@ CXFA_Node* CXFA_Node::GetContainerNode() {
return nullptr;
if (eType == XFA_Element::Field) {
- CXFA_Node* pFieldWidgetAcc = GetWidgetAcc();
- if (pFieldWidgetAcc && pFieldWidgetAcc->IsChoiceListMultiSelect())
+ if (IsChoiceListMultiSelect())
return nullptr;
- WideString wsPicture;
- if (pFieldWidgetAcc) {
- wsPicture = pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind);
- }
+ WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind);
if (!wsPicture.IsEmpty())
return this;
CXFA_Node* pDataNode = GetBindData();
if (!pDataNode)
return nullptr;
- pFieldWidgetAcc = nullptr;
+
+ CXFA_Node* pFieldNode = nullptr;
for (const auto& pFormNode : *(pDataNode->GetBindItems())) {
if (!pFormNode || pFormNode->HasRemovedChildren())
continue;
- pFieldWidgetAcc =
- pFormNode->IsWidgetReady() ? pFormNode->GetWidgetAcc() : nullptr;
- if (pFieldWidgetAcc) {
- wsPicture =
- pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind);
- }
+ pFieldNode = pFormNode->IsWidgetReady() ? pFormNode.Get() : nullptr;
+ if (pFieldNode)
+ wsPicture = pFieldNode->GetPictureContent(XFA_VALUEPICTURE_DataBind);
if (!wsPicture.IsEmpty())
break;
- pFieldWidgetAcc = nullptr;
+
+ pFieldNode = nullptr;
}
- return pFieldWidgetAcc ? pFieldWidgetAcc->GetNode() : nullptr;
+ return pFieldNode;
}
CXFA_Node* pGrandNode = pParentNode ? pParentNode->GetParent() : nullptr;
@@ -1998,8 +1993,8 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) {
WideString wsFormatValue = wsValue;
CXFA_Node* pContainerNode = GetContainerNode();
- if (pContainerNode && pContainerNode->GetWidgetAcc())
- wsFormatValue = pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsValue);
+ if (pContainerNode)
+ wsFormatValue = pContainerNode->GetFormatDataValue(wsValue);
JSObject()->SetContent(wsValue, wsFormatValue, bNotify, false, true);
}
@@ -2194,8 +2189,8 @@ int32_t CXFA_Node::ProcessCalculate(CXFA_FFDocView* docView) {
return iRet;
if (GetRawValue() != EventParam.m_wsResult) {
- GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult);
- GetWidgetAcc()->UpdateUIDisplay(docView, nullptr);
+ SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult);
+ UpdateUIDisplay(docView, nullptr);
}
return XFA_EVENTERROR_Success;
}
@@ -2292,7 +2287,7 @@ int32_t CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* docView,
CXFA_Validate* validate,
int32_t iFlags,
bool bVersionFlag) {
- if (!GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw).IsEmpty())
+ if (!GetValue(XFA_VALUEPICTURE_Raw).IsEmpty())
return XFA_EVENTERROR_Success;
if (m_bIsNull && m_bPreNull)
return XFA_EVENTERROR_Success;
@@ -2502,8 +2497,7 @@ std::pair<int32_t, bool> CXFA_Node::ExecuteBoolScript(
if (pEventParam->m_eType == XFA_EVENT_InitCalculate) {
if ((iRet == XFA_EVENTERROR_Success) &&
(GetRawValue() != pEventParam->m_wsResult)) {
- GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Raw,
- pEventParam->m_wsResult);
+ SetValue(XFA_VALUEPICTURE_Raw, pEventParam->m_wsResult);
docView->AddValidateNode(this);
}
}
@@ -2778,14 +2772,13 @@ void CXFA_Node::ResetData() {
if (!pChild->IsWidgetReady())
continue;
- CXFA_Node* pAcc = pChild->GetWidgetAcc();
bool done = false;
if (wsValue.IsEmpty()) {
- CXFA_Value* defValue = pAcc->GetNode()->GetDefaultValueIfExists();
+ CXFA_Value* defValue = pChild->GetDefaultValueIfExists();
if (defValue) {
wsValue = defValue->GetChildValueContent();
SetValue(XFA_VALUEPICTURE_Raw, wsValue);
- pAcc->SetValue(XFA_VALUEPICTURE_Raw, wsValue);
+ pChild->SetValue(XFA_VALUEPICTURE_Raw, wsValue);
done = true;
}
}
@@ -2802,7 +2795,7 @@ void CXFA_Node::ResetData() {
->JSObject()
->GetContent(false);
}
- pAcc->SetValue(XFA_VALUEPICTURE_Raw, itemText);
+ pChild->SetValue(XFA_VALUEPICTURE_Raw, itemText);
}
pNextChild = pChild->GetNextContainerSibling();
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 6b6e865353..47fd30bc8e 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -324,11 +324,6 @@ class CXFA_Node : public CXFA_Object {
void SetWidgetReady() { is_widget_ready_ = true; }
bool IsWidgetReady() const { return is_widget_ready_; }
- // TODO(dsinclair): Remove post WidgetAcc merge.
- CXFA_Node* GetWidgetAcc() {
- ASSERT(IsWidgetReady());
- return this;
- }
std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
bool bIsFormReady);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 8b0fa40250..7875ff89d1 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -152,8 +152,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
ASSERT(pXMLDataElement);
pDataNode->JSObject()->SetAttributeValue(
- wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue),
- false, false);
+ wsValue, pFormNode->GetFormatDataValue(wsValue), false, false);
pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType,
wsContentType, false, false);
if (!wsHref.IsEmpty())
@@ -163,9 +162,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
}
case XFA_Element::ChoiceList:
wsValue = defValue ? defValue->GetChildValueContent() : L"";
- if (pFormNode->GetWidgetAcc()->IsChoiceListMultiSelect()) {
+ if (pFormNode->IsChoiceListMultiSelect()) {
std::vector<WideString> wsSelTextArray =
- pFormNode->GetWidgetAcc()->GetSelectedItemsValue();
+ pFormNode->GetSelectedItemsValue();
if (!wsSelTextArray.empty()) {
for (const auto& text : wsSelTextArray) {
CXFA_Node* pValue =
@@ -185,8 +184,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
}
} else if (!wsValue.IsEmpty()) {
pDataNode->JSObject()->SetAttributeValue(
- wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue),
- false, false);
+ wsValue, pFormNode->GetFormatDataValue(wsValue), false, false);
}
break;
case XFA_Element::CheckButton:
@@ -195,8 +193,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
break;
pDataNode->JSObject()->SetAttributeValue(
- wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue),
- false, false);
+ wsValue, pFormNode->GetFormatDataValue(wsValue), false, false);
break;
case XFA_Element::ExclGroup: {
CXFA_Node* pChecked = nullptr;
@@ -265,10 +262,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (wsValue.IsEmpty())
break;
- wsValue = pFormNode->GetWidgetAcc()->NormalizeNumStr(wsValue);
+ wsValue = pFormNode->NormalizeNumStr(wsValue);
pDataNode->JSObject()->SetAttributeValue(
- wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue),
- false, false);
+ wsValue, pFormNode->GetFormatDataValue(wsValue), false, false);
CXFA_Value* pValue =
pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>(
0, XFA_Element::Value);
@@ -281,16 +277,14 @@ void CreateDataBinding(CXFA_Node* pFormNode,
break;
pDataNode->JSObject()->SetAttributeValue(
- wsValue, pFormNode->GetWidgetAcc()->GetFormatDataValue(wsValue),
- false, false);
+ wsValue, pFormNode->GetFormatDataValue(wsValue), false, false);
break;
}
return;
}
WideString wsXMLValue = pDataNode->JSObject()->GetContent(false);
- WideString wsNormalizeValue =
- pFormNode->GetWidgetAcc()->GetNormalizeDataValue(wsXMLValue);
+ WideString wsNormalizeValue = pFormNode->GetNormalizeDataValue(wsXMLValue);
pDataNode->JSObject()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false,
false);
@@ -319,7 +313,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
break;
}
case XFA_Element::ChoiceList:
- if (pFormNode->GetWidgetAcc()->IsChoiceListMultiSelect()) {
+ if (pFormNode->IsChoiceListMultiSelect()) {
std::vector<CXFA_Node*> items = pDataNode->GetNodeList(
XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties,
XFA_Element::Unknown);
@@ -352,8 +346,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
XFA_Element::Text);
break;
case XFA_Element::ExclGroup: {
- pFormNode->GetWidgetAcc()->SetSelectedMemberByValue(
- wsNormalizeValue.AsStringView(), false, false, false);
+ pFormNode->SetSelectedMemberByValue(wsNormalizeValue.AsStringView(),
+ false, false, false);
break;
}
case XFA_Element::DateTimeEdit:
@@ -361,11 +355,10 @@ void CreateDataBinding(CXFA_Node* pFormNode,
XFA_Element::DateTime);
break;
case XFA_Element::NumericEdit: {
- WideString wsPicture = pFormNode->GetWidgetAcc()->GetPictureContent(
- XFA_VALUEPICTURE_DataBind);
+ WideString wsPicture =
+ pFormNode->GetPictureContent(XFA_VALUEPICTURE_DataBind);
if (wsPicture.IsEmpty())
- wsNormalizeValue =
- pFormNode->GetWidgetAcc()->NormalizeNumStr(wsNormalizeValue);
+ wsNormalizeValue = pFormNode->NormalizeNumStr(wsNormalizeValue);
FormValueNode_SetChildContent(defValue, wsNormalizeValue,
XFA_Element::Float);