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

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

Issue 2478253002: Revert of Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: Created 4 years, 1 month 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/fpdfdoc/cpdf_filespec_unittest.cpp ('k') | core/fxge/dib/fx_dib_engine_unittest.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 "core/fpdfdoc/cpdf_formfield.h" 7 #include "core/fpdfdoc/cpdf_formfield.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 } else { 569 } else {
570 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); 570 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
571 if (pValue) { 571 if (pValue) {
572 if (GetType() == ListBox) { 572 if (GetType() == ListBox) {
573 SelectOption(index, false); 573 SelectOption(index, false);
574 if (pValue->IsString()) { 574 if (pValue->IsString()) {
575 if (pValue->GetUnicodeText() == opt_value) 575 if (pValue->GetUnicodeText() == opt_value)
576 m_pDict->RemoveFor("V"); 576 m_pDict->RemoveFor("V");
577 } else if (pValue->IsArray()) { 577 } else if (pValue->IsArray()) {
578 std::unique_ptr<CPDF_Array> pArray(new CPDF_Array); 578 std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray(
579 new CPDF_Array);
579 for (int i = 0; i < CountOptions(); i++) { 580 for (int i = 0; i < CountOptions(); i++) {
580 if (i != index && IsItemSelected(i)) { 581 if (i != index && IsItemSelected(i)) {
581 opt_value = GetOptionValue(i); 582 opt_value = GetOptionValue(i);
582 pArray->AddString(PDF_EncodeText(opt_value)); 583 pArray->AddString(PDF_EncodeText(opt_value));
583 } 584 }
584 } 585 }
585 if (pArray->GetCount() > 0) 586 if (pArray->GetCount() > 0)
586 m_pDict->SetFor("V", pArray.release()); // std::move someday 587 m_pDict->SetFor("V", pArray.release()); // std::move someday
587 } 588 }
588 } else { 589 } else {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 case ListBox: 990 case ListBox:
990 NotifyAfterSelectionChange(); 991 NotifyAfterSelectionChange();
991 break; 992 break;
992 case ComboBox: 993 case ComboBox:
993 NotifyAfterValueChange(); 994 NotifyAfterValueChange();
994 break; 995 break;
995 default: 996 default:
996 break; 997 break;
997 } 998 }
998 } 999 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_filespec_unittest.cpp ('k') | core/fxge/dib/fx_dib_engine_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698