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

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

Issue 2467203003: Remove FX_BOOL from xfa. (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 | « xfa/fde/css/fde_cssdeclaration.h ('k') | xfa/fde/css/fde_cssstyleselector.h » ('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_cssdeclaration.h" 7 #include "xfa/fde/css/fde_cssdeclaration.h"
8 8
9 #include "core/fxcrt/fx_ext.h" 9 #include "core/fxcrt/fx_ext.h"
10 10
11 IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty, 11 IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty,
12 FX_BOOL& bImportant) const { 12 bool& bImportant) const {
13 for (const FDE_CSSPropertyHolder* pHolder = m_pFirstProperty; pHolder; 13 for (const FDE_CSSPropertyHolder* pHolder = m_pFirstProperty; pHolder;
14 pHolder = pHolder->pNext) { 14 pHolder = pHolder->pNext) {
15 if (pHolder->eProperty == eProperty) { 15 if (pHolder->eProperty == eProperty) {
16 bImportant = pHolder->bImportant; 16 bImportant = pHolder->bImportant;
17 return pHolder->pValue; 17 return pHolder->pValue;
18 } 18 }
19 } 19 }
20 return nullptr; 20 return nullptr;
21 } 21 }
22 FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const { 22 FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const {
23 return (FX_POSITION)m_pFirstProperty; 23 return (FX_POSITION)m_pFirstProperty;
24 } 24 }
25 void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos, 25 void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos,
26 FDE_CSSPROPERTY& eProperty, 26 FDE_CSSPROPERTY& eProperty,
27 IFDE_CSSValue*& pValue, 27 IFDE_CSSValue*& pValue,
28 FX_BOOL& bImportant) const { 28 bool& bImportant) const {
29 const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos; 29 const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos;
30 bImportant = pHolder->bImportant; 30 bImportant = pHolder->bImportant;
31 eProperty = (FDE_CSSPROPERTY)pHolder->eProperty; 31 eProperty = (FDE_CSSPROPERTY)pHolder->eProperty;
32 pValue = pHolder->pValue; 32 pValue = pHolder->pValue;
33 pos = (FX_POSITION)pHolder->pNext; 33 pos = (FX_POSITION)pHolder->pNext;
34 } 34 }
35 FX_POSITION CFDE_CSSDeclaration::GetStartCustom() const { 35 FX_POSITION CFDE_CSSDeclaration::GetStartCustom() const {
36 return (FX_POSITION)m_pFirstCustom; 36 return (FX_POSITION)m_pFirstCustom;
37 } 37 }
38 void CFDE_CSSDeclaration::GetNextCustom(FX_POSITION& pos, 38 void CFDE_CSSDeclaration::GetNextCustom(FX_POSITION& pos,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eUnit, fValue); 79 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eUnit, fValue);
80 } 80 }
81 inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( 81 inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue(
82 IFX_MemoryAllocator* pStaticStore, 82 IFX_MemoryAllocator* pStaticStore,
83 FDE_CSSPROPERTYVALUE eValue) const { 83 FDE_CSSPROPERTYVALUE eValue) const {
84 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eValue); 84 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eValue);
85 } 85 }
86 void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, 86 void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore,
87 FDE_CSSPROPERTY eProperty, 87 FDE_CSSPROPERTY eProperty,
88 IFDE_CSSValue* pValue, 88 IFDE_CSSValue* pValue,
89 FX_BOOL bImportant) { 89 bool bImportant) {
90 FDE_CSSPropertyHolder* pHolder = 90 FDE_CSSPropertyHolder* pHolder =
91 FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder; 91 FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder;
92 pHolder->bImportant = bImportant; 92 pHolder->bImportant = bImportant;
93 pHolder->eProperty = eProperty; 93 pHolder->eProperty = eProperty;
94 pHolder->pValue = pValue; 94 pHolder->pValue = pValue;
95 pHolder->pNext = nullptr; 95 pHolder->pNext = nullptr;
96 if (m_pLastProperty) 96 if (m_pLastProperty)
97 m_pLastProperty->pNext = pHolder; 97 m_pLastProperty->pNext = pHolder;
98 else 98 else
99 m_pFirstProperty = pHolder; 99 m_pFirstProperty = pHolder;
100 m_pLastProperty = pHolder; 100 m_pLastProperty = pHolder;
101 } 101 }
102 FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, 102 bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
103 const FX_WCHAR* pszValue, 103 const FX_WCHAR* pszValue,
104 int32_t iValueLen) { 104 int32_t iValueLen) {
105 ASSERT(iValueLen > 0); 105 ASSERT(iValueLen > 0);
106 FX_BOOL bImportant = FALSE; 106 bool bImportant = false;
107 if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' && 107 if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' &&
108 FXSYS_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) { 108 FXSYS_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) {
109 if ((iValueLen -= 10) == 0) { 109 if ((iValueLen -= 10) == 0) {
110 return FALSE; 110 return false;
111 } 111 }
112 bImportant = TRUE; 112 bImportant = true;
113 } 113 }
114 const uint32_t dwType = pArgs->pProperty->dwType; 114 const uint32_t dwType = pArgs->pProperty->dwType;
115 switch (dwType & 0x0F) { 115 switch (dwType & 0x0F) {
116 case FDE_CSSVALUETYPE_Primitive: { 116 case FDE_CSSVALUETYPE_Primitive: {
117 static const uint32_t g_ValueGuessOrder[] = { 117 static const uint32_t g_ValueGuessOrder[] = {
118 FDE_CSSVALUETYPE_MaybeNumber, FDE_CSSVALUETYPE_MaybeEnum, 118 FDE_CSSVALUETYPE_MaybeNumber, FDE_CSSVALUETYPE_MaybeEnum,
119 FDE_CSSVALUETYPE_MaybeColor, FDE_CSSVALUETYPE_MaybeURI, 119 FDE_CSSVALUETYPE_MaybeColor, FDE_CSSVALUETYPE_MaybeURI,
120 FDE_CSSVALUETYPE_MaybeFunction, FDE_CSSVALUETYPE_MaybeString, 120 FDE_CSSVALUETYPE_MaybeFunction, FDE_CSSVALUETYPE_MaybeString,
121 }; 121 };
122 static const int32_t g_ValueGuessCount = 122 static const int32_t g_ValueGuessCount =
(...skipping 22 matching lines...) Expand all
145 break; 145 break;
146 case FDE_CSSVALUETYPE_MaybeString: 146 case FDE_CSSVALUETYPE_MaybeString:
147 pCSSValue = ParseString(pArgs, pszValue, iValueLen); 147 pCSSValue = ParseString(pArgs, pszValue, iValueLen);
148 break; 148 break;
149 default: 149 default:
150 break; 150 break;
151 } 151 }
152 if (pCSSValue) { 152 if (pCSSValue) {
153 AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName, 153 AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName,
154 pCSSValue, bImportant); 154 pCSSValue, bImportant);
155 return TRUE; 155 return true;
156 } 156 }
157 if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) { 157 if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) {
158 return FALSE; 158 return false;
159 } 159 }
160 } 160 }
161 } break; 161 } break;
162 case FDE_CSSVALUETYPE_Shorthand: { 162 case FDE_CSSVALUETYPE_Shorthand: {
163 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 163 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
164 IFDE_CSSValue *pColor, *pStyle, *pWidth; 164 IFDE_CSSValue *pColor, *pStyle, *pWidth;
165 switch (pArgs->pProperty->eName) { 165 switch (pArgs->pProperty->eName) {
166 case FDE_CSSPROPERTY_Font: 166 case FDE_CSSPROPERTY_Font:
167 return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant); 167 return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant);
168 case FDE_CSSPROPERTY_Background: 168 case FDE_CSSPROPERTY_Background:
(...skipping 13 matching lines...) Expand all
182 FDE_CSSPROPERTY_BorderTopStyle, 182 FDE_CSSPROPERTY_BorderTopStyle,
183 FDE_CSSPROPERTY_BorderTopWidth); 183 FDE_CSSPROPERTY_BorderTopWidth);
184 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, 184 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant,
185 FDE_CSSPROPERTY_BorderRightColor, 185 FDE_CSSPROPERTY_BorderRightColor,
186 FDE_CSSPROPERTY_BorderRightStyle, 186 FDE_CSSPROPERTY_BorderRightStyle,
187 FDE_CSSPROPERTY_BorderRightWidth); 187 FDE_CSSPROPERTY_BorderRightWidth);
188 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, 188 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant,
189 FDE_CSSPROPERTY_BorderBottomColor, 189 FDE_CSSPROPERTY_BorderBottomColor,
190 FDE_CSSPROPERTY_BorderBottomStyle, 190 FDE_CSSPROPERTY_BorderBottomStyle,
191 FDE_CSSPROPERTY_BorderBottomWidth); 191 FDE_CSSPROPERTY_BorderBottomWidth);
192 return TRUE; 192 return true;
193 } 193 }
194 break; 194 break;
195 case FDE_CSSPROPERTY_BorderLeft: 195 case FDE_CSSPROPERTY_BorderLeft:
196 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, 196 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor,
197 pStyle, pWidth)) { 197 pStyle, pWidth)) {
198 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, 198 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant,
199 FDE_CSSPROPERTY_BorderLeftColor, 199 FDE_CSSPROPERTY_BorderLeftColor,
200 FDE_CSSPROPERTY_BorderLeftStyle, 200 FDE_CSSPROPERTY_BorderLeftStyle,
201 FDE_CSSPROPERTY_BorderLeftWidth); 201 FDE_CSSPROPERTY_BorderLeftWidth);
202 return TRUE; 202 return true;
203 } 203 }
204 break; 204 break;
205 case FDE_CSSPROPERTY_BorderTop: 205 case FDE_CSSPROPERTY_BorderTop:
206 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, 206 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor,
207 pStyle, pWidth)) { 207 pStyle, pWidth)) {
208 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, 208 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant,
209 FDE_CSSPROPERTY_BorderTopColor, 209 FDE_CSSPROPERTY_BorderTopColor,
210 FDE_CSSPROPERTY_BorderTopStyle, 210 FDE_CSSPROPERTY_BorderTopStyle,
211 FDE_CSSPROPERTY_BorderTopWidth); 211 FDE_CSSPROPERTY_BorderTopWidth);
212 return TRUE; 212 return true;
213 } 213 }
214 break; 214 break;
215 case FDE_CSSPROPERTY_BorderRight: 215 case FDE_CSSPROPERTY_BorderRight:
216 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, 216 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor,
217 pStyle, pWidth)) { 217 pStyle, pWidth)) {
218 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, 218 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant,
219 FDE_CSSPROPERTY_BorderRightColor, 219 FDE_CSSPROPERTY_BorderRightColor,
220 FDE_CSSPROPERTY_BorderRightStyle, 220 FDE_CSSPROPERTY_BorderRightStyle,
221 FDE_CSSPROPERTY_BorderRightWidth); 221 FDE_CSSPROPERTY_BorderRightWidth);
222 return TRUE; 222 return true;
223 } 223 }
224 break; 224 break;
225 case FDE_CSSPROPERTY_BorderBottom: 225 case FDE_CSSPROPERTY_BorderBottom:
226 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, 226 if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor,
227 pStyle, pWidth)) { 227 pStyle, pWidth)) {
228 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, 228 AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant,
229 FDE_CSSPROPERTY_BorderBottomColor, 229 FDE_CSSPROPERTY_BorderBottomColor,
230 FDE_CSSPROPERTY_BorderBottomStyle, 230 FDE_CSSPROPERTY_BorderBottomStyle,
231 FDE_CSSPROPERTY_BorderBottomWidth); 231 FDE_CSSPROPERTY_BorderBottomWidth);
232 return TRUE; 232 return true;
233 } 233 }
234 break; 234 break;
235 case FDE_CSSPROPERTY_Overflow: 235 case FDE_CSSPROPERTY_Overflow:
236 return ParseOverflowProperty(pArgs, pszValue, iValueLen, bImportant); 236 return ParseOverflowProperty(pArgs, pszValue, iValueLen, bImportant);
237 case FDE_CSSPROPERTY_ColumnRule: 237 case FDE_CSSPROPERTY_ColumnRule:
238 return ParseColumnRuleProperty(pArgs, pszValue, iValueLen, 238 return ParseColumnRuleProperty(pArgs, pszValue, iValueLen,
239 bImportant); 239 bImportant);
240 default: 240 default:
241 break; 241 break;
242 } 242 }
243 } break; 243 } break;
244 case FDE_CSSVALUETYPE_List: 244 case FDE_CSSVALUETYPE_List:
245 switch (pArgs->pProperty->eName) { 245 switch (pArgs->pProperty->eName) {
246 case FDE_CSSPROPERTY_CounterIncrement: 246 case FDE_CSSPROPERTY_CounterIncrement:
247 case FDE_CSSPROPERTY_CounterReset: 247 case FDE_CSSPROPERTY_CounterReset:
248 return ParseCounterProperty(pArgs, pszValue, iValueLen, bImportant); 248 return ParseCounterProperty(pArgs, pszValue, iValueLen, bImportant);
249 case FDE_CSSPROPERTY_Content: 249 case FDE_CSSPROPERTY_Content:
250 return ParseContentProperty(pArgs, pszValue, iValueLen, bImportant); 250 return ParseContentProperty(pArgs, pszValue, iValueLen, bImportant);
251 default: 251 default:
252 return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); 252 return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant);
253 } 253 }
254 default: 254 default:
255 ASSERT(FALSE); 255 ASSERT(false);
256 break; 256 break;
257 } 257 }
258 return FALSE; 258 return false;
259 } 259 }
260 FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, 260 bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
261 const FX_WCHAR* pszName, 261 const FX_WCHAR* pszName,
262 int32_t iNameLen, 262 int32_t iNameLen,
263 const FX_WCHAR* pszValue, 263 const FX_WCHAR* pszValue,
264 int32_t iValueLen) { 264 int32_t iValueLen) {
265 FDE_CSSCustomProperty* pProperty = 265 FDE_CSSCustomProperty* pProperty =
266 FXTARGET_NewWith(pArgs->pStaticStore) FDE_CSSCustomProperty; 266 FXTARGET_NewWith(pArgs->pStaticStore) FDE_CSSCustomProperty;
267 pProperty->pwsName = CopyToLocal(pArgs, pszName, iNameLen); 267 pProperty->pwsName = CopyToLocal(pArgs, pszName, iNameLen);
268 pProperty->pwsValue = CopyToLocal(pArgs, pszValue, iValueLen); 268 pProperty->pwsValue = CopyToLocal(pArgs, pszValue, iValueLen);
269 pProperty->pNext = nullptr; 269 pProperty->pNext = nullptr;
270 if (m_pLastCustom) 270 if (m_pLastCustom)
271 m_pLastCustom->pNext = pProperty; 271 m_pLastCustom->pNext = pProperty;
272 else 272 else
273 m_pFirstCustom = pProperty; 273 m_pFirstCustom = pProperty;
274 m_pLastCustom = pProperty; 274 m_pLastCustom = pProperty;
275 return TRUE; 275 return true;
276 } 276 }
277 IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber( 277 IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber(
278 const FDE_CSSPROPERTYARGS* pArgs, 278 const FDE_CSSPROPERTYARGS* pArgs,
279 const FX_WCHAR* pszValue, 279 const FX_WCHAR* pszValue,
280 int32_t iValueLen) { 280 int32_t iValueLen) {
281 FX_FLOAT fValue; 281 FX_FLOAT fValue;
282 FDE_CSSPRIMITIVETYPE eUnit; 282 FDE_CSSPRIMITIVETYPE eUnit;
283 if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) { 283 if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) {
284 return nullptr; 284 return nullptr;
285 } 285 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 break; 394 break;
395 } 395 }
396 } 396 }
397 IFDE_CSSValueList* pArgumentList = FXTARGET_NewWith(pArgs->pStaticStore) 397 IFDE_CSSValueList* pArgumentList = FXTARGET_NewWith(pArgs->pStaticStore)
398 CFDE_CSSValueList(pArgs->pStaticStore, argumentArr); 398 CFDE_CSSValueList(pArgs->pStaticStore, argumentArr);
399 CFDE_CSSFunction* pFunction = FXTARGET_NewWith(pArgs->pStaticStore) 399 CFDE_CSSFunction* pFunction = FXTARGET_NewWith(pArgs->pStaticStore)
400 CFDE_CSSFunction(pszFuncName, pArgumentList); 400 CFDE_CSSFunction(pszFuncName, pArgumentList);
401 return FXTARGET_NewWith(pArgs->pStaticStore) 401 return FXTARGET_NewWith(pArgs->pStaticStore)
402 CFDE_CSSPrimitiveValue(pFunction); 402 CFDE_CSSPrimitiveValue(pFunction);
403 } 403 }
404 FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( 404 bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs,
405 const FDE_CSSPROPERTYARGS* pArgs, 405 const FX_WCHAR* pszValue,
406 const FX_WCHAR* pszValue, 406 int32_t iValueLen,
407 int32_t iValueLen, 407 bool bImportant) {
408 FX_BOOL bImportant) {
409 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 408 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
410 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 409 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
411 FDE_CSSPRIMITIVETYPE eType; 410 FDE_CSSPRIMITIVETYPE eType;
412 CFDE_CSSValueArray list; 411 CFDE_CSSValueArray list;
413 while (parser.NextValue(eType, pszValue, iValueLen)) { 412 while (parser.NextValue(eType, pszValue, iValueLen)) {
414 switch (eType) { 413 switch (eType) {
415 case FDE_CSSPRIMITIVETYPE_URI: 414 case FDE_CSSPRIMITIVETYPE_URI:
416 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( 415 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
417 eType, CopyToLocal(pArgs, pszValue, iValueLen))); 416 eType, CopyToLocal(pArgs, pszValue, iValueLen)));
418 break; 417 break;
419 case FDE_CSSPRIMITIVETYPE_Number: 418 case FDE_CSSPRIMITIVETYPE_Number:
420 return FALSE; 419 return false;
421 case FDE_CSSPRIMITIVETYPE_String: { 420 case FDE_CSSPRIMITIVETYPE_String: {
422 const FDE_CSSPROPERTYVALUETABLE* pValue = 421 const FDE_CSSPROPERTYVALUETABLE* pValue =
423 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); 422 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
424 if (pValue) { 423 if (pValue) {
425 switch (pValue->eName) { 424 switch (pValue->eName) {
426 case FDE_CSSPROPERTYVALUE_Normal: 425 case FDE_CSSPROPERTYVALUE_Normal:
427 case FDE_CSSPROPERTYVALUE_None: { 426 case FDE_CSSPROPERTYVALUE_None: {
428 if (list.GetSize() == 0) { 427 if (list.GetSize() == 0) {
429 list.Add(NewEnumValue(pStaticStore, pValue->eName)); 428 list.Add(NewEnumValue(pStaticStore, pValue->eName));
430 } else { 429 } else {
431 return FALSE; 430 return false;
432 } 431 }
433 } break; 432 } break;
434 case FDE_CSSPROPERTYVALUE_OpenQuote: 433 case FDE_CSSPROPERTYVALUE_OpenQuote:
435 case FDE_CSSPROPERTYVALUE_CloseQuote: 434 case FDE_CSSPROPERTYVALUE_CloseQuote:
436 case FDE_CSSPROPERTYVALUE_NoOpenQuote: 435 case FDE_CSSPROPERTYVALUE_NoOpenQuote:
437 case FDE_CSSPROPERTYVALUE_NoCloseQuote: 436 case FDE_CSSPROPERTYVALUE_NoCloseQuote:
438 list.Add(NewEnumValue(pStaticStore, pValue->eName)); 437 list.Add(NewEnumValue(pStaticStore, pValue->eName));
439 break; 438 break;
440 default: 439 default:
441 return FALSE; 440 return false;
442 } 441 }
443 continue; 442 continue;
444 } 443 }
445 IFDE_CSSValue* pFunction = ParseFunction(pArgs, pszValue, iValueLen); 444 IFDE_CSSValue* pFunction = ParseFunction(pArgs, pszValue, iValueLen);
446 if (pFunction) { 445 if (pFunction) {
447 list.Add(pFunction); 446 list.Add(pFunction);
448 continue; 447 continue;
449 } 448 }
450 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( 449 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
451 eType, CopyToLocal(pArgs, pszValue, iValueLen))); 450 eType, CopyToLocal(pArgs, pszValue, iValueLen)));
452 } break; 451 } break;
453 case FDE_CSSPRIMITIVETYPE_RGB: 452 case FDE_CSSPRIMITIVETYPE_RGB:
454 return FALSE; 453 return false;
455 default: 454 default:
456 break; 455 break;
457 } 456 }
458 } 457 }
459 if (list.GetSize() == 0) { 458 if (list.GetSize() == 0) {
460 return FALSE; 459 return false;
461 } 460 }
462 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, 461 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName,
463 FXTARGET_NewWith(pStaticStore) 462 FXTARGET_NewWith(pStaticStore)
464 CFDE_CSSValueList(pStaticStore, list), 463 CFDE_CSSValueList(pStaticStore, list),
465 bImportant); 464 bImportant);
466 return TRUE; 465 return true;
467 } 466 }
468 FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( 467 bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs,
469 const FDE_CSSPROPERTYARGS* pArgs, 468 const FX_WCHAR* pszValue,
470 const FX_WCHAR* pszValue, 469 int32_t iValueLen,
471 int32_t iValueLen, 470 bool bImportant) {
472 FX_BOOL bImportant) {
473 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 471 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
474 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 472 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
475 CFDE_CSSValueArray list; 473 CFDE_CSSValueArray list;
476 CFDE_CSSValueArray listFull; 474 CFDE_CSSValueArray listFull;
477 FDE_CSSPRIMITIVETYPE eType; 475 FDE_CSSPRIMITIVETYPE eType;
478 while (parser.NextValue(eType, pszValue, iValueLen)) { 476 while (parser.NextValue(eType, pszValue, iValueLen)) {
479 switch (eType) { 477 switch (eType) {
480 case FDE_CSSPRIMITIVETYPE_Number: { 478 case FDE_CSSPRIMITIVETYPE_Number: {
481 FX_FLOAT fValue; 479 FX_FLOAT fValue;
482 if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { 480 if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) {
483 if (list.GetSize() == 1) { 481 if (list.GetSize() == 1) {
484 list.Add(NewNumberValue(pStaticStore, eType, fValue)); 482 list.Add(NewNumberValue(pStaticStore, eType, fValue));
485 listFull.Add(FXTARGET_NewWith(pStaticStore) 483 listFull.Add(FXTARGET_NewWith(pStaticStore)
486 CFDE_CSSValueList(pStaticStore, list)); 484 CFDE_CSSValueList(pStaticStore, list));
487 list.RemoveAll(); 485 list.RemoveAll();
488 } else { 486 } else {
489 return FALSE; 487 return false;
490 } 488 }
491 } 489 }
492 } break; 490 } break;
493 case FDE_CSSPRIMITIVETYPE_String: { 491 case FDE_CSSPRIMITIVETYPE_String: {
494 if (list.GetSize() == 0) { 492 if (list.GetSize() == 0) {
495 pszValue = CopyToLocal(pArgs, pszValue, iValueLen); 493 pszValue = CopyToLocal(pArgs, pszValue, iValueLen);
496 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( 494 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
497 FDE_CSSPRIMITIVETYPE_String, pszValue)); 495 FDE_CSSPRIMITIVETYPE_String, pszValue));
498 } else { 496 } else {
499 listFull.Add(FXTARGET_NewWith(pStaticStore) 497 listFull.Add(FXTARGET_NewWith(pStaticStore)
500 CFDE_CSSValueList(pStaticStore, list)); 498 CFDE_CSSValueList(pStaticStore, list));
501 list.RemoveAll(); 499 list.RemoveAll();
502 pszValue = CopyToLocal(pArgs, pszValue, iValueLen); 500 pszValue = CopyToLocal(pArgs, pszValue, iValueLen);
503 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( 501 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(
504 FDE_CSSPRIMITIVETYPE_String, pszValue)); 502 FDE_CSSPRIMITIVETYPE_String, pszValue));
505 } 503 }
506 } break; 504 } break;
507 default: 505 default:
508 break; 506 break;
509 } 507 }
510 } 508 }
511 if (list.GetSize() == 1) { 509 if (list.GetSize() == 1) {
512 listFull.Add(FXTARGET_NewWith(pStaticStore) 510 listFull.Add(FXTARGET_NewWith(pStaticStore)
513 CFDE_CSSValueList(pStaticStore, list)); 511 CFDE_CSSValueList(pStaticStore, list));
514 } 512 }
515 if (listFull.GetSize() == 0) { 513 if (listFull.GetSize() == 0) {
516 return FALSE; 514 return false;
517 } 515 }
518 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, 516 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName,
519 FXTARGET_NewWith(pStaticStore) 517 FXTARGET_NewWith(pStaticStore)
520 CFDE_CSSValueList(pStaticStore, listFull), 518 CFDE_CSSValueList(pStaticStore, listFull),
521 bImportant); 519 bImportant);
522 return TRUE; 520 return true;
523 } 521 }
524 FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( 522 bool CFDE_CSSDeclaration::ParseValueListProperty(
525 const FDE_CSSPROPERTYARGS* pArgs, 523 const FDE_CSSPROPERTYARGS* pArgs,
526 const FX_WCHAR* pszValue, 524 const FX_WCHAR* pszValue,
527 int32_t iValueLen, 525 int32_t iValueLen,
528 FX_BOOL bImportant) { 526 bool bImportant) {
529 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 527 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
530 FX_WCHAR separator = 528 FX_WCHAR separator =
531 (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; 529 (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' ';
532 CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); 530 CFDE_CSSValueListParser parser(pszValue, iValueLen, separator);
533 const uint32_t dwType = pArgs->pProperty->dwType; 531 const uint32_t dwType = pArgs->pProperty->dwType;
534 FDE_CSSPRIMITIVETYPE eType; 532 FDE_CSSPRIMITIVETYPE eType;
535 CFDE_CSSValueArray list; 533 CFDE_CSSValueArray list;
536 while (parser.NextValue(eType, pszValue, iValueLen)) { 534 while (parser.NextValue(eType, pszValue, iValueLen)) {
537 switch (eType) { 535 switch (eType) {
538 case FDE_CSSPRIMITIVETYPE_Number: 536 case FDE_CSSPRIMITIVETYPE_Number:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 list.Add(FXTARGET_NewWith(pStaticStore) 572 list.Add(FXTARGET_NewWith(pStaticStore)
575 CFDE_CSSPrimitiveValue(dwColor)); 573 CFDE_CSSPrimitiveValue(dwColor));
576 } 574 }
577 } 575 }
578 break; 576 break;
579 default: 577 default:
580 break; 578 break;
581 } 579 }
582 } 580 }
583 if (list.GetSize() == 0) { 581 if (list.GetSize() == 0) {
584 return FALSE; 582 return false;
585 } 583 }
586 switch (pArgs->pProperty->eName) { 584 switch (pArgs->pProperty->eName) {
587 case FDE_CSSPROPERTY_BorderColor: 585 case FDE_CSSPROPERTY_BorderColor:
588 return Add4ValuesProperty( 586 return Add4ValuesProperty(
589 pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftColor, 587 pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftColor,
590 FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderRightColor, 588 FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderRightColor,
591 FDE_CSSPROPERTY_BorderBottomColor); 589 FDE_CSSPROPERTY_BorderBottomColor);
592 case FDE_CSSPROPERTY_BorderStyle: 590 case FDE_CSSPROPERTY_BorderStyle:
593 return Add4ValuesProperty( 591 return Add4ValuesProperty(
594 pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftStyle, 592 pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftStyle,
(...skipping 12 matching lines...) Expand all
607 case FDE_CSSPROPERTY_Padding: 605 case FDE_CSSPROPERTY_Padding:
608 return Add4ValuesProperty( 606 return Add4ValuesProperty(
609 pStaticStore, list, bImportant, FDE_CSSPROPERTY_PaddingLeft, 607 pStaticStore, list, bImportant, FDE_CSSPROPERTY_PaddingLeft,
610 FDE_CSSPROPERTY_PaddingTop, FDE_CSSPROPERTY_PaddingRight, 608 FDE_CSSPROPERTY_PaddingTop, FDE_CSSPROPERTY_PaddingRight,
611 FDE_CSSPROPERTY_PaddingBottom); 609 FDE_CSSPROPERTY_PaddingBottom);
612 default: { 610 default: {
613 CFDE_CSSValueList* pList = 611 CFDE_CSSValueList* pList =
614 FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list); 612 FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list);
615 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList, 613 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList,
616 bImportant); 614 bImportant);
617 return TRUE; 615 return true;
618 } break; 616 } break;
619 } 617 }
620 return FALSE; 618 return false;
621 } 619 }
622 FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty( 620 bool CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore,
623 IFX_MemoryAllocator* pStaticStore, 621 const CFDE_CSSValueArray& list,
624 const CFDE_CSSValueArray& list, 622 bool bImportant,
625 FX_BOOL bImportant, 623 FDE_CSSPROPERTY eLeft,
626 FDE_CSSPROPERTY eLeft, 624 FDE_CSSPROPERTY eTop,
627 FDE_CSSPROPERTY eTop, 625 FDE_CSSPROPERTY eRight,
628 FDE_CSSPROPERTY eRight, 626 FDE_CSSPROPERTY eBottom) {
629 FDE_CSSPROPERTY eBottom) {
630 switch (list.GetSize()) { 627 switch (list.GetSize()) {
631 case 1: 628 case 1:
632 AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant); 629 AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant);
633 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); 630 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant);
634 AddPropertyHolder(pStaticStore, eRight, list[0], bImportant); 631 AddPropertyHolder(pStaticStore, eRight, list[0], bImportant);
635 AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); 632 AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant);
636 return TRUE; 633 return true;
637 case 2: 634 case 2:
638 AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); 635 AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant);
639 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); 636 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant);
640 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); 637 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant);
641 AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); 638 AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant);
642 return TRUE; 639 return true;
643 case 3: 640 case 3:
644 AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); 641 AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant);
645 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); 642 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant);
646 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); 643 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant);
647 AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); 644 AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant);
648 return TRUE; 645 return true;
649 case 4: 646 case 4:
650 AddPropertyHolder(pStaticStore, eLeft, list[3], bImportant); 647 AddPropertyHolder(pStaticStore, eLeft, list[3], bImportant);
651 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); 648 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant);
652 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); 649 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant);
653 AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); 650 AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant);
654 return TRUE; 651 return true;
655 default: 652 default:
656 break; 653 break;
657 } 654 }
658 return FALSE; 655 return false;
659 } 656 }
660 FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( 657 bool CFDE_CSSDeclaration::ParseBorderPropoerty(
661 IFX_MemoryAllocator* pStaticStore, 658 IFX_MemoryAllocator* pStaticStore,
662 const FX_WCHAR* pszValue, 659 const FX_WCHAR* pszValue,
663 int32_t iValueLen, 660 int32_t iValueLen,
664 IFDE_CSSValue*& pColor, 661 IFDE_CSSValue*& pColor,
665 IFDE_CSSValue*& pStyle, 662 IFDE_CSSValue*& pStyle,
666 IFDE_CSSValue*& pWidth) const { 663 IFDE_CSSValue*& pWidth) const {
667 pColor = pStyle = pWidth = nullptr; 664 pColor = pStyle = pWidth = nullptr;
668 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 665 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
669 FDE_CSSPRIMITIVETYPE eType; 666 FDE_CSSPRIMITIVETYPE eType;
670 while (parser.NextValue(eType, pszValue, iValueLen)) { 667 while (parser.NextValue(eType, pszValue, iValueLen)) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 default: 731 default:
735 break; 732 break;
736 } 733 }
737 } 734 }
738 if (!pColor) 735 if (!pColor)
739 pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); 736 pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0);
740 if (!pStyle) 737 if (!pStyle)
741 pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); 738 pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
742 if (!pWidth) 739 if (!pWidth)
743 pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); 740 pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f);
744 return TRUE; 741 return true;
745 } 742 }
746 void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, 743 void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore,
747 IFDE_CSSValue* pColor, 744 IFDE_CSSValue* pColor,
748 IFDE_CSSValue* pStyle, 745 IFDE_CSSValue* pStyle,
749 IFDE_CSSValue* pWidth, 746 IFDE_CSSValue* pWidth,
750 FX_BOOL bImportant, 747 bool bImportant,
751 FDE_CSSPROPERTY eColor, 748 FDE_CSSPROPERTY eColor,
752 FDE_CSSPROPERTY eStyle, 749 FDE_CSSPROPERTY eStyle,
753 FDE_CSSPROPERTY eWidth) { 750 FDE_CSSPROPERTY eWidth) {
754 AddPropertyHolder(pStaticStore, eStyle, pStyle, bImportant); 751 AddPropertyHolder(pStaticStore, eStyle, pStyle, bImportant);
755 AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant); 752 AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant);
756 AddPropertyHolder(pStaticStore, eColor, pColor, bImportant); 753 AddPropertyHolder(pStaticStore, eColor, pColor, bImportant);
757 } 754 }
758 FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( 755 bool CFDE_CSSDeclaration::ParseListStyleProperty(
759 const FDE_CSSPROPERTYARGS* pArgs, 756 const FDE_CSSPROPERTYARGS* pArgs,
760 const FX_WCHAR* pszValue, 757 const FX_WCHAR* pszValue,
761 int32_t iValueLen, 758 int32_t iValueLen,
762 FX_BOOL bImportant) { 759 bool bImportant) {
763 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 760 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
764 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 761 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
765 IFDE_CSSPrimitiveValue* pType = nullptr; 762 IFDE_CSSPrimitiveValue* pType = nullptr;
766 IFDE_CSSPrimitiveValue* pImage = nullptr; 763 IFDE_CSSPrimitiveValue* pImage = nullptr;
767 IFDE_CSSPrimitiveValue* pPosition = nullptr; 764 IFDE_CSSPrimitiveValue* pPosition = nullptr;
768 FDE_CSSPRIMITIVETYPE eType; 765 FDE_CSSPRIMITIVETYPE eType;
769 while (parser.NextValue(eType, pszValue, iValueLen)) { 766 while (parser.NextValue(eType, pszValue, iValueLen)) {
770 switch (eType) { 767 switch (eType) {
771 case FDE_CSSPRIMITIVETYPE_URI: 768 case FDE_CSSPRIMITIVETYPE_URI:
772 if (!pImage) { 769 if (!pImage) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 if (!pImage) 819 if (!pImage)
823 pImage = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); 820 pImage = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
824 if (!pType) 821 if (!pType)
825 pType = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); 822 pType = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
826 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStylePosition, pPosition, 823 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStylePosition, pPosition,
827 bImportant); 824 bImportant);
828 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleImage, pImage, 825 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleImage, pImage,
829 bImportant); 826 bImportant);
830 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType, 827 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType,
831 bImportant); 828 bImportant);
832 return TRUE; 829 return true;
833 } 830 }
834 FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( 831 bool CFDE_CSSDeclaration::ParseBackgroundProperty(
835 const FDE_CSSPROPERTYARGS* pArgs, 832 const FDE_CSSPROPERTYARGS* pArgs,
836 const FX_WCHAR* pszValue, 833 const FX_WCHAR* pszValue,
837 int32_t iValueLen, 834 int32_t iValueLen,
838 FX_BOOL bImportant) { 835 bool bImportant) {
839 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 836 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
840 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 837 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
841 IFDE_CSSPrimitiveValue* pColor = nullptr; 838 IFDE_CSSPrimitiveValue* pColor = nullptr;
842 IFDE_CSSPrimitiveValue* pImage = nullptr; 839 IFDE_CSSPrimitiveValue* pImage = nullptr;
843 IFDE_CSSPrimitiveValue* pRepeat = nullptr; 840 IFDE_CSSPrimitiveValue* pRepeat = nullptr;
844 IFDE_CSSPrimitiveValue* pPosX = nullptr; 841 IFDE_CSSPrimitiveValue* pPosX = nullptr;
845 IFDE_CSSPrimitiveValue* pPosY = nullptr; 842 IFDE_CSSPrimitiveValue* pPosY = nullptr;
846 IFDE_CSSPrimitiveValue* pAttachment = nullptr; 843 IFDE_CSSPrimitiveValue* pAttachment = nullptr;
847 FDE_CSSPRIMITIVETYPE eType; 844 FDE_CSSPRIMITIVETYPE eType;
848 while (parser.NextValue(eType, pszValue, iValueLen)) { 845 while (parser.NextValue(eType, pszValue, iValueLen)) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundColor, pColor, 956 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundColor, pColor,
960 bImportant); 957 bImportant);
961 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundImage, pImage, 958 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundImage, pImage,
962 bImportant); 959 bImportant);
963 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundRepeat, pRepeat, 960 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundRepeat, pRepeat,
964 bImportant); 961 bImportant);
965 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundPosition, pPosList, 962 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundPosition, pPosList,
966 bImportant); 963 bImportant);
967 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment, 964 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment,
968 pAttachment, bImportant); 965 pAttachment, bImportant);
969 return TRUE; 966 return true;
970 } 967 }
971 FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, 968 bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs,
972 const FX_WCHAR* pszValue, 969 const FX_WCHAR* pszValue,
973 int32_t iValueLen, 970 int32_t iValueLen,
974 FX_BOOL bImportant) { 971 bool bImportant) {
975 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 972 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
976 CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); 973 CFDE_CSSValueListParser parser(pszValue, iValueLen, '/');
977 IFDE_CSSPrimitiveValue* pStyle = nullptr; 974 IFDE_CSSPrimitiveValue* pStyle = nullptr;
978 IFDE_CSSPrimitiveValue* pVariant = nullptr; 975 IFDE_CSSPrimitiveValue* pVariant = nullptr;
979 IFDE_CSSPrimitiveValue* pWeight = nullptr; 976 IFDE_CSSPrimitiveValue* pWeight = nullptr;
980 IFDE_CSSPrimitiveValue* pFontSize = nullptr; 977 IFDE_CSSPrimitiveValue* pFontSize = nullptr;
981 IFDE_CSSPrimitiveValue* pLineHeight = nullptr; 978 IFDE_CSSPrimitiveValue* pLineHeight = nullptr;
982 CFDE_CSSValueArray familyList; 979 CFDE_CSSValueArray familyList;
983 FDE_CSSPRIMITIVETYPE eType; 980 FDE_CSSPRIMITIVETYPE eType;
984 while (parser.NextValue(eType, pszValue, iValueLen)) { 981 while (parser.NextValue(eType, pszValue, iValueLen)) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontSize, pFontSize, 1086 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontSize, pFontSize,
1090 bImportant); 1087 bImportant);
1091 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_LineHeight, pLineHeight, 1088 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_LineHeight, pLineHeight,
1092 bImportant); 1089 bImportant);
1093 if (familyList.GetSize() > 0) { 1090 if (familyList.GetSize() > 0) {
1094 CFDE_CSSValueList* pList = FXTARGET_NewWith(pStaticStore) 1091 CFDE_CSSValueList* pList = FXTARGET_NewWith(pStaticStore)
1095 CFDE_CSSValueList(pStaticStore, familyList); 1092 CFDE_CSSValueList(pStaticStore, familyList);
1096 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList, 1093 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList,
1097 bImportant); 1094 bImportant);
1098 } 1095 }
1099 return TRUE; 1096 return true;
1100 } 1097 }
1101 FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( 1098 bool CFDE_CSSDeclaration::ParseColumnRuleProperty(
1102 const FDE_CSSPROPERTYARGS* pArgs, 1099 const FDE_CSSPROPERTYARGS* pArgs,
1103 const FX_WCHAR* pszValue, 1100 const FX_WCHAR* pszValue,
1104 int32_t iValueLen, 1101 int32_t iValueLen,
1105 FX_BOOL bImportant) { 1102 bool bImportant) {
1106 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 1103 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
1107 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 1104 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
1108 IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; 1105 IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr;
1109 IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr; 1106 IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr;
1110 IFDE_CSSPrimitiveValue* pColumnRuleColor = nullptr; 1107 IFDE_CSSPrimitiveValue* pColumnRuleColor = nullptr;
1111 FDE_CSSPRIMITIVETYPE eType; 1108 FDE_CSSPRIMITIVETYPE eType;
1112 while (parser.NextValue(eType, pszValue, iValueLen)) { 1109 while (parser.NextValue(eType, pszValue, iValueLen)) {
1113 switch (eType) { 1110 switch (eType) {
1114 case FDE_CSSPRIMITIVETYPE_String: { 1111 case FDE_CSSPRIMITIVETYPE_String: {
1115 const FDE_CSSPROPERTYVALUETABLE* pValue = 1112 const FDE_CSSPROPERTYVALUETABLE* pValue =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { 1162 FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) {
1166 pColumnRuleColor = FXTARGET_NewWith(pStaticStore) 1163 pColumnRuleColor = FXTARGET_NewWith(pStaticStore)
1167 CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); 1164 CFDE_CSSPrimitiveValue((FX_ARGB)dwColor);
1168 } 1165 }
1169 } break; 1166 } break;
1170 default: 1167 default:
1171 break; 1168 break;
1172 } 1169 }
1173 } 1170 }
1174 if (!pColumnRuleColor && !pColumnRuleStyle && !pColumnRuleWidth) 1171 if (!pColumnRuleColor && !pColumnRuleStyle && !pColumnRuleWidth)
1175 return FALSE; 1172 return false;
1176 1173
1177 if (!pColumnRuleStyle) 1174 if (!pColumnRuleStyle)
1178 pColumnRuleStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); 1175 pColumnRuleStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None);
1179 if (!pColumnRuleWidth) 1176 if (!pColumnRuleWidth)
1180 pColumnRuleWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Medium); 1177 pColumnRuleWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Medium);
1181 if (!pColumnRuleColor) { 1178 if (!pColumnRuleColor) {
1182 pColumnRuleColor = 1179 pColumnRuleColor =
1183 FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); 1180 FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0);
1184 } 1181 }
1185 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleStyle, 1182 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleStyle,
1186 pColumnRuleStyle, bImportant); 1183 pColumnRuleStyle, bImportant);
1187 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleWidth, 1184 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleWidth,
1188 pColumnRuleWidth, bImportant); 1185 pColumnRuleWidth, bImportant);
1189 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor, 1186 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor,
1190 pColumnRuleColor, bImportant); 1187 pColumnRuleColor, bImportant);
1191 return TRUE; 1188 return true;
1192 } 1189 }
1193 FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( 1190 bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs,
1194 FDE_CSSPROPERTYARGS* pArgs, 1191 const FX_WCHAR* pszValue,
1195 const FX_WCHAR* pszValue, 1192 int32_t iValueLen,
1196 int32_t iValueLen, 1193 bool bImportant) {
1197 FX_BOOL bImportant) {
1198 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 1194 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
1199 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 1195 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
1200 CFDE_CSSValueArray arrEmphasisStyle; 1196 CFDE_CSSValueArray arrEmphasisStyle;
1201 FDE_CSSPRIMITIVETYPE eType; 1197 FDE_CSSPRIMITIVETYPE eType;
1202 IFDE_CSSPrimitiveValue* pEmphasisColor = nullptr; 1198 IFDE_CSSPrimitiveValue* pEmphasisColor = nullptr;
1203 while (parser.NextValue(eType, pszValue, iValueLen)) { 1199 while (parser.NextValue(eType, pszValue, iValueLen)) {
1204 switch (eType) { 1200 switch (eType) {
1205 case FDE_CSSPRIMITIVETYPE_String: { 1201 case FDE_CSSPRIMITIVETYPE_String: {
1206 const FDE_CSSPROPERTYVALUETABLE* pValue = 1202 const FDE_CSSPROPERTYVALUETABLE* pValue =
1207 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); 1203 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
(...skipping 26 matching lines...) Expand all
1234 if (arrEmphasisStyle.GetSize() != 0) { 1230 if (arrEmphasisStyle.GetSize() != 0) {
1235 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisStyle, 1231 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisStyle,
1236 FXTARGET_NewWith(pStaticStore) 1232 FXTARGET_NewWith(pStaticStore)
1237 CFDE_CSSValueList(pStaticStore, arrEmphasisStyle), 1233 CFDE_CSSValueList(pStaticStore, arrEmphasisStyle),
1238 bImportant); 1234 bImportant);
1239 } 1235 }
1240 if (pEmphasisColor) { 1236 if (pEmphasisColor) {
1241 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor, 1237 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor,
1242 pEmphasisColor, bImportant); 1238 pEmphasisColor, bImportant);
1243 } 1239 }
1244 return TRUE; 1240 return true;
1245 } 1241 }
1246 FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( 1242 bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs,
1247 const FDE_CSSPROPERTYARGS* pArgs, 1243 const FX_WCHAR* pszValue,
1248 const FX_WCHAR* pszValue, 1244 int32_t iValueLen,
1249 int32_t iValueLen, 1245 bool bImportant) {
1250 FX_BOOL bImportant) {
1251 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 1246 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
1252 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 1247 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
1253 IFDE_CSSPrimitiveValue* pColumnWidth = nullptr; 1248 IFDE_CSSPrimitiveValue* pColumnWidth = nullptr;
1254 IFDE_CSSPrimitiveValue* pColumnCount = nullptr; 1249 IFDE_CSSPrimitiveValue* pColumnCount = nullptr;
1255 FDE_CSSPRIMITIVETYPE eType; 1250 FDE_CSSPRIMITIVETYPE eType;
1256 while (parser.NextValue(eType, pszValue, iValueLen)) { 1251 while (parser.NextValue(eType, pszValue, iValueLen)) {
1257 switch (eType) { 1252 switch (eType) {
1258 case FDE_CSSPRIMITIVETYPE_String: { 1253 case FDE_CSSPRIMITIVETYPE_String: {
1259 const FDE_CSSPROPERTYVALUETABLE* pValue = 1254 const FDE_CSSPROPERTYVALUETABLE* pValue =
1260 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); 1255 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
(...skipping 14 matching lines...) Expand all
1275 pColumnWidth = NewNumberValue(pStaticStore, eType, fValue); 1270 pColumnWidth = NewNumberValue(pStaticStore, eType, fValue);
1276 break; 1271 break;
1277 } 1272 }
1278 } 1273 }
1279 } break; 1274 } break;
1280 default: 1275 default:
1281 break; 1276 break;
1282 } 1277 }
1283 } 1278 }
1284 if (!pColumnWidth && !pColumnCount) 1279 if (!pColumnWidth && !pColumnCount)
1285 return FALSE; 1280 return false;
1286 1281
1287 if (!pColumnWidth) 1282 if (!pColumnWidth)
1288 pColumnWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto); 1283 pColumnWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto);
1289 else if (!pColumnCount) 1284 else if (!pColumnCount)
1290 pColumnCount = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto); 1285 pColumnCount = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto);
1291 1286
1292 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnWidth, pColumnWidth, 1287 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnWidth, pColumnWidth,
1293 bImportant); 1288 bImportant);
1294 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount, 1289 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount,
1295 bImportant); 1290 bImportant);
1296 return TRUE; 1291 return true;
1297 } 1292 }
1298 FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( 1293 bool CFDE_CSSDeclaration::ParseOverflowProperty(
1299 const FDE_CSSPROPERTYARGS* pArgs, 1294 const FDE_CSSPROPERTYARGS* pArgs,
1300 const FX_WCHAR* pszValue, 1295 const FX_WCHAR* pszValue,
1301 int32_t iValueLen, 1296 int32_t iValueLen,
1302 FX_BOOL bImportant) { 1297 bool bImportant) {
1303 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; 1298 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
1304 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); 1299 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
1305 IFDE_CSSPrimitiveValue* pOverflowX = nullptr; 1300 IFDE_CSSPrimitiveValue* pOverflowX = nullptr;
1306 IFDE_CSSPrimitiveValue* pOverflowY = nullptr; 1301 IFDE_CSSPrimitiveValue* pOverflowY = nullptr;
1307 FDE_CSSPRIMITIVETYPE eType; 1302 FDE_CSSPRIMITIVETYPE eType;
1308 while (parser.NextValue(eType, pszValue, iValueLen)) { 1303 while (parser.NextValue(eType, pszValue, iValueLen)) {
1309 if (eType == FDE_CSSPRIMITIVETYPE_String) { 1304 if (eType == FDE_CSSPRIMITIVETYPE_String) {
1310 const FDE_CSSPROPERTYVALUETABLE* pValue = 1305 const FDE_CSSPROPERTYVALUETABLE* pValue =
1311 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); 1306 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
1312 if (pValue) { 1307 if (pValue) {
1313 switch (pValue->eName) { 1308 switch (pValue->eName) {
1314 case FDE_CSSOVERFLOW_Visible: 1309 case FDE_CSSOVERFLOW_Visible:
1315 case FDE_CSSOVERFLOW_Hidden: 1310 case FDE_CSSOVERFLOW_Hidden:
1316 case FDE_CSSOVERFLOW_Scroll: 1311 case FDE_CSSOVERFLOW_Scroll:
1317 case FDE_CSSOVERFLOW_Auto: 1312 case FDE_CSSOVERFLOW_Auto:
1318 case FDE_CSSOVERFLOW_NoDisplay: 1313 case FDE_CSSOVERFLOW_NoDisplay:
1319 case FDE_CSSOVERFLOW_NoContent: 1314 case FDE_CSSOVERFLOW_NoContent:
1320 if (pOverflowX && pOverflowY) 1315 if (pOverflowX && pOverflowY)
1321 return FALSE; 1316 return false;
1322 if (!pOverflowX) { 1317 if (!pOverflowX) {
1323 pOverflowX = NewEnumValue(pStaticStore, pValue->eName); 1318 pOverflowX = NewEnumValue(pStaticStore, pValue->eName);
1324 } else if (!pOverflowY) { 1319 } else if (!pOverflowY) {
1325 pOverflowY = NewEnumValue(pStaticStore, pValue->eName); 1320 pOverflowY = NewEnumValue(pStaticStore, pValue->eName);
1326 } 1321 }
1327 break; 1322 break;
1328 default: 1323 default:
1329 break; 1324 break;
1330 } 1325 }
1331 } 1326 }
1332 } 1327 }
1333 } 1328 }
1334 if (!pOverflowX && !pOverflowY) 1329 if (!pOverflowX && !pOverflowY)
1335 return FALSE; 1330 return false;
1336 1331
1337 if (!pOverflowY) 1332 if (!pOverflowY)
1338 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); 1333 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum());
1339 1334
1340 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, 1335 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX,
1341 bImportant); 1336 bImportant);
1342 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, 1337 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY,
1343 bImportant); 1338 bImportant);
1344 return TRUE; 1339 return true;
1345 } 1340 }
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssdeclaration.h ('k') | xfa/fde/css/fde_cssstyleselector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698