Give some members better names in fxcrt.
This will be more meaningful when we rewrite these dropping
the hungarian prefix.
-- move one initializer to header.
Change-Id: Ia350c0930402fb0e80863d921df1416f1a999b2f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70070
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index c13aca6..260ce9b 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -21,13 +21,13 @@
#include "core/fxcrt/css/cfx_cssvaluelist.h"
#include "third_party/base/logging.h"
-CFX_CSSStyleSelector::CFX_CSSStyleSelector() : m_fDefFontSize(12.0f) {}
+CFX_CSSStyleSelector::CFX_CSSStyleSelector() = default;
-CFX_CSSStyleSelector::~CFX_CSSStyleSelector() {}
+CFX_CSSStyleSelector::~CFX_CSSStyleSelector() = default;
-void CFX_CSSStyleSelector::SetDefFontSize(float fFontSize) {
+void CFX_CSSStyleSelector::SetDefaultFontSize(float fFontSize) {
ASSERT(fFontSize > 0);
- m_fDefFontSize = fFontSize;
+ m_fDefaultFontSize = fFontSize;
}
RetainPtr<CFX_CSSComputedStyle> CFX_CSSStyleSelector::CreateComputedStyle(
@@ -515,19 +515,19 @@
float fCurFontSize) {
switch (eValue) {
case CFX_CSSPropertyValue::XxSmall:
- return m_fDefFontSize / 1.2f / 1.2f / 1.2f;
+ return m_fDefaultFontSize / 1.2f / 1.2f / 1.2f;
case CFX_CSSPropertyValue::XSmall:
- return m_fDefFontSize / 1.2f / 1.2f;
+ return m_fDefaultFontSize / 1.2f / 1.2f;
case CFX_CSSPropertyValue::Small:
- return m_fDefFontSize / 1.2f;
+ return m_fDefaultFontSize / 1.2f;
case CFX_CSSPropertyValue::Medium:
- return m_fDefFontSize;
+ return m_fDefaultFontSize;
case CFX_CSSPropertyValue::Large:
- return m_fDefFontSize * 1.2f;
+ return m_fDefaultFontSize * 1.2f;
case CFX_CSSPropertyValue::XLarge:
- return m_fDefFontSize * 1.2f * 1.2f;
+ return m_fDefaultFontSize * 1.2f * 1.2f;
case CFX_CSSPropertyValue::XxLarge:
- return m_fDefFontSize * 1.2f * 1.2f * 1.2f;
+ return m_fDefaultFontSize * 1.2f * 1.2f * 1.2f;
case CFX_CSSPropertyValue::Larger:
return fCurFontSize * 1.2f;
case CFX_CSSPropertyValue::Smaller:
diff --git a/core/fxcrt/css/cfx_cssstyleselector.h b/core/fxcrt/css/cfx_cssstyleselector.h
index 13a0f74..17e3039 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.h
+++ b/core/fxcrt/css/cfx_cssstyleselector.h
@@ -28,7 +28,7 @@
CFX_CSSStyleSelector();
~CFX_CSSStyleSelector();
- void SetDefFontSize(float fFontSize);
+ void SetDefaultFontSize(float fFontSize);
void SetUAStyleSheet(std::unique_ptr<CFX_CSSStyleSheet> pSheet);
void UpdateStyleIndex();
@@ -75,7 +75,7 @@
uint32_t ToTextDecoration(const RetainPtr<CFX_CSSValueList>& pList);
CFX_CSSFontVariant ToFontVariant(CFX_CSSPropertyValue eValue);
- float m_fDefFontSize;
+ float m_fDefaultFontSize = 12.0f;
std::unique_ptr<CFX_CSSStyleSheet> m_UAStyles;
CFX_CSSRuleCollection m_UARules;
};
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index 00b3071..8bd7e8a 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -34,7 +34,7 @@
CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
m_Output.Clear();
- if (m_bError)
+ if (m_bHasError)
return CFX_CSSSyntaxStatus::kError;
while (!m_Input.IsEOF()) {
@@ -43,7 +43,7 @@
case SyntaxMode::kRuleSet:
switch (wch) {
case '}':
- m_bError = true;
+ m_bHasError = true;
return CFX_CSSSyntaxStatus::kError;
case '/':
if (m_Input.GetNextChar() == '*') {
@@ -59,7 +59,7 @@
m_eMode = SyntaxMode::kSelector;
return CFX_CSSSyntaxStatus::kStyleRule;
} else {
- m_bError = true;
+ m_bHasError = true;
return CFX_CSSSyntaxStatus::kError;
}
break;
@@ -169,7 +169,7 @@
bool CFX_CSSSyntaxParser::RestoreMode() {
if (m_ModeStack.empty()) {
- m_bError = true;
+ m_bHasError = true;
return false;
}
m_eMode = m_ModeStack.top();
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.h b/core/fxcrt/css/cfx_csssyntaxparser.h
index 584e4e2..daaae8e 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.h
+++ b/core/fxcrt/css/cfx_csssyntaxparser.h
@@ -49,7 +49,7 @@
void SaveMode(SyntaxMode eMode);
bool RestoreMode();
- bool m_bError = false;
+ bool m_bHasError = false;
SyntaxMode m_eMode = SyntaxMode::kRuleSet;
CFX_CSSTextBuf m_Output;
CFX_CSSExtTextBuf m_Input;
diff --git a/core/fxcrt/fx_number.cpp b/core/fxcrt/fx_number.cpp
index 9935451..178ede9 100644
--- a/core/fxcrt/fx_number.cpp
+++ b/core/fxcrt/fx_number.cpp
@@ -13,22 +13,22 @@
#include "core/fxcrt/fx_string.h"
FX_Number::FX_Number()
- : m_bInteger(true), m_bSigned(false), m_UnsignedValue(0) {}
+ : m_bIsInteger(true), m_bIsSigned(false), m_UnsignedValue(0) {}
FX_Number::FX_Number(int32_t value)
- : m_bInteger(true), m_bSigned(true), m_SignedValue(value) {}
+ : m_bIsInteger(true), m_bIsSigned(true), m_SignedValue(value) {}
FX_Number::FX_Number(float value)
- : m_bInteger(false), m_bSigned(true), m_FloatValue(value) {}
+ : m_bIsInteger(false), m_bIsSigned(true), m_FloatValue(value) {}
FX_Number::FX_Number(ByteStringView strc)
- : m_bInteger(true), m_bSigned(false), m_UnsignedValue(0) {
+ : m_bIsInteger(true), m_bIsSigned(false), m_UnsignedValue(0) {
if (strc.IsEmpty())
return;
if (strc.Contains('.')) {
- m_bInteger = false;
- m_bSigned = true;
+ m_bIsInteger = false;
+ m_bIsSigned = true;
m_FloatValue = StringToFloat(strc);
return;
}
@@ -43,10 +43,10 @@
size_t cc = 0;
if (strc[0] == '+') {
cc++;
- m_bSigned = true;
+ m_bIsSigned = true;
} else if (strc[0] == '-') {
bNegative = true;
- m_bSigned = true;
+ m_bIsSigned = true;
cc++;
}
@@ -58,7 +58,7 @@
}
uint32_t uValue = unsigned_val.ValueOrDefault(0);
- if (!m_bSigned) {
+ if (!m_bIsSigned) {
m_UnsignedValue = uValue;
return;
}
@@ -86,13 +86,13 @@
}
int32_t FX_Number::GetSigned() const {
- return m_bInteger ? m_SignedValue : static_cast<int32_t>(m_FloatValue);
+ return m_bIsInteger ? m_SignedValue : static_cast<int32_t>(m_FloatValue);
}
float FX_Number::GetFloat() const {
- if (!m_bInteger)
+ if (!m_bIsInteger)
return m_FloatValue;
- return m_bSigned ? static_cast<float>(m_SignedValue)
- : static_cast<float>(m_UnsignedValue);
+ return m_bIsSigned ? static_cast<float>(m_SignedValue)
+ : static_cast<float>(m_UnsignedValue);
}
diff --git a/core/fxcrt/fx_number.h b/core/fxcrt/fx_number.h
index 0ee4744..0449631 100644
--- a/core/fxcrt/fx_number.h
+++ b/core/fxcrt/fx_number.h
@@ -19,15 +19,15 @@
explicit FX_Number(float value);
explicit FX_Number(ByteStringView str);
- bool IsInteger() const { return m_bInteger; }
- bool IsSigned() const { return m_bSigned; }
+ bool IsInteger() const { return m_bIsInteger; }
+ bool IsSigned() const { return m_bIsSigned; }
int32_t GetSigned() const; // Underflow/Overflow possible.
float GetFloat() const;
private:
- bool m_bInteger; // One of the two integers vs. float type.
- bool m_bSigned; // Only valid if |m_bInteger|.
+ bool m_bIsInteger; // One of the two integers vs. float type.
+ bool m_bIsSigned; // Only valid if |m_bInteger|.
union {
uint32_t m_UnsignedValue;
int32_t m_SignedValue;
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index ba9c618..9373cd3 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -20,7 +20,7 @@
struct FX_FolderHandle {
HANDLE m_Handle;
- bool m_bEnd;
+ bool m_bReachedEnd;
WIN32_FIND_DATAA m_FindData;
};
#else
@@ -130,7 +130,7 @@
if (handle->m_Handle == INVALID_HANDLE_VALUE)
return nullptr;
- handle->m_bEnd = false;
+ handle->m_bReachedEnd = false;
#else
DIR* dir = opendir(path);
if (!dir)
@@ -149,14 +149,14 @@
return false;
#if defined(OS_WIN)
- if (handle->m_bEnd)
+ if (handle->m_bReachedEnd)
return false;
*filename = handle->m_FindData.cFileName;
*bFolder =
(handle->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
if (!FindNextFileA(handle->m_Handle, &handle->m_FindData))
- handle->m_bEnd = true;
+ handle->m_bReachedEnd = true;
return true;
#else
struct dirent* de = readdir(handle->m_Dir);
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 483ffa2..09094b8 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -74,7 +74,7 @@
m_pSelector = std::make_unique<CFX_CSSStyleSelector>();
CXFA_Font* font = pTextProvider->GetFontIfExists();
- m_pSelector->SetDefFontSize(font ? font->GetFontSize() : 10.0f);
+ m_pSelector->SetDefaultFontSize(font ? font->GetFontSize() : 10.0f);
}
if (m_cssInitialized)