Chromium Code Reviews| 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_cssdatatable.h" | 7 #include "xfa/fde/css/fde_cssdatatable.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
| 10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 691 FDE_LPCCSSLENGTHUNITTABLE pUnit = | 691 FDE_LPCCSSLENGTHUNITTABLE pUnit = |
| 692 FDE_GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2)); | 692 FDE_GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2)); |
| 693 if (pUnit) | 693 if (pUnit) |
| 694 eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; | 694 eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; |
| 695 } | 695 } |
| 696 return true; | 696 return true; |
| 697 } | 697 } |
| 698 | 698 |
| 699 bool FDE_ParseCSSString(const FX_WCHAR* pszValue, | 699 bool FDE_ParseCSSString(const FX_WCHAR* pszValue, |
| 700 int32_t iValueLen, | 700 int32_t iValueLen, |
| 701 int32_t& iOffset, | 701 int32_t* iOffset, |
| 702 int32_t& iLength) { | 702 int32_t* iLength) { |
| 703 ASSERT(pszValue && iValueLen > 0); | 703 ASSERT(pszValue && iValueLen > 0); |
| 704 iOffset = 0; | 704 *iOffset = 0; |
| 705 iLength = iValueLen; | 705 *iLength = iValueLen; |
| 706 if (iValueLen >= 2) { | 706 if (iValueLen >= 2) { |
| 707 FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1]; | 707 FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1]; |
| 708 if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) { | 708 if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) |
| 709 iOffset = 1, iLength -= 2; | 709 *iOffset = 1, *iLength -= 2; |
|
Tom Sepez
2016/11/28 19:24:40
keep {} use ; not , and one per line.
npm
2016/11/28 20:35:45
Done.
| |
| 710 } | |
| 711 } | 710 } |
| 712 return iValueLen > 0; | 711 return iValueLen > 0; |
| 713 } | 712 } |
| 714 | 713 |
| 715 bool FDE_ParseCSSURI(const FX_WCHAR* pszValue, | 714 bool FDE_ParseCSSURI(const FX_WCHAR* pszValue, |
| 716 int32_t iValueLen, | 715 int32_t* iOffset, |
| 717 int32_t& iOffset, | 716 int32_t* iLength) { |
| 718 int32_t& iLength) { | 717 ASSERT(pszValue && *iLength > 0); |
| 719 ASSERT(pszValue && iValueLen > 0); | 718 if (*iLength < 6 || pszValue[*iLength - 1] != ')' || |
| 720 if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' || | |
| 721 FXSYS_wcsnicmp(L"url(", pszValue, 4)) { | 719 FXSYS_wcsnicmp(L"url(", pszValue, 4)) { |
| 722 return false; | 720 return false; |
| 723 } | 721 } |
| 724 if (FDE_ParseCSSString(pszValue + 4, iValueLen - 5, iOffset, iLength)) { | 722 if (FDE_ParseCSSString(pszValue + 4, *iLength - 5, iOffset, iLength)) { |
| 725 iOffset += 4; | 723 *iOffset += 4; |
| 726 return true; | 724 return true; |
| 727 } | 725 } |
| 728 return false; | 726 return false; |
| 729 } | 727 } |
| 730 | 728 |
| 731 bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, | 729 bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, |
| 732 int32_t iValueLen, | 730 int32_t iValueLen, |
| 733 FX_ARGB& dwColor) { | 731 FX_ARGB& dwColor) { |
| 734 ASSERT(pszValue && iValueLen > 0); | 732 ASSERT(pszValue && iValueLen > 0); |
| 735 | 733 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 | 958 |
| 961 int32_t CFDE_CSSPrimitiveValue::CountArgs() const { | 959 int32_t CFDE_CSSPrimitiveValue::CountArgs() const { |
| 962 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); | 960 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); |
| 963 return m_pFunction->CountArgs(); | 961 return m_pFunction->CountArgs(); |
| 964 } | 962 } |
| 965 | 963 |
| 966 IFDE_CSSValue* CFDE_CSSPrimitiveValue::GetArgs(int32_t index) const { | 964 IFDE_CSSValue* CFDE_CSSPrimitiveValue::GetArgs(int32_t index) const { |
| 967 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); | 965 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); |
| 968 return m_pFunction->GetArgs(index); | 966 return m_pFunction->GetArgs(index); |
| 969 } | 967 } |
| OLD | NEW |