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

Side by Side Diff: core/fpdfdoc/cpdf_interform.cpp

Issue 2554223002: Fix the way to check terminal field in interactive form (Closed)
Patch Set: add test Created 4 years 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 | « DEPS ('k') | testing/SUPPRESSIONS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfdoc/cpdf_interform.h" 7 #include "core/fpdfdoc/cpdf_interform.h"
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 return; 1072 return;
1073 1073
1074 for (size_t i = 0; i < pAnnots->GetCount(); i++) { 1074 for (size_t i = 0; i < pAnnots->GetCount(); i++) {
1075 CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i); 1075 CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i);
1076 if (pAnnot && pAnnot->GetStringFor("Subtype") == "Widget") 1076 if (pAnnot && pAnnot->GetStringFor("Subtype") == "Widget")
1077 LoadField(pAnnot, 0); 1077 LoadField(pAnnot, 0);
1078 } 1078 }
1079 } 1079 }
1080 1080
1081 CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { 1081 CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
1082 if (!pFieldDict->KeyExist("T")) 1082 if (!pFieldDict->KeyExist("FT")) {
1083 return nullptr; 1083 // Key "FT" is required for terminal fields, it is also inheritable.
1084 CPDF_Dictionary* pParentDict = pFieldDict->GetDictFor("Parent");
1085 if (!pParentDict || !pParentDict->KeyExist("FT"))
1086 return nullptr;
1087 }
1084 1088
1085 CPDF_Dictionary* pDict = pFieldDict; 1089 CPDF_Dictionary* pDict = pFieldDict;
1086 CFX_WideString csWName = FPDF_GetFullName(pFieldDict); 1090 CFX_WideString csWName = FPDF_GetFullName(pFieldDict);
1087 if (csWName.IsEmpty()) 1091 if (csWName.IsEmpty())
1088 return nullptr; 1092 return nullptr;
1089 1093
1090 CPDF_FormField* pField = nullptr; 1094 CPDF_FormField* pField = nullptr;
1091 pField = m_pFieldTree->GetField(csWName); 1095 pField = m_pFieldTree->GetField(csWName);
1092 if (!pField) { 1096 if (!pField) {
1093 CPDF_Dictionary* pParent = pFieldDict; 1097 CPDF_Dictionary* pParent = pFieldDict;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 else if (iType == FIELDTYPE_LISTBOX) 1314 else if (iType == FIELDTYPE_LISTBOX)
1311 m_pFormNotify->AfterSelectionChange(pField); 1315 m_pFormNotify->AfterSelectionChange(pField);
1312 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) 1316 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD)
1313 m_pFormNotify->AfterValueChange(pField); 1317 m_pFormNotify->AfterValueChange(pField);
1314 } 1318 }
1315 } 1319 }
1316 1320
1317 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { 1321 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) {
1318 m_pFormNotify = pNotify; 1322 m_pFormNotify = pNotify;
1319 } 1323 }
OLDNEW
« no previous file with comments | « DEPS ('k') | testing/SUPPRESSIONS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698