| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   112                                          int32_t iValueLen) { |   112                                          int32_t iValueLen) { | 
|   113   FXSYS_assert(iValueLen > 0); |   113   FXSYS_assert(iValueLen > 0); | 
|   114   FX_BOOL bImportant = FALSE; |   114   FX_BOOL bImportant = FALSE; | 
|   115   if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' && |   115   if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' && | 
|   116       FX_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) { |   116       FX_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) { | 
|   117     if ((iValueLen -= 10) == 0) { |   117     if ((iValueLen -= 10) == 0) { | 
|   118       return FALSE; |   118       return FALSE; | 
|   119     } |   119     } | 
|   120     bImportant = TRUE; |   120     bImportant = TRUE; | 
|   121   } |   121   } | 
|   122   const FX_DWORD dwType = pArgs->pProperty->dwType; |   122   const uint32_t dwType = pArgs->pProperty->dwType; | 
|   123   switch (dwType & 0x0F) { |   123   switch (dwType & 0x0F) { | 
|   124     case FDE_CSSVALUETYPE_Primitive: { |   124     case FDE_CSSVALUETYPE_Primitive: { | 
|   125       static const FX_DWORD g_ValueGuessOrder[] = { |   125       static const uint32_t g_ValueGuessOrder[] = { | 
|   126           FDE_CSSVALUETYPE_MaybeNumber,   FDE_CSSVALUETYPE_MaybeEnum, |   126           FDE_CSSVALUETYPE_MaybeNumber,   FDE_CSSVALUETYPE_MaybeEnum, | 
|   127           FDE_CSSVALUETYPE_MaybeColor,    FDE_CSSVALUETYPE_MaybeURI, |   127           FDE_CSSVALUETYPE_MaybeColor,    FDE_CSSVALUETYPE_MaybeURI, | 
|   128           FDE_CSSVALUETYPE_MaybeFunction, FDE_CSSVALUETYPE_MaybeString, |   128           FDE_CSSVALUETYPE_MaybeFunction, FDE_CSSVALUETYPE_MaybeString, | 
|   129       }; |   129       }; | 
|   130       static const int32_t g_ValueGuessCount = |   130       static const int32_t g_ValueGuessCount = | 
|   131           sizeof(g_ValueGuessOrder) / sizeof(FX_DWORD); |   131           sizeof(g_ValueGuessOrder) / sizeof(uint32_t); | 
|   132       for (int32_t i = 0; i < g_ValueGuessCount; ++i) { |   132       for (int32_t i = 0; i < g_ValueGuessCount; ++i) { | 
|   133         const FX_DWORD dwMatch = dwType & g_ValueGuessOrder[i]; |   133         const uint32_t dwMatch = dwType & g_ValueGuessOrder[i]; | 
|   134         if (dwMatch == 0) { |   134         if (dwMatch == 0) { | 
|   135           continue; |   135           continue; | 
|   136         } |   136         } | 
|   137         IFDE_CSSValue* pCSSValue = NULL; |   137         IFDE_CSSValue* pCSSValue = NULL; | 
|   138         switch (dwMatch) { |   138         switch (dwMatch) { | 
|   139           case FDE_CSSVALUETYPE_MaybeFunction: |   139           case FDE_CSSVALUETYPE_MaybeFunction: | 
|   140             pCSSValue = ParseFunction(pArgs, pszValue, iValueLen); |   140             pCSSValue = ParseFunction(pArgs, pszValue, iValueLen); | 
|   141             break; |   141             break; | 
|   142           case FDE_CSSVALUETYPE_MaybeNumber: |   142           case FDE_CSSVALUETYPE_MaybeNumber: | 
|   143             pCSSValue = ParseNumber(pArgs, pszValue, iValueLen); |   143             pCSSValue = ParseNumber(pArgs, pszValue, iValueLen); | 
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   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_MEMAllocator* 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 FX_DWORD 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) { | 
|   549           FX_FLOAT fValue; |   549           FX_FLOAT fValue; | 
|   550           if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { |   550           if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { | 
|   551             list.Add(NewNumberValue(pStaticStore, eType, fValue)); |   551             list.Add(NewNumberValue(pStaticStore, eType, fValue)); | 
|   552           } |   552           } | 
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1368     return FALSE; |  1368     return FALSE; | 
|  1369   } else if (pOverflowY == NULL) { |  1369   } else if (pOverflowY == NULL) { | 
|  1370     pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); |  1370     pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); | 
|  1371   } |  1371   } | 
|  1372   AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, |  1372   AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, | 
|  1373                     bImportant); |  1373                     bImportant); | 
|  1374   AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, |  1374   AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, | 
|  1375                     bImportant); |  1375                     bImportant); | 
|  1376   return TRUE; |  1376   return TRUE; | 
|  1377 } |  1377 } | 
| OLD | NEW |