summaryrefslogtreecommitdiff
path: root/core/fxcrt/css/cfx_cssdeclaration.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-31 15:47:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-31 15:47:32 +0000
commit41b45a88f14ea546d1b46b7c30a1c9c1db778ac3 (patch)
treeffad96b6e33807ed3f78056c9ba879e1c3dceab3 /core/fxcrt/css/cfx_cssdeclaration.cpp
parent3f3f5130e91c9a868831ee80840f027111ee6f3b (diff)
downloadpdfium-41b45a88f14ea546d1b46b7c30a1c9c1db778ac3.tar.xz
Clean up CSS property table
Reorganizes the free functions to be static methods on a class. Converts the Table struct to be an Entry struct defined in the class. Change-Id: I9eca0dfb15187af10cbe2dc4b4c2756d55d957be Reviewed-on: https://pdfium-review.googlesource.com/24712 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/css/cfx_cssdeclaration.cpp')
-rw-r--r--core/fxcrt/css/cfx_cssdeclaration.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp
index 90bdf4e0ea..e771f6277d 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.cpp
+++ b/core/fxcrt/css/cfx_cssdeclaration.cpp
@@ -307,7 +307,7 @@ void CFX_CSSDeclaration::AddPropertyHolder(CFX_CSSProperty eProperty,
properties_.push_back(std::move(pHolder));
}
-void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
+void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable::Entry* pEntry,
const WideStringView& value) {
ASSERT(!value.IsEmpty());
@@ -321,7 +321,7 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
bImportant = true;
}
- const uint32_t dwType = pTable->dwType;
+ const uint32_t dwType = pEntry->dwType;
switch (dwType & 0x0F) {
case CFX_CSSVALUETYPE_Primitive: {
static const uint32_t g_ValueGuessOrder[] = {
@@ -353,7 +353,7 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
break;
}
if (pCSSValue) {
- AddPropertyHolder(pTable->eName, pCSSValue, bImportant);
+ AddPropertyHolder(pEntry->eName, pCSSValue, bImportant);
return;
}
@@ -364,7 +364,7 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
}
case CFX_CSSVALUETYPE_Shorthand: {
RetainPtr<CFX_CSSValue> pWidth;
- switch (pTable->eName) {
+ switch (pEntry->eName) {
case CFX_CSSProperty::Font:
ParseFontProperty(pszValue, iValueLen, bImportant);
return;
@@ -414,7 +414,7 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
}
} break;
case CFX_CSSVALUETYPE_List:
- ParseValueListProperty(pTable, pszValue, iValueLen, bImportant);
+ ParseValueListProperty(pEntry, pszValue, iValueLen, bImportant);
return;
default:
NOTREACHED();
@@ -466,15 +466,15 @@ RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseString(const wchar_t* pszValue,
}
void CFX_CSSDeclaration::ParseValueListProperty(
- const CFX_CSSPropertyTable* pTable,
+ const CFX_CSSPropertyTable::Entry* pEntry,
const wchar_t* pszValue,
int32_t iValueLen,
bool bImportant) {
wchar_t separator =
- (pTable->eName == CFX_CSSProperty::FontFamily) ? ',' : ' ';
+ (pEntry->eName == CFX_CSSProperty::FontFamily) ? ',' : ' ';
CFX_CSSValueListParser parser(pszValue, iValueLen, separator);
- const uint32_t dwType = pTable->dwType;
+ const uint32_t dwType = pEntry->dwType;
CFX_CSSPrimitiveType eType;
std::vector<RetainPtr<CFX_CSSValue>> list;
while (parser.NextValue(&eType, &pszValue, &iValueLen)) {
@@ -524,7 +524,7 @@ void CFX_CSSDeclaration::ParseValueListProperty(
if (list.empty())
return;
- switch (pTable->eName) {
+ switch (pEntry->eName) {
case CFX_CSSProperty::BorderWidth:
Add4ValuesProperty(list, bImportant, CFX_CSSProperty::BorderLeftWidth,
CFX_CSSProperty::BorderTopWidth,
@@ -545,7 +545,7 @@ void CFX_CSSDeclaration::ParseValueListProperty(
return;
default: {
auto pList = pdfium::MakeRetain<CFX_CSSValueList>(list);
- AddPropertyHolder(pTable->eName, pList, bImportant);
+ AddPropertyHolder(pEntry->eName, pList, bImportant);
return;
}
}