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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return NULL; | 69 return NULL; |
70 } | 70 } |
71 FXSYS_wcsncpy(psz, pszValue, iValueLen); | 71 FXSYS_wcsncpy(psz, pszValue, iValueLen); |
72 psz[iValueLen] = '\0'; | 72 psz[iValueLen] = '\0'; |
73 if (pCache) { | 73 if (pCache) { |
74 pCache->SetAt(pKey, psz); | 74 pCache->SetAt(pKey, psz); |
75 } | 75 } |
76 return psz; | 76 return psz; |
77 } | 77 } |
78 IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( | 78 IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( |
79 IFX_MEMAllocator* pStaticStore, | 79 IFX_MemoryAllocator* pStaticStore, |
80 FDE_CSSPRIMITIVETYPE eUnit, | 80 FDE_CSSPRIMITIVETYPE eUnit, |
81 FX_FLOAT fValue) const { | 81 FX_FLOAT fValue) const { |
82 static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); | 82 static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); |
83 if (eUnit == FDE_CSSPRIMITIVETYPE_Number && FXSYS_fabs(fValue) < 0.001f) { | 83 if (eUnit == FDE_CSSPRIMITIVETYPE_Number && FXSYS_fabs(fValue) < 0.001f) { |
84 return &s_ZeroValue; | 84 return &s_ZeroValue; |
85 } | 85 } |
86 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eUnit, fValue); | 86 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eUnit, fValue); |
87 } | 87 } |
88 inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( | 88 inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( |
89 IFX_MEMAllocator* pStaticStore, | 89 IFX_MemoryAllocator* pStaticStore, |
90 FDE_CSSPROPERTYVALUE eValue) const { | 90 FDE_CSSPROPERTYVALUE eValue) const { |
91 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eValue); | 91 return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eValue); |
92 } | 92 } |
93 void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MEMAllocator* pStaticStore, | 93 void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, |
94 FDE_CSSPROPERTY eProperty, | 94 FDE_CSSPROPERTY eProperty, |
95 IFDE_CSSValue* pValue, | 95 IFDE_CSSValue* pValue, |
96 FX_BOOL bImportant) { | 96 FX_BOOL bImportant) { |
97 FDE_CSSPropertyHolder* pHolder = | 97 FDE_CSSPropertyHolder* pHolder = |
98 FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder; | 98 FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder; |
99 pHolder->bImportant = bImportant; | 99 pHolder->bImportant = bImportant; |
100 pHolder->eProperty = eProperty; | 100 pHolder->eProperty = eProperty; |
101 pHolder->pValue = pValue; | 101 pHolder->pValue = pValue; |
102 pHolder->pNext = NULL; | 102 pHolder->pNext = NULL; |
103 if (m_pLastProperty == NULL) { | 103 if (m_pLastProperty == NULL) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName, | 161 AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName, |
162 pCSSValue, bImportant); | 162 pCSSValue, bImportant); |
163 return TRUE; | 163 return TRUE; |
164 } | 164 } |
165 if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) { | 165 if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) { |
166 return FALSE; | 166 return FALSE; |
167 } | 167 } |
168 } | 168 } |
169 } break; | 169 } break; |
170 case FDE_CSSVALUETYPE_Shorthand: { | 170 case FDE_CSSVALUETYPE_Shorthand: { |
171 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 171 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
172 IFDE_CSSValue *pColor, *pStyle, *pWidth; | 172 IFDE_CSSValue *pColor, *pStyle, *pWidth; |
173 switch (pArgs->pProperty->eName) { | 173 switch (pArgs->pProperty->eName) { |
174 case FDE_CSSPROPERTY_Font: | 174 case FDE_CSSPROPERTY_Font: |
175 return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant); | 175 return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant); |
176 case FDE_CSSPROPERTY_Background: | 176 case FDE_CSSPROPERTY_Background: |
177 return ParseBackgroundProperty(pArgs, pszValue, iValueLen, | 177 return ParseBackgroundProperty(pArgs, pszValue, iValueLen, |
178 bImportant); | 178 bImportant); |
179 case FDE_CSSPROPERTY_ListStyle: | 179 case FDE_CSSPROPERTY_ListStyle: |
180 return ParseListStyleProperty(pArgs, pszValue, iValueLen, bImportant); | 180 return ParseListStyleProperty(pArgs, pszValue, iValueLen, bImportant); |
181 case FDE_CSSPROPERTY_Border: | 181 case FDE_CSSPROPERTY_Border: |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 CFDE_CSSFunction* pFunction = FXTARGET_NewWith(pArgs->pStaticStore) | 408 CFDE_CSSFunction* pFunction = FXTARGET_NewWith(pArgs->pStaticStore) |
409 CFDE_CSSFunction(pszFuncName, pArgumentList); | 409 CFDE_CSSFunction(pszFuncName, pArgumentList); |
410 return FXTARGET_NewWith(pArgs->pStaticStore) | 410 return FXTARGET_NewWith(pArgs->pStaticStore) |
411 CFDE_CSSPrimitiveValue(pFunction); | 411 CFDE_CSSPrimitiveValue(pFunction); |
412 } | 412 } |
413 FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( | 413 FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( |
414 const FDE_CSSPROPERTYARGS* pArgs, | 414 const FDE_CSSPROPERTYARGS* pArgs, |
415 const FX_WCHAR* pszValue, | 415 const FX_WCHAR* pszValue, |
416 int32_t iValueLen, | 416 int32_t iValueLen, |
417 FX_BOOL bImportant) { | 417 FX_BOOL bImportant) { |
418 IFX_MEMAllocator* pStaticStore = (IFX_MEMAllocator*)pArgs->pStaticStore; | 418 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
419 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 419 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
420 FDE_CSSPRIMITIVETYPE eType; | 420 FDE_CSSPRIMITIVETYPE eType; |
421 CFDE_CSSValueArray list; | 421 CFDE_CSSValueArray list; |
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: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 FXTARGET_NewWith(pStaticStore) | 472 FXTARGET_NewWith(pStaticStore) |
473 CFDE_CSSValueList(pStaticStore, list), | 473 CFDE_CSSValueList(pStaticStore, list), |
474 bImportant); | 474 bImportant); |
475 return TRUE; | 475 return TRUE; |
476 } | 476 } |
477 FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( | 477 FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( |
478 const FDE_CSSPROPERTYARGS* pArgs, | 478 const FDE_CSSPROPERTYARGS* pArgs, |
479 const FX_WCHAR* pszValue, | 479 const FX_WCHAR* pszValue, |
480 int32_t iValueLen, | 480 int32_t iValueLen, |
481 FX_BOOL bImportant) { | 481 FX_BOOL bImportant) { |
482 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 482 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
483 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 483 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
484 CFDE_CSSValueArray list; | 484 CFDE_CSSValueArray list; |
485 CFDE_CSSValueArray listFull; | 485 CFDE_CSSValueArray listFull; |
486 FDE_CSSPRIMITIVETYPE eType; | 486 FDE_CSSPRIMITIVETYPE eType; |
487 while (parser.NextValue(eType, pszValue, iValueLen)) { | 487 while (parser.NextValue(eType, pszValue, iValueLen)) { |
488 switch (eType) { | 488 switch (eType) { |
489 case FDE_CSSPRIMITIVETYPE_Number: { | 489 case FDE_CSSPRIMITIVETYPE_Number: { |
490 FX_FLOAT fValue; | 490 FX_FLOAT fValue; |
491 if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { | 491 if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { |
492 if (list.GetSize() == 1) { | 492 if (list.GetSize() == 1) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 FXTARGET_NewWith(pStaticStore) | 528 FXTARGET_NewWith(pStaticStore) |
529 CFDE_CSSValueList(pStaticStore, listFull), | 529 CFDE_CSSValueList(pStaticStore, listFull), |
530 bImportant); | 530 bImportant); |
531 return TRUE; | 531 return TRUE; |
532 } | 532 } |
533 FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( | 533 FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( |
534 const FDE_CSSPROPERTYARGS* pArgs, | 534 const FDE_CSSPROPERTYARGS* pArgs, |
535 const FX_WCHAR* pszValue, | 535 const FX_WCHAR* pszValue, |
536 int32_t iValueLen, | 536 int32_t iValueLen, |
537 FX_BOOL bImportant) { | 537 FX_BOOL bImportant) { |
538 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 538 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
539 FX_WCHAR separator = | 539 FX_WCHAR separator = |
540 (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; | 540 (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; |
541 CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); | 541 CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); |
542 const uint32_t dwType = pArgs->pProperty->dwType; | 542 const uint32_t dwType = pArgs->pProperty->dwType; |
543 FDE_CSSPRIMITIVETYPE eType; | 543 FDE_CSSPRIMITIVETYPE eType; |
544 CFDE_CSSValueArray list; | 544 CFDE_CSSValueArray list; |
545 while (parser.NextValue(eType, pszValue, iValueLen)) { | 545 while (parser.NextValue(eType, pszValue, iValueLen)) { |
546 switch (eType) { | 546 switch (eType) { |
547 case FDE_CSSPRIMITIVETYPE_Number: | 547 case FDE_CSSPRIMITIVETYPE_Number: |
548 if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { | 548 if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 default: { | 621 default: { |
622 CFDE_CSSValueList* pList = | 622 CFDE_CSSValueList* pList = |
623 FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list); | 623 FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list); |
624 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList, | 624 AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList, |
625 bImportant); | 625 bImportant); |
626 return TRUE; | 626 return TRUE; |
627 } break; | 627 } break; |
628 } | 628 } |
629 return FALSE; | 629 return FALSE; |
630 } | 630 } |
631 FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MEMAllocator* pStaticStore, | 631 FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty( |
632 const CFDE_CSSValueArray& list, | 632 IFX_MemoryAllocator* pStaticStore, |
633 FX_BOOL bImportant, | 633 const CFDE_CSSValueArray& list, |
634 FDE_CSSPROPERTY eLeft, | 634 FX_BOOL bImportant, |
635 FDE_CSSPROPERTY eTop, | 635 FDE_CSSPROPERTY eLeft, |
636 FDE_CSSPROPERTY eRight, | 636 FDE_CSSPROPERTY eTop, |
637 FDE_CSSPROPERTY eBottom) { | 637 FDE_CSSPROPERTY eRight, |
| 638 FDE_CSSPROPERTY eBottom) { |
638 switch (list.GetSize()) { | 639 switch (list.GetSize()) { |
639 case 1: | 640 case 1: |
640 AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant); | 641 AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant); |
641 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); | 642 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); |
642 AddPropertyHolder(pStaticStore, eRight, list[0], bImportant); | 643 AddPropertyHolder(pStaticStore, eRight, list[0], bImportant); |
643 AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); | 644 AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); |
644 return TRUE; | 645 return TRUE; |
645 case 2: | 646 case 2: |
646 AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); | 647 AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); |
647 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); | 648 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); |
(...skipping 11 matching lines...) Expand all Loading... |
659 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); | 660 AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); |
660 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); | 661 AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); |
661 AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); | 662 AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); |
662 return TRUE; | 663 return TRUE; |
663 default: | 664 default: |
664 break; | 665 break; |
665 } | 666 } |
666 return FALSE; | 667 return FALSE; |
667 } | 668 } |
668 FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( | 669 FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( |
669 IFX_MEMAllocator* pStaticStore, | 670 IFX_MemoryAllocator* pStaticStore, |
670 const FX_WCHAR* pszValue, | 671 const FX_WCHAR* pszValue, |
671 int32_t iValueLen, | 672 int32_t iValueLen, |
672 IFDE_CSSValue*& pColor, | 673 IFDE_CSSValue*& pColor, |
673 IFDE_CSSValue*& pStyle, | 674 IFDE_CSSValue*& pStyle, |
674 IFDE_CSSValue*& pWidth) const { | 675 IFDE_CSSValue*& pWidth) const { |
675 pColor = pStyle = pWidth = NULL; | 676 pColor = pStyle = pWidth = NULL; |
676 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 677 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
677 FDE_CSSPRIMITIVETYPE eType; | 678 FDE_CSSPRIMITIVETYPE eType; |
678 while (parser.NextValue(eType, pszValue, iValueLen)) { | 679 while (parser.NextValue(eType, pszValue, iValueLen)) { |
679 switch (eType) { | 680 switch (eType) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); | 750 pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); |
750 } | 751 } |
751 if (pStyle == NULL) { | 752 if (pStyle == NULL) { |
752 pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); | 753 pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); |
753 } | 754 } |
754 if (pWidth == NULL) { | 755 if (pWidth == NULL) { |
755 pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); | 756 pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); |
756 } | 757 } |
757 return TRUE; | 758 return TRUE; |
758 } | 759 } |
759 void CFDE_CSSDeclaration::AddBorderProperty(IFX_MEMAllocator* pStaticStore, | 760 void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, |
760 IFDE_CSSValue* pColor, | 761 IFDE_CSSValue* pColor, |
761 IFDE_CSSValue* pStyle, | 762 IFDE_CSSValue* pStyle, |
762 IFDE_CSSValue* pWidth, | 763 IFDE_CSSValue* pWidth, |
763 FX_BOOL bImportant, | 764 FX_BOOL bImportant, |
764 FDE_CSSPROPERTY eColor, | 765 FDE_CSSPROPERTY eColor, |
765 FDE_CSSPROPERTY eStyle, | 766 FDE_CSSPROPERTY eStyle, |
766 FDE_CSSPROPERTY eWidth) { | 767 FDE_CSSPROPERTY eWidth) { |
767 AddPropertyHolder(pStaticStore, eStyle, pStyle, bImportant); | 768 AddPropertyHolder(pStaticStore, eStyle, pStyle, bImportant); |
768 AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant); | 769 AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant); |
769 AddPropertyHolder(pStaticStore, eColor, pColor, bImportant); | 770 AddPropertyHolder(pStaticStore, eColor, pColor, bImportant); |
770 } | 771 } |
771 FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( | 772 FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( |
772 const FDE_CSSPROPERTYARGS* pArgs, | 773 const FDE_CSSPROPERTYARGS* pArgs, |
773 const FX_WCHAR* pszValue, | 774 const FX_WCHAR* pszValue, |
774 int32_t iValueLen, | 775 int32_t iValueLen, |
775 FX_BOOL bImportant) { | 776 FX_BOOL bImportant) { |
776 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 777 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
777 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 778 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
778 IFDE_CSSPrimitiveValue *pType = NULL, *pImage = NULL, *pPosition = NULL; | 779 IFDE_CSSPrimitiveValue *pType = NULL, *pImage = NULL, *pPosition = NULL; |
779 FDE_CSSPRIMITIVETYPE eType; | 780 FDE_CSSPRIMITIVETYPE eType; |
780 while (parser.NextValue(eType, pszValue, iValueLen)) { | 781 while (parser.NextValue(eType, pszValue, iValueLen)) { |
781 switch (eType) { | 782 switch (eType) { |
782 case FDE_CSSPRIMITIVETYPE_URI: | 783 case FDE_CSSPRIMITIVETYPE_URI: |
783 if (pImage == NULL) { | 784 if (pImage == NULL) { |
784 pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( | 785 pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( |
785 eType, CopyToLocal(pArgs, pszValue, iValueLen)); | 786 eType, CopyToLocal(pArgs, pszValue, iValueLen)); |
786 } | 787 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 bImportant); | 847 bImportant); |
847 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType, | 848 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType, |
848 bImportant); | 849 bImportant); |
849 return TRUE; | 850 return TRUE; |
850 } | 851 } |
851 FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( | 852 FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( |
852 const FDE_CSSPROPERTYARGS* pArgs, | 853 const FDE_CSSPROPERTYARGS* pArgs, |
853 const FX_WCHAR* pszValue, | 854 const FX_WCHAR* pszValue, |
854 int32_t iValueLen, | 855 int32_t iValueLen, |
855 FX_BOOL bImportant) { | 856 FX_BOOL bImportant) { |
856 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 857 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
857 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 858 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
858 IFDE_CSSPrimitiveValue *pColor = NULL, *pImage = NULL, *pRepeat = NULL; | 859 IFDE_CSSPrimitiveValue *pColor = NULL, *pImage = NULL, *pRepeat = NULL; |
859 IFDE_CSSPrimitiveValue *pPosX = NULL, *pPosY = NULL, *pAttachment = NULL; | 860 IFDE_CSSPrimitiveValue *pPosX = NULL, *pPosY = NULL, *pAttachment = NULL; |
860 FDE_CSSPRIMITIVETYPE eType; | 861 FDE_CSSPRIMITIVETYPE eType; |
861 while (parser.NextValue(eType, pszValue, iValueLen)) { | 862 while (parser.NextValue(eType, pszValue, iValueLen)) { |
862 switch (eType) { | 863 switch (eType) { |
863 case FDE_CSSPRIMITIVETYPE_URI: | 864 case FDE_CSSPRIMITIVETYPE_URI: |
864 if (pImage == NULL) { | 865 if (pImage == NULL) { |
865 pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( | 866 pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( |
866 eType, CopyToLocal(pArgs, pszValue, iValueLen)); | 867 eType, CopyToLocal(pArgs, pszValue, iValueLen)); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundPosition, pPosList, | 986 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundPosition, pPosList, |
986 bImportant); | 987 bImportant); |
987 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment, | 988 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment, |
988 pAttachment, bImportant); | 989 pAttachment, bImportant); |
989 return TRUE; | 990 return TRUE; |
990 } | 991 } |
991 FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, | 992 FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, |
992 const FX_WCHAR* pszValue, | 993 const FX_WCHAR* pszValue, |
993 int32_t iValueLen, | 994 int32_t iValueLen, |
994 FX_BOOL bImportant) { | 995 FX_BOOL bImportant) { |
995 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 996 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
996 CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); | 997 CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); |
997 IFDE_CSSPrimitiveValue *pStyle = NULL, *pVariant = NULL, *pWeight = NULL; | 998 IFDE_CSSPrimitiveValue *pStyle = NULL, *pVariant = NULL, *pWeight = NULL; |
998 IFDE_CSSPrimitiveValue *pFontSize = NULL, *pLineHeight = NULL; | 999 IFDE_CSSPrimitiveValue *pFontSize = NULL, *pLineHeight = NULL; |
999 CFDE_CSSValueArray familyList; | 1000 CFDE_CSSValueArray familyList; |
1000 FDE_CSSPRIMITIVETYPE eType; | 1001 FDE_CSSPRIMITIVETYPE eType; |
1001 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1002 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1002 switch (eType) { | 1003 switch (eType) { |
1003 case FDE_CSSPRIMITIVETYPE_String: { | 1004 case FDE_CSSPRIMITIVETYPE_String: { |
1004 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1005 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1005 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); | 1006 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList, | 1124 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList, |
1124 bImportant); | 1125 bImportant); |
1125 } | 1126 } |
1126 return TRUE; | 1127 return TRUE; |
1127 } | 1128 } |
1128 FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( | 1129 FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( |
1129 const FDE_CSSPROPERTYARGS* pArgs, | 1130 const FDE_CSSPROPERTYARGS* pArgs, |
1130 const FX_WCHAR* pszValue, | 1131 const FX_WCHAR* pszValue, |
1131 int32_t iValueLen, | 1132 int32_t iValueLen, |
1132 FX_BOOL bImportant) { | 1133 FX_BOOL bImportant) { |
1133 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1134 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
1134 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1135 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1135 IFDE_CSSPrimitiveValue* pColumnRuleWidth = NULL; | 1136 IFDE_CSSPrimitiveValue* pColumnRuleWidth = NULL; |
1136 IFDE_CSSPrimitiveValue* pColumnRuleStyle = NULL; | 1137 IFDE_CSSPrimitiveValue* pColumnRuleStyle = NULL; |
1137 IFDE_CSSPrimitiveValue* pColumnRuleColor = NULL; | 1138 IFDE_CSSPrimitiveValue* pColumnRuleColor = NULL; |
1138 FDE_CSSPRIMITIVETYPE eType; | 1139 FDE_CSSPRIMITIVETYPE eType; |
1139 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1140 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1140 switch (eType) { | 1141 switch (eType) { |
1141 case FDE_CSSPRIMITIVETYPE_String: { | 1142 case FDE_CSSPRIMITIVETYPE_String: { |
1142 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1143 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1143 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); | 1144 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 pColumnRuleWidth, bImportant); | 1222 pColumnRuleWidth, bImportant); |
1222 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor, | 1223 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor, |
1223 pColumnRuleColor, bImportant); | 1224 pColumnRuleColor, bImportant); |
1224 return TRUE; | 1225 return TRUE; |
1225 } | 1226 } |
1226 FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( | 1227 FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( |
1227 FDE_CSSPROPERTYARGS* pArgs, | 1228 FDE_CSSPROPERTYARGS* pArgs, |
1228 const FX_WCHAR* pszValue, | 1229 const FX_WCHAR* pszValue, |
1229 int32_t iValueLen, | 1230 int32_t iValueLen, |
1230 FX_BOOL bImportant) { | 1231 FX_BOOL bImportant) { |
1231 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1232 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
1232 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1233 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1233 CFDE_CSSValueArray arrEmphasisStyle; | 1234 CFDE_CSSValueArray arrEmphasisStyle; |
1234 FDE_CSSPRIMITIVETYPE eType; | 1235 FDE_CSSPRIMITIVETYPE eType; |
1235 IFDE_CSSPrimitiveValue* pEmphasisColor = NULL; | 1236 IFDE_CSSPrimitiveValue* pEmphasisColor = NULL; |
1236 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1237 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1237 switch (eType) { | 1238 switch (eType) { |
1238 case FDE_CSSPRIMITIVETYPE_String: { | 1239 case FDE_CSSPRIMITIVETYPE_String: { |
1239 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1240 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1240 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); | 1241 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1241 if (pValue != NULL) { | 1242 if (pValue != NULL) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor, | 1275 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor, |
1275 pEmphasisColor, bImportant); | 1276 pEmphasisColor, bImportant); |
1276 } | 1277 } |
1277 return TRUE; | 1278 return TRUE; |
1278 } | 1279 } |
1279 FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( | 1280 FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( |
1280 const FDE_CSSPROPERTYARGS* pArgs, | 1281 const FDE_CSSPROPERTYARGS* pArgs, |
1281 const FX_WCHAR* pszValue, | 1282 const FX_WCHAR* pszValue, |
1282 int32_t iValueLen, | 1283 int32_t iValueLen, |
1283 FX_BOOL bImportant) { | 1284 FX_BOOL bImportant) { |
1284 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1285 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
1285 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1286 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1286 IFDE_CSSPrimitiveValue* pColumnWidth = NULL; | 1287 IFDE_CSSPrimitiveValue* pColumnWidth = NULL; |
1287 IFDE_CSSPrimitiveValue* pColumnCount = NULL; | 1288 IFDE_CSSPrimitiveValue* pColumnCount = NULL; |
1288 FDE_CSSPRIMITIVETYPE eType; | 1289 FDE_CSSPRIMITIVETYPE eType; |
1289 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1290 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1290 switch (eType) { | 1291 switch (eType) { |
1291 case FDE_CSSPRIMITIVETYPE_String: { | 1292 case FDE_CSSPRIMITIVETYPE_String: { |
1292 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1293 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1293 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); | 1294 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1294 if (pValue == NULL && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { | 1295 if (pValue == NULL && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 bImportant); | 1328 bImportant); |
1328 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount, | 1329 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount, |
1329 bImportant); | 1330 bImportant); |
1330 return TRUE; | 1331 return TRUE; |
1331 } | 1332 } |
1332 FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( | 1333 FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( |
1333 const FDE_CSSPROPERTYARGS* pArgs, | 1334 const FDE_CSSPROPERTYARGS* pArgs, |
1334 const FX_WCHAR* pszValue, | 1335 const FX_WCHAR* pszValue, |
1335 int32_t iValueLen, | 1336 int32_t iValueLen, |
1336 FX_BOOL bImportant) { | 1337 FX_BOOL bImportant) { |
1337 IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore; | 1338 IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; |
1338 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); | 1339 CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); |
1339 IFDE_CSSPrimitiveValue* pOverflowX = NULL; | 1340 IFDE_CSSPrimitiveValue* pOverflowX = NULL; |
1340 IFDE_CSSPrimitiveValue* pOverflowY = NULL; | 1341 IFDE_CSSPrimitiveValue* pOverflowY = NULL; |
1341 FDE_CSSPRIMITIVETYPE eType; | 1342 FDE_CSSPRIMITIVETYPE eType; |
1342 while (parser.NextValue(eType, pszValue, iValueLen)) { | 1343 while (parser.NextValue(eType, pszValue, iValueLen)) { |
1343 if (eType == FDE_CSSPRIMITIVETYPE_String) { | 1344 if (eType == FDE_CSSPRIMITIVETYPE_String) { |
1344 const FDE_CSSPROPERTYVALUETABLE* pValue = | 1345 const FDE_CSSPROPERTYVALUETABLE* pValue = |
1345 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); | 1346 FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); |
1346 if (pValue != NULL) { | 1347 if (pValue != NULL) { |
1347 switch (pValue->eName) { | 1348 switch (pValue->eName) { |
(...skipping 21 matching lines...) Expand all Loading... |
1369 return FALSE; | 1370 return FALSE; |
1370 } else if (pOverflowY == NULL) { | 1371 } else if (pOverflowY == NULL) { |
1371 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); | 1372 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); |
1372 } | 1373 } |
1373 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, | 1374 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, |
1374 bImportant); | 1375 bImportant); |
1375 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, | 1376 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, |
1376 bImportant); | 1377 bImportant); |
1377 return TRUE; | 1378 return TRUE; |
1378 } | 1379 } |
OLD | NEW |