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

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

Issue 1876253002: Cleaning up FDE_CSS Classes. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « xfa/fde/css/fde_cssstyleselector.h ('k') | xfa/fxfa/app/xfa_textlayout.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 10
11 #include "xfa/fde/css/fde_csscache.h" 11 #include "xfa/fde/css/fde_csscache.h"
12 #include "xfa/fde/css/fde_cssdeclaration.h" 12 #include "xfa/fde/css/fde_cssdeclaration.h"
13 13
14 #define FDE_CSSUNIVERSALHASH ('*')
15
14 int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) { 16 int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) {
15 int32_t iCount = m_arrCounterData.GetSize(); 17 int32_t iCount = m_arrCounterData.GetSize();
16 for (int32_t i = 0; i < iCount; i++) { 18 for (int32_t i = 0; i < iCount; i++) {
17 if (FXSYS_wcscmp(pszIdentifier, m_arrCounterData.ElementAt(i).m_pszIdent) == 19 if (FXSYS_wcscmp(pszIdentifier, m_arrCounterData.ElementAt(i).m_pszIdent) ==
18 0) { 20 0) {
19 return i; 21 return i;
20 } 22 }
21 } 23 }
22 return -1; 24 return -1;
23 } 25 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 69 }
68 void CFDE_CSSCounterStyle::UpdateIndex() { 70 void CFDE_CSSCounterStyle::UpdateIndex() {
69 if (!m_bIndexDirty) { 71 if (!m_bIndexDirty) {
70 return; 72 return;
71 } 73 }
72 m_arrCounterData.RemoveAll(); 74 m_arrCounterData.RemoveAll();
73 DoUpdateIndex(m_pCounterInc); 75 DoUpdateIndex(m_pCounterInc);
74 DoUpdateIndex(m_pCounterReset); 76 DoUpdateIndex(m_pCounterReset);
75 m_bIndexDirty = FALSE; 77 m_bIndexDirty = FALSE;
76 } 78 }
77 FDE_CSSTEXTEMPHASISMARK CFDE_CSSComputedStyle::GetTextEmphasisMark() const { 79
78 if (m_InheritedData.m_eTextEmphasisMark != FDE_CSSTEXTEMPHASISMARK_Auto) {
79 return (FDE_CSSTEXTEMPHASISMARK)m_InheritedData.m_eTextEmphasisMark;
80 }
81 if (m_InheritedData.m_eWritingMode == FDE_CSSWRITINGMODE_HorizontalTb) {
82 return FDE_CSSTEXTEMPHASISMARK_Dot;
83 }
84 return FDE_CSSTEXTEMPHASISMARK_Sesame;
85 }
86 FDE_CSSRuleData::FDE_CSSRuleData(IFDE_CSSSelector* pSel, 80 FDE_CSSRuleData::FDE_CSSRuleData(IFDE_CSSSelector* pSel,
87 IFDE_CSSDeclaration* pDecl, 81 IFDE_CSSDeclaration* pDecl,
88 uint32_t dwPos) 82 uint32_t dwPos)
89 : pSelector(pSel), pDeclaration(pDecl), dwPriority(dwPos), pNext(NULL) { 83 : pSelector(pSel), pDeclaration(pDecl), dwPriority(dwPos), pNext(NULL) {
90 static const uint32_t s_Specific[5] = {0x00010000, 0x00010000, 0x00100000, 84 static const uint32_t s_Specific[5] = {0x00010000, 0x00010000, 0x00100000,
91 0x00100000, 0x01000000}; 85 0x00100000, 0x01000000};
92 for (; pSel != NULL; pSel = pSel->GetNextSelector()) { 86 for (; pSel != NULL; pSel = pSel->GetNextSelector()) {
93 FDE_CSSSELECTORTYPE eType = pSel->GetType(); 87 FDE_CSSSELECTORTYPE eType = pSel->GetType();
94 if (eType > FDE_CSSSELECTORTYPE_Descendant || 88 if (eType > FDE_CSSSELECTORTYPE_Descendant ||
95 pSel->GetNameHash() != FDE_CSSUNIVERSALHASH) { 89 pSel->GetNameHash() != FDE_CSSUNIVERSALHASH) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 delete m_pAccelerator; 232 delete m_pAccelerator;
239 } 233 }
240 } 234 }
241 void CFDE_CSSStyleSelector::SetFontMgr(IFX_FontMgr* pFontMgr) { 235 void CFDE_CSSStyleSelector::SetFontMgr(IFX_FontMgr* pFontMgr) {
242 m_pFontMgr = pFontMgr; 236 m_pFontMgr = pFontMgr;
243 } 237 }
244 void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) { 238 void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) {
245 FXSYS_assert(fFontSize > 0); 239 FXSYS_assert(fFontSize > 0);
246 m_fDefFontSize = fFontSize; 240 m_fDefFontSize = fFontSize;
247 } 241 }
248 IFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() { 242 CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() {
249 if (m_pAccelerator == NULL) { 243 if (m_pAccelerator == NULL) {
250 m_pAccelerator = new CFDE_CSSAccelerator; 244 m_pAccelerator = new CFDE_CSSAccelerator;
251 FXSYS_assert(m_pAccelerator != NULL); 245 FXSYS_assert(m_pAccelerator != NULL);
252 } 246 }
253 m_pAccelerator->Clear(); 247 m_pAccelerator->Clear();
254 return m_pAccelerator; 248 return m_pAccelerator;
255 } 249 }
256 IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( 250 IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle(
257 IFDE_CSSComputedStyle* pParentStyle) { 251 IFDE_CSSComputedStyle* pParentStyle) {
258 if (m_pFixedStyleStore == NULL) { 252 if (m_pFixedStyleStore == NULL) {
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 return FDE_CSSTEXTTRANSFORM_LowerCase; 1779 return FDE_CSSTEXTTRANSFORM_LowerCase;
1786 default: 1780 default:
1787 return FDE_CSSTEXTTRANSFORM_None; 1781 return FDE_CSSTEXTTRANSFORM_None;
1788 } 1782 }
1789 } 1783 }
1790 FDE_CSSFONTVARIANT CFDE_CSSStyleSelector::ToFontVariant( 1784 FDE_CSSFONTVARIANT CFDE_CSSStyleSelector::ToFontVariant(
1791 FDE_CSSPROPERTYVALUE eValue) { 1785 FDE_CSSPROPERTYVALUE eValue) {
1792 return eValue == FDE_CSSPROPERTYVALUE_SmallCaps ? FDE_CSSFONTVARIANT_SmallCaps 1786 return eValue == FDE_CSSPROPERTYVALUE_SmallCaps ? FDE_CSSFONTVARIANT_SmallCaps
1793 : FDE_CSSFONTVARIANT_Normal; 1787 : FDE_CSSFONTVARIANT_Normal;
1794 } 1788 }
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssstyleselector.h ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698