OLD | NEW |
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/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fgas/crt/fgas_system.h" | 10 #include "xfa/fgas/crt/fgas_system.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( | 51 const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( |
52 const FDE_CSSPROPERTYARGS* pArgs, | 52 const FDE_CSSPROPERTYARGS* pArgs, |
53 const FX_WCHAR* pszValue, | 53 const FX_WCHAR* pszValue, |
54 int32_t iValueLen) { | 54 int32_t iValueLen) { |
55 FXSYS_assert(iValueLen > 0); | 55 FXSYS_assert(iValueLen > 0); |
56 CFX_MapPtrToPtr* pCache = pArgs->pStringCache; | 56 CFX_MapPtrToPtr* pCache = pArgs->pStringCache; |
57 void* pKey = NULL; | 57 void* pKey = NULL; |
58 if (pCache) { | 58 if (pCache) { |
59 void* pszCached = NULL; | 59 void* pszCached = NULL; |
60 pKey = | 60 pKey = (void*)(uintptr_t)FX_HashCode_GetW( |
61 (void*)(uintptr_t)FX_HashCode_String_GetW(pszValue, iValueLen, FALSE); | 61 CFX_WideStringC(pszValue, iValueLen), false); |
62 if (pCache->Lookup(pKey, pszCached)) { | 62 if (pCache->Lookup(pKey, pszCached)) { |
63 return (const FX_WCHAR*)pszCached; | 63 return (const FX_WCHAR*)pszCached; |
64 } | 64 } |
65 } | 65 } |
66 FX_WCHAR* psz = | 66 FX_WCHAR* psz = |
67 (FX_WCHAR*)pArgs->pStaticStore->Alloc((iValueLen + 1) * sizeof(FX_WCHAR)); | 67 (FX_WCHAR*)pArgs->pStaticStore->Alloc((iValueLen + 1) * sizeof(FX_WCHAR)); |
68 if (psz == NULL) { | 68 if (psz == NULL) { |
69 return NULL; | 69 return NULL; |
70 } | 70 } |
71 FXSYS_wcsncpy(psz, pszValue, iValueLen); | 71 FXSYS_wcsncpy(psz, pszValue, iValueLen); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 FDE_CSSPRIMITIVETYPE eUnit; | 291 FDE_CSSPRIMITIVETYPE eUnit; |
292 if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) { | 292 if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) { |
293 return NULL; | 293 return NULL; |
294 } | 294 } |
295 return NewNumberValue(pArgs->pStaticStore, eUnit, fValue); | 295 return NewNumberValue(pArgs->pStaticStore, eUnit, fValue); |
296 } | 296 } |
297 IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, | 297 IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, |
298 const FX_WCHAR* pszValue, | 298 const FX_WCHAR* pszValue, |
299 int32_t iValueLen) { | 299 int32_t iValueLen) { |
300 const FDE_CSSPROPERTYVALUETABLE* pValue = | 300 const FDE_CSSPROPERTYVALUETABLE* pValue = |
301 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 301 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
302 return pValue ? NewEnumValue(pArgs->pStaticStore, pValue->eName) : NULL; | 302 return pValue ? NewEnumValue(pArgs->pStaticStore, pValue->eName) : NULL; |
303 } | 303 } |
304 IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, | 304 IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, |
305 const FX_WCHAR* pszValue, | 305 const FX_WCHAR* pszValue, |
306 int32_t iValueLen) { | 306 int32_t iValueLen) { |
307 FX_ARGB dwColor; | 307 FX_ARGB dwColor; |
308 if (!FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { | 308 if (!FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { |
309 return NULL; | 309 return NULL; |
310 } | 310 } |
311 return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(dwColor); | 311 return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(dwColor); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 const FX_WCHAR* pszFuncName = CopyToLocal(pArgs, pszValue, iStartBracket); | 364 const FX_WCHAR* pszFuncName = CopyToLocal(pArgs, pszValue, iStartBracket); |
365 pszValue += (iStartBracket + 1); | 365 pszValue += (iStartBracket + 1); |
366 iValueLen -= (iStartBracket + 2); | 366 iValueLen -= (iStartBracket + 2); |
367 CFDE_CSSValueArray argumentArr; | 367 CFDE_CSSValueArray argumentArr; |
368 CFDE_CSSValueListParser parser(pszValue, iValueLen, ','); | 368 CFDE_CSSValueListParser parser(pszValue, iValueLen, ','); |
369 FDE_CSSPRIMITIVETYPE ePrimitiveType; | 369 FDE_CSSPRIMITIVETYPE ePrimitiveType; |
370 while (parser.NextValue(ePrimitiveType, pszValue, iValueLen)) { | 370 while (parser.NextValue(ePrimitiveType, pszValue, iValueLen)) { |
371 switch (ePrimitiveType) { | 371 switch (ePrimitiveType) { |
372 case FDE_CSSPRIMITIVETYPE_String: { | 372 case FDE_CSSPRIMITIVETYPE_String: { |
373 const FDE_CSSPROPERTYVALUETABLE* pPropertyValue = | 373 const FDE_CSSPROPERTYVALUETABLE* pPropertyValue = |
374 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 374 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
375 if (pPropertyValue != NULL) { | 375 if (pPropertyValue != NULL) { |
376 argumentArr.Add( | 376 argumentArr.Add( |
377 NewEnumValue(pArgs->pStaticStore, pPropertyValue->eName)); | 377 NewEnumValue(pArgs->pStaticStore, pPropertyValue->eName)); |
378 continue; | 378 continue; |
379 } | 379 } |
380 IFDE_CSSValue* pFunctionValue = | 380 IFDE_CSSValue* pFunctionValue = |
381 ParseFunction(pArgs, pszValue, iValueLen); | 381 ParseFunction(pArgs, pszValue, iValueLen); |
382 if (pFunctionValue != NULL) { | 382 if (pFunctionValue != NULL) { |
383 argumentArr.Add(pFunctionValue); | 383 argumentArr.Add(pFunctionValue); |
384 continue; | 384 continue; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 while (parser.NextValue(eType, pszValue, iValueLen)) { | 422 while (parser.NextValue(eType, pszValue, iValueLen)) { |
423 switch (eType) { | 423 switch (eType) { |
424 case FDE_CSSPRIMITIVETYPE_URI: | 424 case FDE_CSSPRIMITIVETYPE_URI: |
425 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( | 425 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( |
426 eType, CopyToLocal(pArgs, pszValue, iValueLen))); | 426 eType, CopyToLocal(pArgs, pszValue, iValueLen))); |
427 break; | 427 break; |
428 case FDE_CSSPRIMITIVETYPE_Number: | 428 case FDE_CSSPRIMITIVETYPE_Number: |
429 return FALSE; | 429 return FALSE; |
430 case FDE_CSSPRIMITIVETYPE_String: { | 430 case FDE_CSSPRIMITIVETYPE_String: { |
431 const FDE_CSSPROPERTYVALUETABLE* pValue = | 431 const FDE_CSSPROPERTYVALUETABLE* pValue = |
432 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 432 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
433 if (pValue != NULL) { | 433 if (pValue != NULL) { |
434 switch (pValue->eName) { | 434 switch (pValue->eName) { |
435 case FDE_CSSPROPERTYVALUE_Normal: | 435 case FDE_CSSPROPERTYVALUE_Normal: |
436 case FDE_CSSPROPERTYVALUE_None: { | 436 case FDE_CSSPROPERTYVALUE_None: { |
437 if (list.GetSize() == 0) { | 437 if (list.GetSize() == 0) { |
438 list.Add(NewEnumValue(pStaticStore, pValue->eName)); | 438 list.Add(NewEnumValue(pStaticStore, pValue->eName)); |
439 } else { | 439 } else { |
440 return FALSE; | 440 return FALSE; |
441 } | 441 } |
442 } break; | 442 } break; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 if (dwType & FDE_CSSVALUETYPE_MaybeColor) { | 556 if (dwType & FDE_CSSVALUETYPE_MaybeColor) { |
557 FX_ARGB dwColor; | 557 FX_ARGB dwColor; |
558 if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { | 558 if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { |
559 list.Add(FXTARGET_NewWith(pStaticStore) | 559 list.Add(FXTARGET_NewWith(pStaticStore) |
560 CFDE_CSSPrimitiveValue(dwColor)); | 560 CFDE_CSSPrimitiveValue(dwColor)); |
561 continue; | 561 continue; |
562 } | 562 } |
563 } | 563 } |
564 if (dwType & FDE_CSSVALUETYPE_MaybeEnum) { | 564 if (dwType & FDE_CSSVALUETYPE_MaybeEnum) { |
565 const FDE_CSSPROPERTYVALUETABLE* pValue = | 565 const FDE_CSSPROPERTYVALUETABLE* pValue = |
566 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 566 FDE_GetCSSPropertyValueByName( |
| 567 CFX_WideStringC(pszValue, iValueLen)); |
567 if (pValue != NULL) { | 568 if (pValue != NULL) { |
568 list.Add(NewEnumValue(pStaticStore, pValue->eName)); | 569 list.Add(NewEnumValue(pStaticStore, pValue->eName)); |
569 continue; | 570 continue; |
570 } | 571 } |
571 } | 572 } |
572 if (dwType & FDE_CSSVALUETYPE_MaybeString) { | 573 if (dwType & FDE_CSSVALUETYPE_MaybeString) { |
573 pszValue = CopyToLocal(pArgs, pszValue, iValueLen); | 574 pszValue = CopyToLocal(pArgs, pszValue, iValueLen); |
574 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( | 575 list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( |
575 FDE_CSSPRIMITIVETYPE_String, pszValue)); | 576 FDE_CSSPRIMITIVETYPE_String, pszValue)); |
576 } | 577 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 if (pColor == NULL) { | 689 if (pColor == NULL) { |
689 FX_ARGB dwColor; | 690 FX_ARGB dwColor; |
690 if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { | 691 if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { |
691 pColor = | 692 pColor = |
692 FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); | 693 FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); |
693 } | 694 } |
694 } | 695 } |
695 break; | 696 break; |
696 case FDE_CSSPRIMITIVETYPE_String: { | 697 case FDE_CSSPRIMITIVETYPE_String: { |
697 const FDE_CSSCOLORTABLE* pColorItem = | 698 const FDE_CSSCOLORTABLE* pColorItem = |
698 FDE_GetCSSColorByName(pszValue, iValueLen); | 699 FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); |
699 if (pColorItem != NULL) { | 700 if (pColorItem != NULL) { |
700 if (pColor == NULL) { | 701 if (pColor == NULL) { |
701 pColor = FXTARGET_NewWith(pStaticStore) | 702 pColor = FXTARGET_NewWith(pStaticStore) |
702 CFDE_CSSPrimitiveValue(pColorItem->dwValue); | 703 CFDE_CSSPrimitiveValue(pColorItem->dwValue); |
703 } | 704 } |
704 continue; | 705 continue; |
705 } | 706 } |
706 const FDE_CSSPROPERTYVALUETABLE* pValue = | 707 const FDE_CSSPROPERTYVALUETABLE* pValue = |
707 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 708 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
708 if (pValue == NULL) { | 709 if (pValue == NULL) { |
709 continue; | 710 continue; |
710 } | 711 } |
711 switch (pValue->eName) { | 712 switch (pValue->eName) { |
712 case FDE_CSSPROPERTYVALUE_Transparent: | 713 case FDE_CSSPROPERTYVALUE_Transparent: |
713 if (pColor == NULL) { | 714 if (pColor == NULL) { |
714 pColor = FXTARGET_NewWith(pStaticStore) | 715 pColor = FXTARGET_NewWith(pStaticStore) |
715 CFDE_CSSPrimitiveValue((FX_ARGB)0); | 716 CFDE_CSSPrimitiveValue((FX_ARGB)0); |
716 } | 717 } |
717 break; | 718 break; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 while (parser.NextValue(eType, pszValue, iValueLen)) { | 780 while (parser.NextValue(eType, pszValue, iValueLen)) { |
780 switch (eType) { | 781 switch (eType) { |
781 case FDE_CSSPRIMITIVETYPE_URI: | 782 case FDE_CSSPRIMITIVETYPE_URI: |
782 if (pImage == NULL) { | 783 if (pImage == NULL) { |
783 pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( | 784 pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( |
784 eType, CopyToLocal(pArgs, pszValue, iValueLen)); | 785 eType, CopyToLocal(pArgs, pszValue, iValueLen)); |
785 } | 786 } |
786 break; | 787 break; |
787 case FDE_CSSPRIMITIVETYPE_String: { | 788 case FDE_CSSPRIMITIVETYPE_String: { |
788 const FDE_CSSPROPERTYVALUETABLE* pValue = | 789 const FDE_CSSPROPERTYVALUETABLE* pValue = |
789 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 790 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
790 if (pValue == NULL) { | 791 if (pValue == NULL) { |
791 break; | 792 break; |
792 } | 793 } |
793 switch (pValue->eName) { | 794 switch (pValue->eName) { |
794 case FDE_CSSPROPERTYVALUE_None: | 795 case FDE_CSSPROPERTYVALUE_None: |
795 if (pImage == NULL) { | 796 if (pImage == NULL) { |
796 pImage = NewEnumValue(pStaticStore, pValue->eName); | 797 pImage = NewEnumValue(pStaticStore, pValue->eName); |
797 } else if (pType == NULL) { | 798 } else if (pType == NULL) { |
798 pImage = NewEnumValue(pStaticStore, pValue->eName); | 799 pImage = NewEnumValue(pStaticStore, pValue->eName); |
799 } | 800 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 break; | 872 break; |
872 } | 873 } |
873 if (pPosX == NULL) { | 874 if (pPosX == NULL) { |
874 pPosX = NewNumberValue(pStaticStore, eType, fValue); | 875 pPosX = NewNumberValue(pStaticStore, eType, fValue); |
875 } else if (pPosY == NULL) { | 876 } else if (pPosY == NULL) { |
876 pPosY = NewNumberValue(pStaticStore, eType, fValue); | 877 pPosY = NewNumberValue(pStaticStore, eType, fValue); |
877 } | 878 } |
878 } break; | 879 } break; |
879 case FDE_CSSPRIMITIVETYPE_String: { | 880 case FDE_CSSPRIMITIVETYPE_String: { |
880 const FDE_CSSPROPERTYVALUETABLE* pValue = | 881 const FDE_CSSPROPERTYVALUETABLE* pValue = |
881 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 882 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
882 if (pValue != NULL) { | 883 if (pValue != NULL) { |
883 switch (pValue->eName) { | 884 switch (pValue->eName) { |
884 case FDE_CSSPROPERTYVALUE_None: | 885 case FDE_CSSPROPERTYVALUE_None: |
885 if (pImage == NULL) { | 886 if (pImage == NULL) { |
886 pImage = NewEnumValue(pStaticStore, pValue->eName); | 887 pImage = NewEnumValue(pStaticStore, pValue->eName); |
887 } | 888 } |
888 break; | 889 break; |
889 case FDE_CSSPROPERTYVALUE_Transparent: | 890 case FDE_CSSPROPERTYVALUE_Transparent: |
890 if (pColor == NULL) { | 891 if (pColor == NULL) { |
891 pColor = FXTARGET_NewWith(pStaticStore) | 892 pColor = FXTARGET_NewWith(pStaticStore) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 } else if (pPosY == NULL) { | 925 } else if (pPosY == NULL) { |
925 pPosX = NewEnumValue(pStaticStore, pValue->eName); | 926 pPosX = NewEnumValue(pStaticStore, pValue->eName); |
926 } | 927 } |
927 break; | 928 break; |
928 default: | 929 default: |
929 break; | 930 break; |
930 } | 931 } |
931 break; | 932 break; |
932 } | 933 } |
933 const FDE_CSSCOLORTABLE* pColorItem = | 934 const FDE_CSSCOLORTABLE* pColorItem = |
934 FDE_GetCSSColorByName(pszValue, iValueLen); | 935 FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); |
935 if (pColorItem != NULL) { | 936 if (pColorItem != NULL) { |
936 if (pColor == NULL) { | 937 if (pColor == NULL) { |
937 pColor = FXTARGET_NewWith(pStaticStore) | 938 pColor = FXTARGET_NewWith(pStaticStore) |
938 CFDE_CSSPrimitiveValue(pColorItem->dwValue); | 939 CFDE_CSSPrimitiveValue(pColorItem->dwValue); |
939 } | 940 } |
940 } | 941 } |
941 } break; | 942 } break; |
942 case FDE_CSSPRIMITIVETYPE_RGB: | 943 case FDE_CSSPRIMITIVETYPE_RGB: |
943 if (pColor == NULL) { | 944 if (pColor == NULL) { |
944 FX_ARGB dwColor; | 945 FX_ARGB dwColor; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 995 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; |
995 CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); | 996 CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); |
996 IFDE_CSSPrimitiveValue *pStyle = NULL, *pVariant = NULL, *pWeight = NULL; | 997 IFDE_CSSPrimitiveValue *pStyle = NULL, *pVariant = NULL, *pWeight = NULL; |
997 IFDE_CSSPrimitiveValue *pFontSize = NULL, *pLineHeight = NULL; | 998 IFDE_CSSPrimitiveValue *pFontSize = NULL, *pLineHeight = NULL; |
998 CFDE_CSSValueArray familyList; | 999 CFDE_CSSValueArray familyList; |
999 FDE_CSSPRIMITIVETYPE eType; | 1000 FDE_CSSPRIMITIVETYPE eType; |
1000 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1001 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1001 switch (eType) { | 1002 switch (eType) { |
1002 case FDE_CSSPRIMITIVETYPE_String: { | 1003 case FDE_CSSPRIMITIVETYPE_String: { |
1003 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1004 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1004 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 1005 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1005 if (pValue != NULL) { | 1006 if (pValue != NULL) { |
1006 switch (pValue->eName) { | 1007 switch (pValue->eName) { |
1007 case FDE_CSSPROPERTYVALUE_XxSmall: | 1008 case FDE_CSSPROPERTYVALUE_XxSmall: |
1008 case FDE_CSSPROPERTYVALUE_XSmall: | 1009 case FDE_CSSPROPERTYVALUE_XSmall: |
1009 case FDE_CSSPROPERTYVALUE_Small: | 1010 case FDE_CSSPROPERTYVALUE_Small: |
1010 case FDE_CSSPROPERTYVALUE_Medium: | 1011 case FDE_CSSPROPERTYVALUE_Medium: |
1011 case FDE_CSSPROPERTYVALUE_Large: | 1012 case FDE_CSSPROPERTYVALUE_Large: |
1012 case FDE_CSSPROPERTYVALUE_XLarge: | 1013 case FDE_CSSPROPERTYVALUE_XLarge: |
1013 case FDE_CSSPROPERTYVALUE_XxLarge: | 1014 case FDE_CSSPROPERTYVALUE_XxLarge: |
1014 case FDE_CSSPROPERTYVALUE_Smaller: | 1015 case FDE_CSSPROPERTYVALUE_Smaller: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1133 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; |
1133 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1134 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1134 IFDE_CSSPrimitiveValue* pColumnRuleWidth = NULL; | 1135 IFDE_CSSPrimitiveValue* pColumnRuleWidth = NULL; |
1135 IFDE_CSSPrimitiveValue* pColumnRuleStyle = NULL; | 1136 IFDE_CSSPrimitiveValue* pColumnRuleStyle = NULL; |
1136 IFDE_CSSPrimitiveValue* pColumnRuleColor = NULL; | 1137 IFDE_CSSPrimitiveValue* pColumnRuleColor = NULL; |
1137 FDE_CSSPRIMITIVETYPE eType; | 1138 FDE_CSSPRIMITIVETYPE eType; |
1138 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1139 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1139 switch (eType) { | 1140 switch (eType) { |
1140 case FDE_CSSPRIMITIVETYPE_String: { | 1141 case FDE_CSSPRIMITIVETYPE_String: { |
1141 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1142 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1142 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 1143 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1143 if (pValue != NULL) { | 1144 if (pValue != NULL) { |
1144 switch (pValue->eName) { | 1145 switch (pValue->eName) { |
1145 case FDE_CSSPROPERTYVALUE_None: | 1146 case FDE_CSSPROPERTYVALUE_None: |
1146 case FDE_CSSPROPERTYVALUE_Hidden: | 1147 case FDE_CSSPROPERTYVALUE_Hidden: |
1147 case FDE_CSSPROPERTYVALUE_Dotted: | 1148 case FDE_CSSPROPERTYVALUE_Dotted: |
1148 case FDE_CSSPROPERTYVALUE_Dashed: | 1149 case FDE_CSSPROPERTYVALUE_Dashed: |
1149 case FDE_CSSPROPERTYVALUE_Solid: | 1150 case FDE_CSSPROPERTYVALUE_Solid: |
1150 case FDE_CSSPROPERTYVALUE_Double: | 1151 case FDE_CSSPROPERTYVALUE_Double: |
1151 case FDE_CSSPROPERTYVALUE_Groove: | 1152 case FDE_CSSPROPERTYVALUE_Groove: |
1152 case FDE_CSSPROPERTYVALUE_Ridge: | 1153 case FDE_CSSPROPERTYVALUE_Ridge: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 FX_BOOL bImportant) { | 1230 FX_BOOL bImportant) { |
1230 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1231 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; |
1231 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1232 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1232 CFDE_CSSValueArray arrEmphasisStyle; | 1233 CFDE_CSSValueArray arrEmphasisStyle; |
1233 FDE_CSSPRIMITIVETYPE eType; | 1234 FDE_CSSPRIMITIVETYPE eType; |
1234 IFDE_CSSPrimitiveValue* pEmphasisColor = NULL; | 1235 IFDE_CSSPrimitiveValue* pEmphasisColor = NULL; |
1235 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1236 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1236 switch (eType) { | 1237 switch (eType) { |
1237 case FDE_CSSPRIMITIVETYPE_String: { | 1238 case FDE_CSSPRIMITIVETYPE_String: { |
1238 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1239 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1239 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 1240 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1240 if (pValue != NULL) { | 1241 if (pValue != NULL) { |
1241 arrEmphasisStyle.Add(NewEnumValue(pStaticStore, pValue->eName)); | 1242 arrEmphasisStyle.Add(NewEnumValue(pStaticStore, pValue->eName)); |
1242 continue; | 1243 continue; |
1243 } | 1244 } |
1244 FX_ARGB dwColor; | 1245 FX_ARGB dwColor; |
1245 if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { | 1246 if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { |
1246 pEmphasisColor = | 1247 pEmphasisColor = |
1247 FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); | 1248 FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); |
1248 continue; | 1249 continue; |
1249 } | 1250 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 FX_BOOL bImportant) { | 1283 FX_BOOL bImportant) { |
1283 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1284 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; |
1284 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1285 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1285 IFDE_CSSPrimitiveValue* pColumnWidth = NULL; | 1286 IFDE_CSSPrimitiveValue* pColumnWidth = NULL; |
1286 IFDE_CSSPrimitiveValue* pColumnCount = NULL; | 1287 IFDE_CSSPrimitiveValue* pColumnCount = NULL; |
1287 FDE_CSSPRIMITIVETYPE eType; | 1288 FDE_CSSPRIMITIVETYPE eType; |
1288 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1289 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1289 switch (eType) { | 1290 switch (eType) { |
1290 case FDE_CSSPRIMITIVETYPE_String: { | 1291 case FDE_CSSPRIMITIVETYPE_String: { |
1291 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1292 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1292 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 1293 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1293 if (pValue == NULL && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { | 1294 if (pValue == NULL && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { |
1294 pColumnWidth = NewEnumValue(pStaticStore, pValue->eName); | 1295 pColumnWidth = NewEnumValue(pStaticStore, pValue->eName); |
1295 } | 1296 } |
1296 } break; | 1297 } break; |
1297 case FDE_CSSPRIMITIVETYPE_Number: { | 1298 case FDE_CSSPRIMITIVETYPE_Number: { |
1298 FX_FLOAT fValue; | 1299 FX_FLOAT fValue; |
1299 if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { | 1300 if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { |
1300 switch (eType) { | 1301 switch (eType) { |
1301 case FDE_CSSPRIMITIVETYPE_Number: | 1302 case FDE_CSSPRIMITIVETYPE_Number: |
1302 if (pColumnCount == NULL) { | 1303 if (pColumnCount == NULL) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 int32_t iValueLen, | 1335 int32_t iValueLen, |
1335 FX_BOOL bImportant) { | 1336 FX_BOOL bImportant) { |
1336 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1337 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; |
1337 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1338 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1338 IFDE_CSSPrimitiveValue* pOverflowX = NULL; | 1339 IFDE_CSSPrimitiveValue* pOverflowX = NULL; |
1339 IFDE_CSSPrimitiveValue* pOverflowY = NULL; | 1340 IFDE_CSSPrimitiveValue* pOverflowY = NULL; |
1340 FDE_CSSPRIMITIVETYPE eType; | 1341 FDE_CSSPRIMITIVETYPE eType; |
1341 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1342 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1342 if (eType == FDE_CSSPRIMITIVETYPE_String) { | 1343 if (eType == FDE_CSSPRIMITIVETYPE_String) { |
1343 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1344 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1344 FDE_GetCSSPropertyValueByName(pszValue, iValueLen); | 1345 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1345 if (pValue != NULL) { | 1346 if (pValue != NULL) { |
1346 switch (pValue->eName) { | 1347 switch (pValue->eName) { |
1347 case FDE_CSSOVERFLOW_Visible: | 1348 case FDE_CSSOVERFLOW_Visible: |
1348 case FDE_CSSOVERFLOW_Hidden: | 1349 case FDE_CSSOVERFLOW_Hidden: |
1349 case FDE_CSSOVERFLOW_Scroll: | 1350 case FDE_CSSOVERFLOW_Scroll: |
1350 case FDE_CSSOVERFLOW_Auto: | 1351 case FDE_CSSOVERFLOW_Auto: |
1351 case FDE_CSSOVERFLOW_NoDisplay: | 1352 case FDE_CSSOVERFLOW_NoDisplay: |
1352 case FDE_CSSOVERFLOW_NoContent: | 1353 case FDE_CSSOVERFLOW_NoContent: |
1353 if (pOverflowX != NULL && pOverflowY != NULL) { | 1354 if (pOverflowX != NULL && pOverflowY != NULL) { |
1354 return FALSE; | 1355 return FALSE; |
(...skipping 13 matching lines...) Expand all Loading... |
1368 return FALSE; | 1369 return FALSE; |
1369 } else if (pOverflowY == NULL) { | 1370 } else if (pOverflowY == NULL) { |
1370 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); | 1371 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); |
1371 } | 1372 } |
1372 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, | 1373 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, |
1373 bImportant); | 1374 bImportant); |
1374 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, | 1375 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, |
1375 bImportant); | 1376 bImportant); |
1376 return TRUE; | 1377 return TRUE; |
1377 } | 1378 } |
OLD | NEW |