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

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

Issue 2072803002: Make code compile with clang_use_chrome_plugin (final) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: tidy Created 4 years, 6 months 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
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_cssdatatable.h" 7 #include "xfa/fde/css/fde_cssdatatable.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_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 return TRUE; 788 return TRUE;
789 } 789 }
790 790
791 CFDE_CSSValueList::CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, 791 CFDE_CSSValueList::CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore,
792 const CFDE_CSSValueArray& list) { 792 const CFDE_CSSValueArray& list) {
793 m_iCount = list.GetSize(); 793 m_iCount = list.GetSize();
794 int32_t iByteCount = m_iCount * sizeof(IFDE_CSSValue*); 794 int32_t iByteCount = m_iCount * sizeof(IFDE_CSSValue*);
795 m_ppList = (IFDE_CSSValue**)pStaticStore->Alloc(iByteCount); 795 m_ppList = (IFDE_CSSValue**)pStaticStore->Alloc(iByteCount);
796 FXSYS_memcpy(m_ppList, list.GetData(), iByteCount); 796 FXSYS_memcpy(m_ppList, list.GetData(), iByteCount);
797 } 797 }
798
799 int32_t CFDE_CSSValueList::CountValues() const {
800 return m_iCount;
801 }
802
803 IFDE_CSSValue* CFDE_CSSValueList::GetValue(int32_t index) const {
804 return m_ppList[index];
805 }
798 FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, 806 FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType,
799 const FX_WCHAR*& pStart, 807 const FX_WCHAR*& pStart,
800 int32_t& iLength) { 808 int32_t& iLength) {
801 while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) { 809 while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) {
802 ++m_pCur; 810 ++m_pCur;
803 } 811 }
804 if (m_pCur >= m_pEnd) { 812 if (m_pCur >= m_pEnd) {
805 return FALSE; 813 return FALSE;
806 } 814 }
807 eType = FDE_CSSPRIMITIVETYPE_Unknown; 815 eType = FDE_CSSPRIMITIVETYPE_Unknown;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 897 }
890 while (iBracketCount > 0 && m_pCur < m_pEnd) { 898 while (iBracketCount > 0 && m_pCur < m_pEnd) {
891 if (*m_pCur == ')') { 899 if (*m_pCur == ')') {
892 iBracketCount--; 900 iBracketCount--;
893 } 901 }
894 m_pCur++; 902 m_pCur++;
895 } 903 }
896 } 904 }
897 return m_pCur - pStart; 905 return m_pCur - pStart;
898 } 906 }
907
908 CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(
909 const CFDE_CSSPrimitiveValue& src) = default;
910
911 CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FX_ARGB color)
912 : m_eType(FDE_CSSPRIMITIVETYPE_RGB), m_dwColor(color) {}
913
914 CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue)
915 : m_eType(FDE_CSSPRIMITIVETYPE_Enum), m_eEnum(eValue) {}
916
917 CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType,
918 FX_FLOAT fValue)
919 : m_eType(eType), m_fNumber(fValue) {}
920
921 CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType,
922 const FX_WCHAR* pValue)
923 : m_eType(eType), m_pString(pValue) {
924 ASSERT(m_pString != nullptr);
925 }
926
927 CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction)
928 : m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {}
929
930 FDE_CSSPRIMITIVETYPE CFDE_CSSPrimitiveValue::GetPrimitiveType() const {
931 return m_eType;
932 }
933
934 FX_ARGB CFDE_CSSPrimitiveValue::GetRGBColor() const {
935 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_RGB);
936 return m_dwColor;
937 }
938
939 FX_FLOAT CFDE_CSSPrimitiveValue::GetFloat() const {
940 ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_Number &&
941 m_eType <= FDE_CSSPRIMITIVETYPE_PC);
942 return m_fNumber;
943 }
944
945 const FX_WCHAR* CFDE_CSSPrimitiveValue::GetString(int32_t& iLength) const {
946 ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_String &&
947 m_eType <= FDE_CSSPRIMITIVETYPE_URI);
948 iLength = FXSYS_wcslen(m_pString);
949 return m_pString;
950 }
951
952 FDE_CSSPROPERTYVALUE CFDE_CSSPrimitiveValue::GetEnum() const {
953 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Enum);
954 return m_eEnum;
955 }
956
957 const FX_WCHAR* CFDE_CSSPrimitiveValue::GetFuncName() const {
958 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function);
959 return m_pFunction->GetFuncName();
960 }
961
962 int32_t CFDE_CSSPrimitiveValue::CountArgs() const {
963 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function);
964 return m_pFunction->CountArgs();
965 }
966
967 IFDE_CSSValue* CFDE_CSSPrimitiveValue::GetArgs(int32_t index) const {
968 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function);
969 return m_pFunction->GetArgs(index);
970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698