Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: xfa/fxfa/parser/xfa_object_imp.cpp

Issue 2009813004: Enable chromium_code standard for XFA code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_widgetmgr.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/xfa_object.h" 7 #include "xfa/fxfa/parser/xfa_object.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 822 }
823 } 823 }
824 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { 824 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) {
825 int32_t iLength = pArguments->GetLength(); 825 int32_t iLength = pArguments->GetLength();
826 if (iLength != 1) { 826 if (iLength != 1) {
827 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); 827 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL");
828 return; 828 return;
829 } 829 }
830 CFX_WideString wsExpression = 830 CFX_WideString wsExpression =
831 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 831 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
832 // TODO(tsepez): actually do something here? 832 // TODO(weili): check whether we need to implement this, pdfium:501.
833 // For now, just put the variables here to avoid unused variable warning.
834 (void)wsExpression;
833 } 835 }
836
834 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { 837 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) {
835 int32_t iLength = pArguments->GetLength(); 838 int32_t iLength = pArguments->GetLength();
836 if (iLength < 1 || iLength > 3) { 839 if (iLength < 1 || iLength > 3) {
837 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode"); 840 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode");
838 return; 841 return;
839 } 842 }
840 CFX_WideString wsExpression; 843 CFX_WideString wsExpression;
841 CFX_WideString wsValue; 844 CFX_WideString wsValue;
842 int32_t iAction = 0; 845 int32_t iAction = 0;
843 if (iLength >= 1) { 846 if (iLength >= 1) {
844 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 847 wsExpression =
845 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); 848 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
846 } 849 }
847 if (iLength >= 2) { 850 if (iLength >= 2) {
848 CFX_ByteString bsValue = pArguments->GetUTF8String(1); 851 wsValue =
849 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); 852 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
850 } 853 }
851 if (iLength >= 3) { 854 if (iLength >= 3)
852 iAction = pArguments->GetInt32(2); 855 iAction = pArguments->GetInt32(2);
853 } 856 // TODO(weili): check whether we need to implement this, pdfium:501.
857 // For now, just put the variables here to avoid unused variable warning.
858 (void)wsExpression;
859 (void)wsValue;
860 (void)iAction;
854 } 861 }
862
855 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { 863 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) {
856 int32_t iLength = pArguments->GetLength(); 864 int32_t iLength = pArguments->GetLength();
857 if (iLength != 1) { 865 if (iLength != 1) {
858 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone"); 866 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone");
859 return; 867 return;
860 } 868 }
861 FX_BOOL bClone = TRUE; 869 FX_BOOL bClone = TRUE;
862 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 870 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
863 CXFA_Node* pCloneNode = Clone(bClone); 871 CXFA_Node* pCloneNode = Clone(bClone);
864 FXJSE_Value_Set( 872 FXJSE_Value_Set(
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1140 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
1133 L"setAttribute"); 1141 L"setAttribute");
1134 return; 1142 return;
1135 } 1143 }
1136 CFX_WideString wsAttributeValue = 1144 CFX_WideString wsAttributeValue =
1137 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 1145 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
1138 CFX_WideString wsAttribute = 1146 CFX_WideString wsAttribute =
1139 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); 1147 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
1140 SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), TRUE); 1148 SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), TRUE);
1141 } 1149 }
1150
1142 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { 1151 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
1143 int32_t iLength = pArguments->GetLength(); 1152 int32_t iLength = pArguments->GetLength();
1144 if (iLength != 1 && iLength != 2) { 1153 if (iLength != 1 && iLength != 2) {
1145 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); 1154 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement");
1146 return; 1155 return;
1147 } 1156 }
1148 CXFA_Node* pNode = NULL; 1157 CXFA_Node* pNode = nullptr;
1149 CFX_WideString wsName; 1158 CFX_WideString wsName;
1150 if (iLength >= 1) { 1159 if (iLength >= 1)
1151 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 1160 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
1161 if (iLength >= 2) {
1162 wsName = CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
1152 } 1163 }
1153 if (iLength >= 2) { 1164 // TODO(weili): check whether we need to implement this, pdfium:501.
1154 CFX_ByteString bsName = pArguments->GetUTF8String(1); 1165 // For now, just put the variables here to avoid unused variable warning.
1155 wsName = CFX_WideString::FromUTF8(bsName.AsStringC()); 1166 (void)pNode;
1156 } 1167 (void)wsName;
1157 } 1168 }
1169
1158 void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue, 1170 void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue,
1159 FX_BOOL bSetting, 1171 FX_BOOL bSetting,
1160 XFA_ATTRIBUTE eAttribute) { 1172 XFA_ATTRIBUTE eAttribute) {
1161 if (bSetting) { 1173 if (bSetting) {
1162 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1174 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1163 } else { 1175 } else {
1164 CFX_WideString wsNameSpace; 1176 CFX_WideString wsNameSpace;
1165 TryNamespace(wsNameSpace); 1177 TryNamespace(wsNameSpace);
1166 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsNameSpace).AsStringC()); 1178 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsNameSpace).AsStringC());
1167 } 1179 }
(...skipping 4182 matching lines...) Expand 10 before | Expand all | Expand 10 after
5350 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5362 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5351 } 5363 }
5352 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5364 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5353 return m_pAttachNode->RemoveChild(pNode); 5365 return m_pAttachNode->RemoveChild(pNode);
5354 } 5366 }
5355 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5367 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5356 return m_pAttachNode->GetChild( 5368 return m_pAttachNode->GetChild(
5357 iIndex, XFA_ELEMENT_UNKNOWN, 5369 iIndex, XFA_ELEMENT_UNKNOWN,
5358 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5370 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5359 } 5371 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_widgetmgr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698