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

Side by Side Diff: core/src/fpdfdoc/doc_ap.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 | « core/src/fpdfdoc/doc_action.cpp ('k') | core/src/fpdfdoc/doc_basic.cpp » ('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 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 "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 #include "../../include/fpdfdoc/fpdf_vt.h" 8 #include "../../include/fpdfdoc/fpdf_vt.h"
9 #include "pdf_vt.h" 9 #include "pdf_vt.h"
10 #include "../../include/fpdfdoc/fpdf_ap.h" 10 #include "../../include/fpdfdoc/fpdf_ap.h"
11 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) 11 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
12 { 12 {
13 if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget ")) { 13 if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget ")) {
14 return FALSE; 14 return FALSE;
15 } 15 }
16 CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString() ; 16 CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString() ;
17 FX_DWORD flags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnn otDict, "Ff")->GetInteger() : 0; 17 FX_DWORD flags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnn otDict, "Ff")->GetInteger() : 0;
18 if (field_type == "Tx") { 18 if (field_type == "Tx") {
19 return CPVT_GenerateAP::GenerateTextFieldAP(pDoc, pAnnotDict); 19 return CPVT_GenerateAP::GenerateTextFieldAP(pDoc, pAnnotDict);
20 } else if (field_type == "Ch") { 20 }
21 if (flags & (1 << 17)) { 21 if (field_type == "Ch") {
22 return CPVT_GenerateAP::GenerateComboBoxAP(pDoc, pAnnotDict); 22 return (flags & (1 << 17)) ?
23 } else { 23 CPVT_GenerateAP::GenerateComboBoxAP(pDoc, pAnnotDict) :
24 return CPVT_GenerateAP::GenerateListBoxAP(pDoc, pAnnotDict); 24 CPVT_GenerateAP::GenerateListBoxAP(pDoc, pAnnotDict);
25 } 25 }
26 } else if (field_type == "Btn") { 26 if (field_type == "Btn") {
27 if (!(flags & (1 << 16))) { 27 if (!(flags & (1 << 16))) {
28 if (!pAnnotDict->KeyExist("AS")) { 28 if (!pAnnotDict->KeyExist("AS")) {
29 if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDict("Parent") ) { 29 if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDict("Parent") ) {
30 if (pParentDict->KeyExist("AS")) { 30 if (pParentDict->KeyExist("AS")) {
31 pAnnotDict->SetAtString("AS", pParentDict->GetString("AS ")); 31 pAnnotDict->SetAtString("AS", pParentDict->GetString("AS "));
32 } 32 }
33 } 33 }
34 } 34 }
35 } 35 }
36 } 36 }
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 case CT_GRAY: 801 case CT_GRAY:
802 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n"; 802 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n";
803 break; 803 break;
804 case CT_CMYK: 804 case CT_CMYK:
805 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " " 805 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " "
806 << (bFillOrStroke ? "k" : "K") << "\n"; 806 << (bFillOrStroke ? "k" : "K") << "\n";
807 break; 807 break;
808 } 808 }
809 return sColorStream.GetByteString(); 809 return sColorStream.GetByteString();
810 } 810 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_action.cpp ('k') | core/src/fpdfdoc/doc_basic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698