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

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

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, Address comments. 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_form.cpp ('k') | core/src/fpdfdoc/doc_formfield.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 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWid getDict) 8 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWid getDict)
9 { 9 {
10 m_pField = pField; 10 m_pField = pField;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return CPDF_Action(m_pWidgetDict->GetDict("A")); 255 return CPDF_Action(m_pWidgetDict->GetDict("A"));
256 } 256 }
257 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A"); 257 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A");
258 if (!pObj) { 258 if (!pObj) {
259 return CPDF_Action(); 259 return CPDF_Action();
260 } 260 }
261 return CPDF_Action(pObj->GetDict()); 261 return CPDF_Action(pObj->GetDict());
262 } 262 }
263 CPDF_AAction CPDF_FormControl::GetAdditionalAction() 263 CPDF_AAction CPDF_FormControl::GetAdditionalAction()
264 { 264 {
265 if (m_pWidgetDict == NULL) { 265 if (!m_pWidgetDict) {
266 return NULL; 266 return nullptr;
267 } 267 }
268 if (m_pWidgetDict->KeyExist("AA")) { 268 if (m_pWidgetDict->KeyExist("AA")) {
269 return m_pWidgetDict->GetDict("AA"); 269 return m_pWidgetDict->GetDict("AA");
270 } else {
271 return m_pField->GetAdditionalAction();
272 } 270 }
271 return m_pField->GetAdditionalAction();
273 } 272 }
274 CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() 273 CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance()
275 { 274 {
276 if (m_pWidgetDict == NULL) { 275 if (!m_pWidgetDict) {
277 return CFX_ByteString(); 276 return CFX_ByteString();
278 } 277 }
279 if (m_pWidgetDict->KeyExist("DA")) { 278 if (m_pWidgetDict->KeyExist("DA")) {
280 return m_pWidgetDict->GetString("DA"); 279 return m_pWidgetDict->GetString("DA");
281 } else {
282 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA");
283 if (pObj == NULL) {
284 return m_pField->m_pForm->GetDefaultAppearance();
285 }
286 return pObj->GetString();
287 } 280 }
281 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA");
282 if (!pObj) {
283 return m_pField->m_pForm->GetDefaultAppearance();
284 }
285 return pObj->GetString();
288 } 286 }
289 287
290 CPDF_Font* CPDF_FormControl::GetDefaultControlFont() 288 CPDF_Font* CPDF_FormControl::GetDefaultControlFont()
291 { 289 {
292 CPDF_DefaultAppearance cDA = GetDefaultAppearance(); 290 CPDF_DefaultAppearance cDA = GetDefaultAppearance();
293 CFX_ByteString csFontNameTag; 291 CFX_ByteString csFontNameTag;
294 FX_FLOAT fFontSize; 292 FX_FLOAT fFontSize;
295 cDA.GetFont(csFontNameTag, fFontSize); 293 cDA.GetFont(csFontNameTag, fFontSize);
296 if (csFontNameTag.IsEmpty()) 294 if (csFontNameTag.IsEmpty())
297 return nullptr; 295 return nullptr;
(...skipping 28 matching lines...) Expand all
326 return pFont; 324 return pFont;
327 } 325 }
328 } 326 }
329 } 327 }
330 } 328 }
331 return nullptr; 329 return nullptr;
332 } 330 }
333 331
334 int CPDF_FormControl::GetControlAlignment() 332 int CPDF_FormControl::GetControlAlignment()
335 { 333 {
336 if (m_pWidgetDict == NULL) { 334 if (!m_pWidgetDict) {
337 return 0; 335 return 0;
338 } 336 }
339 if (m_pWidgetDict->KeyExist("Q")) { 337 if (m_pWidgetDict->KeyExist("Q")) {
340 return m_pWidgetDict->GetInteger("Q", 0); 338 return m_pWidgetDict->GetInteger("Q", 0);
341 } else {
342 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q");
343 if (pObj == NULL) {
344 return m_pField->m_pForm->GetFormAlignment();
345 }
346 return pObj->GetInteger();
347 } 339 }
340 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q");
341 if (pObj == NULL) {
342 return m_pField->m_pForm->GetFormAlignment();
343 }
344 return pObj->GetInteger();
348 } 345 }
349 FX_BOOL CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) 346 FX_BOOL CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry)
350 { 347 {
351 if (m_pDict == NULL) { 348 if (m_pDict == NULL) {
352 return FALSE; 349 return FALSE;
353 } 350 }
354 return m_pDict->KeyExist(csEntry); 351 return m_pDict->KeyExist(csEntry);
355 } 352 }
356 int CPDF_ApSettings::GetRotation() 353 int CPDF_ApSettings::GetRotation()
357 { 354 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 455 }
459 return m_pDict->GetDict(FX_BSTRC("IF")); 456 return m_pDict->GetDict(FX_BSTRC("IF"));
460 } 457 }
461 int CPDF_ApSettings::GetTextPosition() 458 int CPDF_ApSettings::GetTextPosition()
462 { 459 {
463 if (m_pDict == NULL) { 460 if (m_pDict == NULL) {
464 return TEXTPOS_CAPTION; 461 return TEXTPOS_CAPTION;
465 } 462 }
466 return m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION); 463 return m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION);
467 } 464 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698