Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "fpdfsdk/formfiller/cffl_formfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 10 #include "core/fxge/include/cfx_renderdevice.h" | 10 #include "core/fxge/include/cfx_renderdevice.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 return rect; | 520 return rect; |
| 521 } | 521 } |
| 522 | 522 |
| 523 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, | 523 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, |
| 524 uint32_t nFlag) { | 524 uint32_t nFlag) { |
| 525 if (IsDataChanged(pPageView)) { | 525 if (IsDataChanged(pPageView)) { |
| 526 FX_BOOL bRC = TRUE; | 526 FX_BOOL bRC = TRUE; |
| 527 FX_BOOL bExit = FALSE; | 527 FX_BOOL bExit = FALSE; |
| 528 CFFL_InteractiveFormFiller* pFormFiller = | 528 CFFL_InteractiveFormFiller* pFormFiller = |
| 529 m_pEnv->GetInteractiveFormFiller(); | 529 m_pEnv->GetInteractiveFormFiller(); |
| 530 pFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); | 530 CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); |
| 531 pFormFiller->OnKeyStrokeCommit(pObserved, pPageView, bRC, bExit, nFlag); | |
| 532 if (!pObserved) | |
|
Lei Zhang
2016/09/27 17:02:22
Combine into: if (!pObserved || bExit)
Same patte
Tom Sepez
2016/09/27 20:21:08
Ah, ok. bExit in a few places is an out variable,
| |
| 533 bExit = TRUE; | |
| 531 if (bExit) | 534 if (bExit) |
| 532 return TRUE; | 535 return TRUE; |
| 533 if (!bRC) { | 536 if (!bRC) { |
| 534 ResetPDFWindow(pPageView, FALSE); | 537 ResetPDFWindow(pPageView, FALSE); |
| 535 return TRUE; | 538 return TRUE; |
| 536 } | 539 } |
| 537 | 540 pFormFiller->OnValidate(pObserved, pPageView, bRC, bExit, nFlag); |
| 538 pFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); | 541 if (!pObserved) |
| 542 bExit = TRUE; | |
| 539 if (bExit) | 543 if (bExit) |
| 540 return TRUE; | 544 return TRUE; |
| 541 if (!bRC) { | 545 if (!bRC) { |
| 542 ResetPDFWindow(pPageView, FALSE); | 546 ResetPDFWindow(pPageView, FALSE); |
| 543 return TRUE; | 547 return TRUE; |
| 544 } | 548 } |
| 545 | 549 |
| 546 SaveData(pPageView); | 550 SaveData(pPageView); |
| 547 pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); | 551 pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); |
| 548 if (bExit) | 552 if (bExit) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 716 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
| 713 } | 717 } |
| 714 } | 718 } |
| 715 | 719 |
| 716 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 720 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
| 717 CPDFSDK_Annot* pAnnot, | 721 CPDFSDK_Annot* pAnnot, |
| 718 CFX_RenderDevice* pDevice, | 722 CFX_RenderDevice* pDevice, |
| 719 CFX_Matrix* pUser2Device) { | 723 CFX_Matrix* pUser2Device) { |
| 720 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); | 724 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
| 721 } | 725 } |
| OLD | NEW |