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

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

Issue 1967963002: CPDF_VariableText::GetIterator() never returns NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix more nits in CFX_Edit Created 4 years, 7 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 | « no previous file | core/fpdfdoc/cpvt_generateap.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 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/fpdfapi/fpdf_font/include/cpdf_font.h" 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
8 #include "core/fpdfdoc/cpvt_wordinfo.h" 8 #include "core/fpdfdoc/cpvt_wordinfo.h"
9 #include "core/fpdfdoc/csection.h" 9 #include "core/fpdfdoc/csection.h"
10 #include "core/fpdfdoc/include/cpdf_variabletext.h" 10 #include "core/fpdfdoc/include/cpdf_variabletext.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 m_bLimitWidth(FALSE), 249 m_bLimitWidth(FALSE),
250 m_bAutoFontSize(FALSE), 250 m_bAutoFontSize(FALSE),
251 m_nAlignment(0), 251 m_nAlignment(0),
252 m_fLineLeading(0.0f), 252 m_fLineLeading(0.0f),
253 m_fCharSpace(0.0f), 253 m_fCharSpace(0.0f),
254 m_nHorzScale(100), 254 m_nHorzScale(100),
255 m_wSubWord(0), 255 m_wSubWord(0),
256 m_fFontSize(0.0f), 256 m_fFontSize(0.0f),
257 m_bInitial(FALSE), 257 m_bInitial(FALSE),
258 m_bRichText(FALSE), 258 m_bRichText(FALSE),
259 m_pVTProvider(nullptr), 259 m_pVTProvider(nullptr) {}
260 m_pVTIterator(nullptr) {}
261 260
262 CPDF_VariableText::~CPDF_VariableText() { 261 CPDF_VariableText::~CPDF_VariableText() {
263 delete m_pVTIterator;
264 ResetAll(); 262 ResetAll();
265 } 263 }
266 264
267 void CPDF_VariableText::Initialize() { 265 void CPDF_VariableText::Initialize() {
268 if (!m_bInitial) { 266 if (!m_bInitial) {
269 CPVT_SectionInfo secinfo; 267 CPVT_SectionInfo secinfo;
270 if (m_bRichText) { 268 if (m_bRichText) {
271 secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); 269 secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0);
272 secinfo.pWordProps = new CPVT_WordProps( 270 secinfo.pWordProps = new CPVT_WordProps(
273 GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0); 271 GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0);
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 int32_t CPDF_VariableText::GetDefaultFontIndex() { 1140 int32_t CPDF_VariableText::GetDefaultFontIndex() {
1143 return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; 1141 return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1;
1144 } 1142 }
1145 1143
1146 FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) { 1144 FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) {
1147 return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE; 1145 return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE;
1148 } 1146 }
1149 1147
1150 CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() { 1148 CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() {
1151 if (!m_pVTIterator) 1149 if (!m_pVTIterator)
1152 m_pVTIterator = new CPDF_VariableText::Iterator(this); 1150 m_pVTIterator.reset(new CPDF_VariableText::Iterator(this));
1153 return m_pVTIterator; 1151 return m_pVTIterator.get();
1154 } 1152 }
1155 1153
1156 void CPDF_VariableText::SetProvider(CPDF_VariableText::Provider* pProvider) { 1154 void CPDF_VariableText::SetProvider(CPDF_VariableText::Provider* pProvider) {
1157 m_pVTProvider = pProvider; 1155 m_pVTProvider = pProvider;
1158 } 1156 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfdoc/cpvt_generateap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698