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

Side by Side Diff: xfa/fde/css/fde_cssstyleselector.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years 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 | « xfa/fde/cfx_wordbreak.cpp ('k') | xfa/fde/fde_render.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 "xfa/fde/css/fde_cssstyleselector.h" 7 #include "xfa/fde/css/fde_cssstyleselector.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 11
12 #include "third_party/base/ptr_util.h"
12 #include "third_party/base/stl_util.h" 13 #include "third_party/base/stl_util.h"
13 #include "xfa/fde/css/fde_csscache.h" 14 #include "xfa/fde/css/fde_csscache.h"
14 #include "xfa/fde/css/fde_cssdeclaration.h" 15 #include "xfa/fde/css/fde_cssdeclaration.h"
15 #include "xfa/fde/css/fde_cssstylesheet.h" 16 #include "xfa/fde/css/fde_cssstylesheet.h"
16 #include "xfa/fde/css/fde_csssyntax.h" 17 #include "xfa/fde/css/fde_csssyntax.h"
17 #include "xfa/fxfa/app/xfa_textlayout.h" 18 #include "xfa/fxfa/app/xfa_textlayout.h"
18 19
19 #define FDE_CSSUNIVERSALHASH ('*') 20 #define FDE_CSSUNIVERSALHASH ('*')
20 21
21 int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) { 22 int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 Reset(); 120 Reset();
120 } 121 }
121 122
122 void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) { 123 void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) {
123 ASSERT(fFontSize > 0); 124 ASSERT(fFontSize > 0);
124 m_fDefFontSize = fFontSize; 125 m_fDefFontSize = fFontSize;
125 } 126 }
126 127
127 CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() { 128 CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() {
128 if (!m_pAccelerator) 129 if (!m_pAccelerator)
129 m_pAccelerator.reset(new CFDE_CSSAccelerator); 130 m_pAccelerator = pdfium::MakeUnique<CFDE_CSSAccelerator>();
130 m_pAccelerator->Clear(); 131 m_pAccelerator->Clear();
131 return m_pAccelerator.get(); 132 return m_pAccelerator.get();
132 } 133 }
133 134
134 IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( 135 IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle(
135 IFDE_CSSComputedStyle* pParentStyle) { 136 IFDE_CSSComputedStyle* pParentStyle) {
136 if (!m_pFixedStyleStore) { 137 if (!m_pFixedStyleStore) {
137 m_pFixedStyleStore = IFX_MemoryAllocator::Create( 138 m_pFixedStyleStore = IFX_MemoryAllocator::Create(
138 FX_ALLOCTYPE_Fixed, 16, sizeof(CFDE_CSSComputedStyle)); 139 FX_ALLOCTYPE_Fixed, 16, sizeof(CFDE_CSSComputedStyle));
139 } 140 }
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); 1933 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None);
1933 m_eDisplay = FDE_CSSDISPLAY_Inline; 1934 m_eDisplay = FDE_CSSDISPLAY_Inline;
1934 m_fVerticalAlign = 0.0f; 1935 m_fVerticalAlign = 0.0f;
1935 m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); 1936 m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto);
1936 m_ColumnGap.Set(FDE_CSSLENGTHUNIT_Normal); 1937 m_ColumnGap.Set(FDE_CSSLENGTHUNIT_Normal);
1937 m_bColumnRuleColorSame = true; 1938 m_bColumnRuleColorSame = true;
1938 m_ColumnWidth.Set(FDE_CSSLENGTHUNIT_Auto); 1939 m_ColumnWidth.Set(FDE_CSSLENGTHUNIT_Auto);
1939 m_ColumnRuleWidth.Set(FDE_CSSLENGTHUNIT_Auto); 1940 m_ColumnRuleWidth.Set(FDE_CSSLENGTHUNIT_Auto);
1940 m_eTextCombine = FDE_CSSTEXTCOMBINE_None; 1941 m_eTextCombine = FDE_CSSTEXTCOMBINE_None;
1941 } 1942 }
OLDNEW
« no previous file with comments | « xfa/fde/cfx_wordbreak.cpp ('k') | xfa/fde/fde_render.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698