diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-23 21:17:43 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-23 21:17:43 +0000 |
commit | 414cc9c9676b01587010ec5475d495eef6e05ba3 (patch) | |
tree | c4474fdd1cd945a16eb70cb0cb24b074e2010f22 /fxjs/xfa | |
parent | 9b85f4ba6fdd86c488498003a2db5854d4ece036 (diff) | |
download | pdfium-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 'fxjs/xfa')
-rw-r--r-- | fxjs/xfa/cjx_boolean.cpp | 6 | ||||
-rw-r--r-- | fxjs/xfa/cjx_exclgroup.cpp | 8 | ||||
-rw-r--r-- | fxjs/xfa/cjx_field.cpp | 60 | ||||
-rw-r--r-- | fxjs/xfa/cjx_node.cpp | 2 | ||||
-rw-r--r-- | fxjs/xfa/cjx_object.cpp | 17 |
5 files changed, 38 insertions, 55 deletions
diff --git a/fxjs/xfa/cjx_boolean.cpp b/fxjs/xfa/cjx_boolean.cpp index 6abcd3c8bd..7ca3889ee6 100644 --- a/fxjs/xfa/cjx_boolean.cpp +++ b/fxjs/xfa/cjx_boolean.cpp @@ -36,10 +36,8 @@ void CJX_Boolean::defaultValue(CFXJSE_Value* pValue, WideString wsNewValue(iValue == 0 ? L"0" : L"1"); WideString wsFormatValue(wsNewValue); CXFA_Node* pContainerNode = ToNode(GetXFAObject())->GetContainerNode(); - if (pContainerNode && pContainerNode->GetWidgetAcc()) { - wsFormatValue = - pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewValue); - } + if (pContainerNode) + wsFormatValue = pContainerNode->GetFormatDataValue(wsNewValue); SetContent(wsNewValue, wsFormatValue, true, true, true); } diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp index fbce784b42..85a6697442 100644 --- a/fxjs/xfa/cjx_exclgroup.cpp +++ b/fxjs/xfa/cjx_exclgroup.cpp @@ -94,9 +94,9 @@ CJS_Return CJX_ExclGroup::selectedMember( CXFA_Node* pReturnNode = nullptr; if (params.empty()) { - pReturnNode = node->GetWidgetAcc()->GetSelectedMember(); + pReturnNode = node->GetSelectedMember(); } else { - pReturnNode = node->GetWidgetAcc()->SetSelectedMember( + pReturnNode = node->SetSelectedMember( runtime->ToWideString(params[0]).AsStringView(), true); } if (!pReturnNode) @@ -118,8 +118,8 @@ void CJX_ExclGroup::defaultValue(CFXJSE_Value* pValue, return; if (bSetting) { - node->GetWidgetAcc()->SetSelectedMemberByValue( - pValue->ToWideString().AsStringView(), true, true, true); + node->SetSelectedMemberByValue(pValue->ToWideString().AsStringView(), true, + true, true); return; } diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp index 9433127eba..9b4364bc14 100644 --- a/fxjs/xfa/cjx_field.cpp +++ b/fxjs/xfa/cjx_field.cpp @@ -43,7 +43,7 @@ CJS_Return CJX_Field::clearItems( const std::vector<v8::Local<v8::Value>>& params) { CXFA_Node* node = GetXFANode(); if (node->IsWidgetReady()) - node->GetWidgetAcc()->DeleteItem(-1, true, false); + node->DeleteItem(-1, true, false); return CJS_Return(true); } @@ -86,8 +86,7 @@ CJS_Return CJX_Field::deleteItem( if (!node->IsWidgetReady()) return CJS_Return(true); - bool bValue = - node->GetWidgetAcc()->DeleteItem(runtime->ToInt32(params[0]), true, true); + bool bValue = node->DeleteItem(runtime->ToInt32(params[0]), true, true); return CJS_Return(runtime->NewBoolean(bValue)); } @@ -105,8 +104,7 @@ CJS_Return CJX_Field::getSaveItem( if (!node->IsWidgetReady()) return CJS_Return(runtime->NewNull()); - Optional<WideString> value = - node->GetWidgetAcc()->GetChoiceListItem(iIndex, true); + Optional<WideString> value = node->GetChoiceListItem(iIndex, true); if (!value) return CJS_Return(runtime->NewNull()); @@ -124,8 +122,7 @@ CJS_Return CJX_Field::boundItem( return CJS_Return(true); WideString value = runtime->ToWideString(params[0]); - WideString boundValue = - node->GetWidgetAcc()->GetItemValue(value.AsStringView()); + WideString boundValue = node->GetItemValue(value.AsStringView()); return CJS_Return(runtime->NewString(boundValue.UTF8Encode().AsStringView())); } @@ -139,8 +136,7 @@ CJS_Return CJX_Field::getItemState( if (!node->IsWidgetReady()) return CJS_Return(true); - int32_t state = - node->GetWidgetAcc()->GetItemState(runtime->ToInt32(params[0])); + int32_t state = node->GetItemState(runtime->ToInt32(params[0])); return CJS_Return(runtime->NewBoolean(state != 0)); } @@ -172,8 +168,7 @@ CJS_Return CJX_Field::getDisplayItem( if (!node->IsWidgetReady()) return CJS_Return(runtime->NewNull()); - Optional<WideString> value = - node->GetWidgetAcc()->GetChoiceListItem(iIndex, false); + Optional<WideString> value = node->GetChoiceListItem(iIndex, false); if (!value) return CJS_Return(runtime->NewNull()); @@ -192,11 +187,11 @@ CJS_Return CJX_Field::setItemState( int32_t iIndex = runtime->ToInt32(params[0]); if (runtime->ToInt32(params[1]) != 0) { - node->GetWidgetAcc()->SetItemState(iIndex, true, true, true, true); + node->SetItemState(iIndex, true, true, true, true); return CJS_Return(true); } - if (node->GetWidgetAcc()->GetItemState(iIndex)) - node->GetWidgetAcc()->SetItemState(iIndex, false, true, true, true); + if (node->GetItemState(iIndex)) + node->SetItemState(iIndex, false, true, true, true); return CJS_Return(true); } @@ -218,7 +213,7 @@ CJS_Return CJX_Field::addItem(CJS_V8* runtime, if (params.size() >= 2) value = runtime->ToWideString(params[1]); - node->GetWidgetAcc()->InsertItem(label, value, true); + node->InsertItem(label, value, true); return CJS_Return(true); } @@ -255,17 +250,14 @@ void CJX_Field::defaultValue(CFXJSE_Value* pValue, wsNewText = pValue->ToWideString(); if (xfaNode->GetUIChild()->GetElementType() == XFA_Element::NumericEdit) { - wsNewText = xfaNode->GetWidgetAcc()->NumericLimit( - wsNewText, xfaNode->GetWidgetAcc()->GetLeadDigits(), - xfaNode->GetWidgetAcc()->GetFracDigits()); + wsNewText = xfaNode->NumericLimit(wsNewText, xfaNode->GetLeadDigits(), + xfaNode->GetFracDigits()); } CXFA_Node* pContainerNode = xfaNode->GetContainerNode(); WideString wsFormatText(wsNewText); - if (pContainerNode && pContainerNode->GetWidgetAcc()) { - wsFormatText = - pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewText); - } + if (pContainerNode) + wsFormatText = pContainerNode->GetFormatDataValue(wsNewText); SetContent(wsNewText, wsFormatText, true, true, true); return; @@ -307,14 +299,11 @@ void CJX_Field::editValue(CFXJSE_Value* pValue, return; if (bSetting) { - node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, - pValue->ToWideString()); + node->SetValue(XFA_VALUEPICTURE_Edit, pValue->ToWideString()); return; } - pValue->SetString(node->GetWidgetAcc() - ->GetValue(XFA_VALUEPICTURE_Edit) - .UTF8Encode() - .AsStringView()); + pValue->SetString( + node->GetValue(XFA_VALUEPICTURE_Edit).UTF8Encode().AsStringView()); } void CJX_Field::formatMessage(CFXJSE_Value* pValue, @@ -331,14 +320,11 @@ void CJX_Field::formattedValue(CFXJSE_Value* pValue, return; if (bSetting) { - node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Display, - pValue->ToWideString()); + node->SetValue(XFA_VALUEPICTURE_Display, pValue->ToWideString()); return; } - pValue->SetString(node->GetWidgetAcc() - ->GetValue(XFA_VALUEPICTURE_Display) - .UTF8Encode() - .AsStringView()); + pValue->SetString( + node->GetValue(XFA_VALUEPICTURE_Display).UTF8Encode().AsStringView()); } void CJX_Field::parentSubform(CFXJSE_Value* pValue, @@ -359,17 +345,17 @@ void CJX_Field::selectedIndex(CFXJSE_Value* pValue, return; if (!bSetting) { - pValue->SetInteger(node->GetWidgetAcc()->GetSelectedItem(0)); + pValue->SetInteger(node->GetSelectedItem(0)); return; } int32_t iIndex = pValue->ToInteger(); if (iIndex == -1) { - node->GetWidgetAcc()->ClearAllSelections(); + node->ClearAllSelections(); return; } - node->GetWidgetAcc()->SetItemState(iIndex, true, true, true, true); + node->SetItemState(iIndex, true, true, true, true); } void CJX_Field::access(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 6458a33367..1d6e022060 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -519,7 +519,7 @@ int32_t CJX_Node::execSingleEventByName(const WideStringView& wsEventName, CXFA_Node* pUINode = GetXFANode()->GetUIChild(); if (pUINode->GetElementType() != XFA_Element::ChoiceList || - GetXFANode()->GetWidgetAcc()->IsListBox()) { + GetXFANode()->IsListBox()) { return XFA_EVENTERROR_NotExist; } return pNotify->ExecEventByDeepFirst( diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 0c57392ce3..46af66ae28 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -1158,8 +1158,8 @@ void CJX_Object::MoveBufferMapData(CXFA_Object* pDstModule) { WideString wsValue = ToNode(pDstModule)->JSObject()->GetContent(false); WideString wsFormatValue(wsValue); CXFA_Node* pNode = ToNode(pDstModule)->GetContainerNode(); - if (pNode && pNode->GetWidgetAcc()) - wsFormatValue = pNode->GetWidgetAcc()->GetFormatDataValue(wsValue); + if (pNode) + wsFormatValue = pNode->GetFormatDataValue(wsValue); ToNode(pDstModule) ->JSObject() @@ -1482,7 +1482,7 @@ void CJX_Object::Script_Field_Length(CFXJSE_Value* pValue, pValue->SetInteger(0); return; } - pValue->SetInteger(node->GetWidgetAcc()->CountChoiceListItems(true)); + pValue->SetInteger(node->CountChoiceListItems(true)); } void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, @@ -1523,9 +1523,9 @@ void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, continue; pContainerNode = pFormNode->GetContainerNode(); - if (pContainerNode && pContainerNode->GetWidgetAcc()) { - wsPicture = pContainerNode->GetWidgetAcc()->GetPictureContent( - XFA_VALUEPICTURE_DataBind); + if (pContainerNode) { + wsPicture = + pContainerNode->GetPictureContent(XFA_VALUEPICTURE_DataBind); } if (!wsPicture.IsEmpty()) break; @@ -1537,9 +1537,8 @@ void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue, pContainerNode = ToNode(GetXFAObject())->GetContainerNode(); } - if (pContainerNode && pContainerNode->GetWidgetAcc()) - wsFormatValue = - pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewValue); + if (pContainerNode) + wsFormatValue = pContainerNode->GetFormatDataValue(wsNewValue); SetContent(wsNewValue, wsFormatValue, true, true, true); return; |