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

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

Issue 1821413002: Fix parsing of double dot operators for FormCalc (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Windows xfa diff'd. Created 4 years, 9 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 | « testing/SUPPRESSIONS ('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_script_resolveprocessor.h" 7 #include "xfa/fxfa/parser/xfa_script_resolveprocessor.h"
8 8
9 #include "core/include/fxcrt/fx_ext.h" 9 #include "core/include/fxcrt/fx_ext.h"
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 FX_WCHAR wch = rnd.m_wsName.GetAt(0); 45 FX_WCHAR wch = rnd.m_wsName.GetAt(0);
46 switch (wch) { 46 switch (wch) {
47 case '$': 47 case '$':
48 return XFA_ResolveNodes_Dollar(rnd); 48 return XFA_ResolveNodes_Dollar(rnd);
49 case '!': 49 case '!':
50 return XFA_ResolveNodes_Excalmatory(rnd); 50 return XFA_ResolveNodes_Excalmatory(rnd);
51 case '#': 51 case '#':
52 return XFA_ResolveNodes_NumberSign(rnd); 52 return XFA_ResolveNodes_NumberSign(rnd);
53 case '*': 53 case '*':
54 return XFA_ResolveNodes_Asterisk(rnd); 54 return XFA_ResolveNodes_Asterisk(rnd);
55 // TODO(dsinclair@chromium.org): We could probably remove this.
55 case '.': 56 case '.':
56 return XFA_ResolveNodes_AnyChild(rnd); 57 return XFA_ResolveNodes_AnyChild(rnd);
57 default: 58 default:
58 break; 59 break;
59 } 60 }
60 if (rnd.m_uHashName == XFA_HASHCODE_This && rnd.m_nLevel == 0) { 61 if (rnd.m_uHashName == XFA_HASHCODE_This && rnd.m_nLevel == 0) {
61 rnd.m_Nodes.Add(rnd.m_pSC->GetThisObject()); 62 rnd.m_Nodes.Add(rnd.m_pSC->GetThisObject());
62 return 1; 63 return 1;
63 } else if (rnd.m_CurNode->GetClassID() == XFA_ELEMENT_Xfa) { 64 } else if (rnd.m_CurNode->GetClassID() == XFA_ELEMENT_Xfa) {
64 CXFA_Object* pObjNode = 65 CXFA_Object* pObjNode =
(...skipping 13 matching lines...) Expand all
78 return rnd.m_Nodes.GetSize(); 79 return rnd.m_Nodes.GetSize();
79 } 80 }
80 int32_t nRet = XFA_ResolveNodes_Normal(rnd); 81 int32_t nRet = XFA_ResolveNodes_Normal(rnd);
81 if (nRet < 1 && rnd.m_uHashName == XFA_HASHCODE_Xfa) { 82 if (nRet < 1 && rnd.m_uHashName == XFA_HASHCODE_Xfa) {
82 rnd.m_Nodes.Add(rnd.m_pSC->GetDocument()->GetRoot()); 83 rnd.m_Nodes.Add(rnd.m_pSC->GetDocument()->GetRoot());
83 } 84 }
84 return rnd.m_Nodes.GetSize(); 85 return rnd.m_Nodes.GetSize();
85 } 86 }
86 int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( 87 int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild(
87 CXFA_ResolveNodesData& rnd) { 88 CXFA_ResolveNodesData& rnd) {
88 CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); 89 CFX_WideString wsName = rnd.m_wsName;
89 CFX_WideString wsCondition = rnd.m_wsCondition; 90 CFX_WideString wsCondition = rnd.m_wsCondition;
90 CXFA_Node* findNode = NULL; 91 CXFA_Node* findNode = NULL;
91 CXFA_NodeArray siblings; 92 CXFA_NodeArray siblings;
92 FX_BOOL bClassName = FALSE; 93 FX_BOOL bClassName = FALSE;
93 if (wsName.GetAt(0) == '#') { 94 if (wsName.GetAt(0) == '#') {
94 bClassName = TRUE; 95 bClassName = TRUE;
95 wsName = wsName.Right(wsName.GetLength() - 1); 96 wsName = wsName.Right(wsName.GetLength() - 1);
96 } 97 }
97 findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(ToNode(rnd.m_CurNode), 98 findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(ToNode(rnd.m_CurNode),
98 wsName, bClassName); 99 wsName, bClassName);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 FX_WCHAR wPrev = 0, wCur; 540 FX_WCHAR wPrev = 0, wCur;
540 FX_BOOL bIsCondition = FALSE; 541 FX_BOOL bIsCondition = FALSE;
541 while (nStart < iLength) { 542 while (nStart < iLength) {
542 wCur = pSrc[nStart++]; 543 wCur = pSrc[nStart++];
543 if (wCur == '.') { 544 if (wCur == '.') {
544 if (wPrev == '\\') { 545 if (wPrev == '\\') {
545 pNameBuf[nNameCount - 1] = wPrev = '.'; 546 pNameBuf[nNameCount - 1] = wPrev = '.';
546 continue; 547 continue;
547 } 548 }
548 if (nNameCount == 0) { 549 if (nNameCount == 0) {
549 pNameBuf[nNameCount++] = wCur; 550 rnd.m_dwStyles |= XFA_RESOLVENODE_AnyChild;
550 continue; 551 continue;
551 } 552 }
552 FX_WCHAR wLookahead = nStart < iLength ? pSrc[nStart] : 0; 553 FX_WCHAR wLookahead = nStart < iLength ? pSrc[nStart] : 0;
553 if (wLookahead != '[' && wLookahead != '(') { 554 if (wLookahead != '[' && wLookahead != '(') {
554 if (nType < 0) { 555 if (nType < 0) {
555 break; 556 break;
556 } 557 }
557 } 558 }
558 } 559 }
559 if (wCur == '[' || wCur == '(') { 560 if (wCur == '[' || wCur == '(') {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 if (m_pNodeHelper->XFA_CreateNode_ForCondition(wsNextCondition)) { 817 if (m_pNodeHelper->XFA_CreateNode_ForCondition(wsNextCondition)) {
817 if (m_pNodeHelper->m_eLastCreateType == XFA_ELEMENT_DataGroup) { 818 if (m_pNodeHelper->m_eLastCreateType == XFA_ELEMENT_DataGroup) {
818 iIndex = 0; 819 iIndex = 0;
819 } else { 820 } else {
820 iIndex = iCount - 1; 821 iIndex = iCount - 1;
821 } 822 }
822 } else { 823 } else {
823 iIndex = iCount - 1; 824 iIndex = iCount - 1;
824 } 825 }
825 } 826 }
OLDNEW
« no previous file with comments | « testing/SUPPRESSIONS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698