convert core/fxcrt/css to google_style_ members
Change-Id: Ib2d41c30f1dca090e1bf89a8a40a15af9fe1d8ec
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130290
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/css/cfx_css.h b/core/fxcrt/css/cfx_css.h
index 1f71851..a9619a1 100644
--- a/core/fxcrt/css/cfx_css.h
+++ b/core/fxcrt/css/cfx_css.h
@@ -98,27 +98,27 @@
CFX_CSSLength() = default;
CFX_CSSLength(CFX_CSSLengthUnit eUnit, float fValue)
- : m_unit(eUnit), m_fValue(fValue) {}
+ : unit_(eUnit), value_(fValue) {}
CFX_CSSLength& Set(CFX_CSSLengthUnit eUnit) {
- m_unit = eUnit;
+ unit_ = eUnit;
return *this;
}
CFX_CSSLength& Set(CFX_CSSLengthUnit eUnit, float fValue) {
- m_unit = eUnit;
- m_fValue = fValue;
+ unit_ = eUnit;
+ value_ = fValue;
return *this;
}
- CFX_CSSLengthUnit GetUnit() const { return m_unit; }
+ CFX_CSSLengthUnit GetUnit() const { return unit_; }
- float GetValue() const { return m_fValue; }
- bool NonZero() const { return static_cast<int>(m_fValue) != 0; }
+ float GetValue() const { return value_; }
+ bool NonZero() const { return static_cast<int>(value_) != 0; }
private:
- CFX_CSSLengthUnit m_unit;
- float m_fValue;
+ CFX_CSSLengthUnit unit_;
+ float value_;
};
class CFX_CSSRect {
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.cpp b/core/fxcrt/css/cfx_csscomputedstyle.cpp
index 6335d7a..3f13756 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.cpp
+++ b/core/fxcrt/css/cfx_csscomputedstyle.cpp
@@ -16,7 +16,7 @@
bool CFX_CSSComputedStyle::GetCustomStyle(const WideString& wsName,
WideString* pValue) const {
- for (const auto& prop : pdfium::Reversed(m_CustomProperties)) {
+ for (const auto& prop : pdfium::Reversed(custom_properties_)) {
if (wsName == prop.name()) {
*pValue = prop.value();
return true;
@@ -26,145 +26,146 @@
}
std::optional<WideString> CFX_CSSComputedStyle::GetLastFontFamily() const {
- if (!m_InheritedData.m_pFontFamily ||
- m_InheritedData.m_pFontFamily->values().empty()) {
+ if (!inherited_data_.font_family_ ||
+ inherited_data_.font_family_->values().empty()) {
return std::nullopt;
}
- return m_InheritedData.m_pFontFamily->values()
+ return inherited_data_.font_family_->values()
.back()
.AsRaw<CFX_CSSStringValue>()
->Value();
}
uint16_t CFX_CSSComputedStyle::GetFontWeight() const {
- return m_InheritedData.m_wFontWeight;
+ return inherited_data_.wfont_weight_;
}
CFX_CSSFontVariant CFX_CSSComputedStyle::GetFontVariant() const {
- return m_InheritedData.m_eFontVariant;
+ return inherited_data_.font_variant_;
}
CFX_CSSFontStyle CFX_CSSComputedStyle::GetFontStyle() const {
- return m_InheritedData.m_eFontStyle;
+ return inherited_data_.font_style_;
}
float CFX_CSSComputedStyle::GetFontSize() const {
- return m_InheritedData.m_fFontSize;
+ return inherited_data_.ffont_size_;
}
FX_ARGB CFX_CSSComputedStyle::GetColor() const {
- return m_InheritedData.m_dwFontColor;
+ return inherited_data_.font_color_;
}
void CFX_CSSComputedStyle::SetFontWeight(uint16_t wFontWeight) {
- m_InheritedData.m_wFontWeight = wFontWeight;
+ inherited_data_.wfont_weight_ = wFontWeight;
}
void CFX_CSSComputedStyle::SetFontVariant(CFX_CSSFontVariant eFontVariant) {
- m_InheritedData.m_eFontVariant = eFontVariant;
+ inherited_data_.font_variant_ = eFontVariant;
}
void CFX_CSSComputedStyle::SetFontStyle(CFX_CSSFontStyle eFontStyle) {
- m_InheritedData.m_eFontStyle = eFontStyle;
+ inherited_data_.font_style_ = eFontStyle;
}
void CFX_CSSComputedStyle::SetFontSize(float fFontSize) {
- m_InheritedData.m_fFontSize = fFontSize;
+ inherited_data_.ffont_size_ = fFontSize;
}
void CFX_CSSComputedStyle::SetColor(FX_ARGB dwFontColor) {
- m_InheritedData.m_dwFontColor = dwFontColor;
+ inherited_data_.font_color_ = dwFontColor;
}
const CFX_CSSRect* CFX_CSSComputedStyle::GetBorderWidth() const {
- return m_NonInheritedData.m_bHasBorder ? &(m_NonInheritedData.m_BorderWidth)
+ return non_inherited_data_.has_border_ ? &(non_inherited_data_.border_width_)
: nullptr;
}
const CFX_CSSRect* CFX_CSSComputedStyle::GetMarginWidth() const {
- return m_NonInheritedData.m_bHasMargin ? &(m_NonInheritedData.m_MarginWidth)
+ return non_inherited_data_.has_margin_ ? &(non_inherited_data_.margin_width_)
: nullptr;
}
const CFX_CSSRect* CFX_CSSComputedStyle::GetPaddingWidth() const {
- return m_NonInheritedData.m_bHasPadding ? &(m_NonInheritedData.m_PaddingWidth)
- : nullptr;
+ return non_inherited_data_.has_padding_
+ ? &(non_inherited_data_.padding_width_)
+ : nullptr;
}
void CFX_CSSComputedStyle::SetMarginWidth(const CFX_CSSRect& rect) {
- m_NonInheritedData.m_MarginWidth = rect;
- m_NonInheritedData.m_bHasMargin = true;
+ non_inherited_data_.margin_width_ = rect;
+ non_inherited_data_.has_margin_ = true;
}
void CFX_CSSComputedStyle::SetPaddingWidth(const CFX_CSSRect& rect) {
- m_NonInheritedData.m_PaddingWidth = rect;
- m_NonInheritedData.m_bHasPadding = true;
+ non_inherited_data_.padding_width_ = rect;
+ non_inherited_data_.has_padding_ = true;
}
CFX_CSSDisplay CFX_CSSComputedStyle::GetDisplay() const {
- return m_NonInheritedData.m_eDisplay;
+ return non_inherited_data_.display_;
}
float CFX_CSSComputedStyle::GetLineHeight() const {
- return m_InheritedData.m_fLineHeight;
+ return inherited_data_.fline_height_;
}
const CFX_CSSLength& CFX_CSSComputedStyle::GetTextIndent() const {
- return m_InheritedData.m_TextIndent;
+ return inherited_data_.text_indent_;
}
CFX_CSSTextAlign CFX_CSSComputedStyle::GetTextAlign() const {
- return m_InheritedData.m_eTextAlign;
+ return inherited_data_.text_align_;
}
CFX_CSSVerticalAlign CFX_CSSComputedStyle::GetVerticalAlign() const {
- return m_NonInheritedData.m_eVerticalAlignType;
+ return non_inherited_data_.vertical_align_type_;
}
float CFX_CSSComputedStyle::GetNumberVerticalAlign() const {
- return m_NonInheritedData.m_fVerticalAlign;
+ return non_inherited_data_.vertical_align_;
}
Mask<CFX_CSSTEXTDECORATION> CFX_CSSComputedStyle::GetTextDecoration() const {
- return m_NonInheritedData.m_dwTextDecoration;
+ return non_inherited_data_.text_decoration_;
}
const CFX_CSSLength& CFX_CSSComputedStyle::GetLetterSpacing() const {
- return m_InheritedData.m_LetterSpacing;
+ return inherited_data_.letter_spacing_;
}
void CFX_CSSComputedStyle::SetLineHeight(float fLineHeight) {
- m_InheritedData.m_fLineHeight = fLineHeight;
+ inherited_data_.fline_height_ = fLineHeight;
}
void CFX_CSSComputedStyle::SetTextIndent(const CFX_CSSLength& textIndent) {
- m_InheritedData.m_TextIndent = textIndent;
+ inherited_data_.text_indent_ = textIndent;
}
void CFX_CSSComputedStyle::SetTextAlign(CFX_CSSTextAlign eTextAlign) {
- m_InheritedData.m_eTextAlign = eTextAlign;
+ inherited_data_.text_align_ = eTextAlign;
}
void CFX_CSSComputedStyle::SetNumberVerticalAlign(float fAlign) {
- m_NonInheritedData.m_eVerticalAlignType = CFX_CSSVerticalAlign::Number,
- m_NonInheritedData.m_fVerticalAlign = fAlign;
+ non_inherited_data_.vertical_align_type_ = CFX_CSSVerticalAlign::Number,
+ non_inherited_data_.vertical_align_ = fAlign;
}
void CFX_CSSComputedStyle::SetTextDecoration(
Mask<CFX_CSSTEXTDECORATION> dwTextDecoration) {
- m_NonInheritedData.m_dwTextDecoration = dwTextDecoration;
+ non_inherited_data_.text_decoration_ = dwTextDecoration;
}
void CFX_CSSComputedStyle::SetLetterSpacing(
const CFX_CSSLength& letterSpacing) {
- m_InheritedData.m_LetterSpacing = letterSpacing;
+ inherited_data_.letter_spacing_ = letterSpacing;
}
void CFX_CSSComputedStyle::AddCustomStyle(const CFX_CSSCustomProperty& prop) {
// Force the property to be copied so we aren't dependent on the lifetime
// of whatever currently owns it.
- m_CustomProperties.push_back(prop);
+ custom_properties_.push_back(prop);
}
CFX_CSSComputedStyle::InheritedData::InheritedData() = default;
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h
index 76b2430..e67d1e8 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.h
+++ b/core/fxcrt/css/cfx_csscomputedstyle.h
@@ -26,37 +26,37 @@
InheritedData();
~InheritedData();
- CFX_CSSLength m_LetterSpacing{CFX_CSSLengthUnit::Normal, 0};
- CFX_CSSLength m_WordSpacing{CFX_CSSLengthUnit::Normal, 0};
- CFX_CSSLength m_TextIndent{CFX_CSSLengthUnit::Point, 0};
- RetainPtr<CFX_CSSValueList> m_pFontFamily;
- float m_fFontSize = 12.0f;
- float m_fLineHeight = 14.0f;
- FX_ARGB m_dwFontColor = 0xFF000000;
- uint16_t m_wFontWeight = 400;
- CFX_CSSFontVariant m_eFontVariant = CFX_CSSFontVariant::Normal;
- CFX_CSSFontStyle m_eFontStyle = CFX_CSSFontStyle::Normal;
- CFX_CSSTextAlign m_eTextAlign = CFX_CSSTextAlign::Left;
+ CFX_CSSLength letter_spacing_{CFX_CSSLengthUnit::Normal, 0};
+ CFX_CSSLength word_spacing_{CFX_CSSLengthUnit::Normal, 0};
+ CFX_CSSLength text_indent_{CFX_CSSLengthUnit::Point, 0};
+ RetainPtr<CFX_CSSValueList> font_family_;
+ float ffont_size_ = 12.0f;
+ float fline_height_ = 14.0f;
+ FX_ARGB font_color_ = 0xFF000000;
+ uint16_t wfont_weight_ = 400;
+ CFX_CSSFontVariant font_variant_ = CFX_CSSFontVariant::Normal;
+ CFX_CSSFontStyle font_style_ = CFX_CSSFontStyle::Normal;
+ CFX_CSSTextAlign text_align_ = CFX_CSSTextAlign::Left;
};
class NonInheritedData {
public:
NonInheritedData();
- CFX_CSSRect m_MarginWidth{CFX_CSSLengthUnit::Point, 0};
- CFX_CSSRect m_BorderWidth{CFX_CSSLengthUnit::Point, 0};
- CFX_CSSRect m_PaddingWidth{CFX_CSSLengthUnit::Point, 0};
- CFX_CSSLength m_Top;
- CFX_CSSLength m_Bottom;
- CFX_CSSLength m_Left;
- CFX_CSSLength m_Right;
- float m_fVerticalAlign = 0.0f;
- CFX_CSSDisplay m_eDisplay = CFX_CSSDisplay::Inline;
- CFX_CSSVerticalAlign m_eVerticalAlignType = CFX_CSSVerticalAlign::Baseline;
- Mask<CFX_CSSTEXTDECORATION> m_dwTextDecoration;
- bool m_bHasMargin = false;
- bool m_bHasBorder = false;
- bool m_bHasPadding = false;
+ CFX_CSSRect margin_width_{CFX_CSSLengthUnit::Point, 0};
+ CFX_CSSRect border_width_{CFX_CSSLengthUnit::Point, 0};
+ CFX_CSSRect padding_width_{CFX_CSSLengthUnit::Point, 0};
+ CFX_CSSLength top_;
+ CFX_CSSLength bottom_;
+ CFX_CSSLength left_;
+ CFX_CSSLength right_;
+ float vertical_align_ = 0.0f;
+ CFX_CSSDisplay display_ = CFX_CSSDisplay::Inline;
+ CFX_CSSVerticalAlign vertical_align_type_ = CFX_CSSVerticalAlign::Baseline;
+ Mask<CFX_CSSTEXTDECORATION> text_decoration_;
+ bool has_margin_ = false;
+ bool has_border_ = false;
+ bool has_padding_ = false;
};
CONSTRUCT_VIA_MAKE_RETAIN;
@@ -98,14 +98,14 @@
bool GetCustomStyle(const WideString& wsName, WideString* pValue) const;
- InheritedData m_InheritedData;
- NonInheritedData m_NonInheritedData;
+ InheritedData inherited_data_;
+ NonInheritedData non_inherited_data_;
private:
CFX_CSSComputedStyle();
~CFX_CSSComputedStyle() override;
- std::vector<CFX_CSSCustomProperty> m_CustomProperties;
+ std::vector<CFX_CSSCustomProperty> custom_properties_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSCOMPUTEDSTYLE_H_
diff --git a/core/fxcrt/css/cfx_cssinputtextbuf.cpp b/core/fxcrt/css/cfx_cssinputtextbuf.cpp
index 3554f74..372c980 100644
--- a/core/fxcrt/css/cfx_cssinputtextbuf.cpp
+++ b/core/fxcrt/css/cfx_cssinputtextbuf.cpp
@@ -6,6 +6,6 @@
#include "core/fxcrt/css/cfx_cssinputtextbuf.h"
-CFX_CSSInputTextBuf::CFX_CSSInputTextBuf(WideStringView str) : m_Buffer(str) {}
+CFX_CSSInputTextBuf::CFX_CSSInputTextBuf(WideStringView str) : buffer_(str) {}
CFX_CSSInputTextBuf::~CFX_CSSInputTextBuf() = default;
diff --git a/core/fxcrt/css/cfx_cssinputtextbuf.h b/core/fxcrt/css/cfx_cssinputtextbuf.h
index e702e1b..426200a 100644
--- a/core/fxcrt/css/cfx_cssinputtextbuf.h
+++ b/core/fxcrt/css/cfx_cssinputtextbuf.h
@@ -14,16 +14,16 @@
explicit CFX_CSSInputTextBuf(WideStringView str);
~CFX_CSSInputTextBuf();
- bool IsEOF() const { return m_iPos >= m_Buffer.GetLength(); }
- void MoveNext() { m_iPos++; }
- wchar_t GetChar() const { return m_Buffer[m_iPos]; }
+ bool IsEOF() const { return pos_ >= buffer_.GetLength(); }
+ void MoveNext() { pos_++; }
+ wchar_t GetChar() const { return buffer_[pos_]; }
wchar_t GetNextChar() const {
- return m_iPos + 1 < m_Buffer.GetLength() ? m_Buffer[m_iPos + 1] : 0;
+ return pos_ + 1 < buffer_.GetLength() ? buffer_[pos_ + 1] : 0;
}
protected:
- const WideStringView m_Buffer;
- size_t m_iPos = 0;
+ const WideStringView buffer_;
+ size_t pos_ = 0;
};
#endif // CORE_FXCRT_CSS_CFX_CSSINPUTTEXTBUF_H_
diff --git a/core/fxcrt/css/cfx_cssoutputtextbuf.cpp b/core/fxcrt/css/cfx_cssoutputtextbuf.cpp
index a57d41a..d6b78ea 100644
--- a/core/fxcrt/css/cfx_cssoutputtextbuf.cpp
+++ b/core/fxcrt/css/cfx_cssoutputtextbuf.cpp
@@ -7,20 +7,21 @@
#include "core/fxcrt/css/cfx_cssoutputtextbuf.h"
CFX_CSSOutputTextBuf::CFX_CSSOutputTextBuf() {
- m_Buffer.reserve(32);
+ buffer_.reserve(32);
}
CFX_CSSOutputTextBuf::~CFX_CSSOutputTextBuf() = default;
void CFX_CSSOutputTextBuf::AppendCharIfNotLeadingBlank(wchar_t wch) {
- if (m_Buffer.empty() && wch <= ' ')
+ if (buffer_.empty() && wch <= ' ') {
return;
+ }
- m_Buffer.push_back(wch);
+ buffer_.push_back(wch);
}
WideStringView CFX_CSSOutputTextBuf::GetTrailingBlankTrimmedString() const {
- WideStringView result(m_Buffer);
+ WideStringView result(buffer_);
while (!result.IsEmpty() && result.Back() <= ' ')
result = result.First(result.GetLength() - 1);
diff --git a/core/fxcrt/css/cfx_cssoutputtextbuf.h b/core/fxcrt/css/cfx_cssoutputtextbuf.h
index 8cbb59e..c090d8f 100644
--- a/core/fxcrt/css/cfx_cssoutputtextbuf.h
+++ b/core/fxcrt/css/cfx_cssoutputtextbuf.h
@@ -15,13 +15,13 @@
CFX_CSSOutputTextBuf();
~CFX_CSSOutputTextBuf();
- void Clear() { m_Buffer.clear(); }
- bool IsEmpty() const { return m_Buffer.empty(); }
+ void Clear() { buffer_.clear(); }
+ bool IsEmpty() const { return buffer_.empty(); }
void AppendCharIfNotLeadingBlank(wchar_t wch);
WideStringView GetTrailingBlankTrimmedString() const;
protected:
- DataVector<wchar_t> m_Buffer;
+ DataVector<wchar_t> buffer_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSOUTPUTTEXTBUF_H_
diff --git a/core/fxcrt/css/cfx_cssrulecollection.cpp b/core/fxcrt/css/cfx_cssrulecollection.cpp
index 89b6852..51579f5 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.cpp
+++ b/core/fxcrt/css/cfx_cssrulecollection.cpp
@@ -21,12 +21,12 @@
const std::vector<std::unique_ptr<CFX_CSSRuleCollection::Data>>*
CFX_CSSRuleCollection::GetTagRuleData(const WideString& tagname) const {
- auto it = m_TagRules.find(FX_HashCode_GetLoweredW(tagname.AsStringView()));
- return it != m_TagRules.end() ? &it->second : nullptr;
+ auto it = tag_rules_.find(FX_HashCode_GetLoweredW(tagname.AsStringView()));
+ return it != tag_rules_.end() ? &it->second : nullptr;
}
void CFX_CSSRuleCollection::SetRulesFromSheet(const CFX_CSSStyleSheet* sheet) {
- m_TagRules.clear();
+ tag_rules_.clear();
for (size_t i = 0; i < sheet->CountRules(); ++i)
AddRule(sheet->GetRule(i));
}
@@ -36,7 +36,7 @@
size_t nSelectors = pStyleRule->CountSelectorLists();
for (size_t i = 0; i < nSelectors; ++i) {
CFX_CSSSelector* pSelector = pStyleRule->GetSelectorList(i);
- m_TagRules[pSelector->name_hash()].push_back(
+ tag_rules_[pSelector->name_hash()].push_back(
std::make_unique<Data>(pSelector, pDeclaration));
}
}
diff --git a/core/fxcrt/css/cfx_cssrulecollection.h b/core/fxcrt/css/cfx_cssrulecollection.h
index 125fdd2..7edc1f4 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.h
+++ b/core/fxcrt/css/cfx_cssrulecollection.h
@@ -41,7 +41,7 @@
private:
void AddRule(CFX_CSSStyleRule* pRule);
- std::map<uint32_t, std::vector<std::unique_ptr<Data>>> m_TagRules;
+ std::map<uint32_t, std::vector<std::unique_ptr<Data>>> tag_rules_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSRULECOLLECTION_H_
diff --git a/core/fxcrt/css/cfx_cssstylerule.cpp b/core/fxcrt/css/cfx_cssstylerule.cpp
index e57b757..2e84e44 100644
--- a/core/fxcrt/css/cfx_cssstylerule.cpp
+++ b/core/fxcrt/css/cfx_cssstylerule.cpp
@@ -13,19 +13,19 @@
CFX_CSSStyleRule::~CFX_CSSStyleRule() = default;
size_t CFX_CSSStyleRule::CountSelectorLists() const {
- return m_ppSelector.size();
+ return selector_.size();
}
CFX_CSSSelector* CFX_CSSStyleRule::GetSelectorList(size_t index) const {
- return m_ppSelector[index].get();
+ return selector_[index].get();
}
CFX_CSSDeclaration* CFX_CSSStyleRule::GetDeclaration() {
- return &m_Declaration;
+ return &declaration_;
}
void CFX_CSSStyleRule::SetSelector(
std::vector<std::unique_ptr<CFX_CSSSelector>>* list) {
- DCHECK(m_ppSelector.empty());
- m_ppSelector.swap(*list);
+ DCHECK(selector_.empty());
+ selector_.swap(*list);
}
diff --git a/core/fxcrt/css/cfx_cssstylerule.h b/core/fxcrt/css/cfx_cssstylerule.h
index a731d19..180acea 100644
--- a/core/fxcrt/css/cfx_cssstylerule.h
+++ b/core/fxcrt/css/cfx_cssstylerule.h
@@ -25,8 +25,8 @@
void SetSelector(std::vector<std::unique_ptr<CFX_CSSSelector>>* list);
private:
- CFX_CSSDeclaration m_Declaration;
- std::vector<std::unique_ptr<CFX_CSSSelector>> m_ppSelector;
+ CFX_CSSDeclaration declaration_;
+ std::vector<std::unique_ptr<CFX_CSSSelector>> selector_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSSTYLERULE_H_
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index 6458eb7..6d8928a 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -28,24 +28,24 @@
void CFX_CSSStyleSelector::SetDefaultFontSize(float fFontSize) {
DCHECK(fFontSize > 0);
- m_fDefaultFontSize = fFontSize;
+ default_font_size_ = fFontSize;
}
RetainPtr<CFX_CSSComputedStyle> CFX_CSSStyleSelector::CreateComputedStyle(
const CFX_CSSComputedStyle* pParentStyle) {
auto pStyle = pdfium::MakeRetain<CFX_CSSComputedStyle>();
if (pParentStyle)
- pStyle->m_InheritedData = pParentStyle->m_InheritedData;
+ pStyle->inherited_data_ = pParentStyle->inherited_data_;
return pStyle;
}
void CFX_CSSStyleSelector::SetUAStyleSheet(
std::unique_ptr<CFX_CSSStyleSheet> pSheet) {
- m_UAStyles = std::move(pSheet);
+ ua_styles_ = std::move(pSheet);
}
void CFX_CSSStyleSelector::UpdateStyleIndex() {
- m_UARules.SetRulesFromSheet(m_UAStyles.get());
+ ua_rules_.SetRulesFromSheet(ua_styles_.get());
}
std::vector<const CFX_CSSDeclaration*> CFX_CSSStyleSelector::MatchDeclarations(
@@ -54,7 +54,7 @@
if (tagname.IsEmpty())
return matchedDecls;
- auto* rules = m_UARules.GetTagRuleData(tagname);
+ auto* rules = ua_rules_.GetTagRuleData(tagname);
if (!rules)
return matchedDecls;
@@ -177,10 +177,10 @@
if (!value_list->values().empty()) {
switch (eProperty) {
case CFX_CSSProperty::FontFamily:
- pComputedStyle->m_InheritedData.m_pFontFamily = std::move(value_list);
+ pComputedStyle->inherited_data_.font_family_ = std::move(value_list);
break;
case CFX_CSSProperty::TextDecoration:
- pComputedStyle->m_NonInheritedData.m_dwTextDecoration =
+ pComputedStyle->non_inherited_data_.text_decoration_ =
ToTextDecoration(value_list);
break;
default:
@@ -193,12 +193,12 @@
switch (eProperty) {
case CFX_CSSProperty::Display:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_NonInheritedData.m_eDisplay =
+ pComputedStyle->non_inherited_data_.display_ =
ToDisplay(pValue.AsRaw<CFX_CSSEnumValue>()->Value());
}
break;
case CFX_CSSProperty::FontSize: {
- float& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize;
+ float& fFontSize = pComputedStyle->inherited_data_.ffont_size_;
if (eType == CFX_CSSValue::PrimitiveType::kNumber) {
fFontSize = pValue.AsRaw<CFX_CSSNumberValue>()->Apply(fFontSize);
} else if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
@@ -210,154 +210,154 @@
if (eType == CFX_CSSValue::PrimitiveType::kNumber) {
RetainPtr<CFX_CSSNumberValue> v = pValue.As<CFX_CSSNumberValue>();
if (v->unit() == CFX_CSSNumber::Unit::kNumber) {
- pComputedStyle->m_InheritedData.m_fLineHeight =
- v->value() * pComputedStyle->m_InheritedData.m_fFontSize;
+ pComputedStyle->inherited_data_.fline_height_ =
+ v->value() * pComputedStyle->inherited_data_.ffont_size_;
} else {
- pComputedStyle->m_InheritedData.m_fLineHeight =
- v->Apply(pComputedStyle->m_InheritedData.m_fFontSize);
+ pComputedStyle->inherited_data_.fline_height_ =
+ v->Apply(pComputedStyle->inherited_data_.ffont_size_);
}
}
break;
case CFX_CSSProperty::TextAlign:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_InheritedData.m_eTextAlign =
+ pComputedStyle->inherited_data_.text_align_ =
ToTextAlign(pValue.AsRaw<CFX_CSSEnumValue>()->Value());
}
break;
case CFX_CSSProperty::TextIndent:
- SetLengthWithPercent(pComputedStyle->m_InheritedData.m_TextIndent, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize);
+ SetLengthWithPercent(pComputedStyle->inherited_data_.text_indent_, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_);
break;
case CFX_CSSProperty::FontWeight:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_InheritedData.m_wFontWeight =
+ pComputedStyle->inherited_data_.wfont_weight_ =
ToFontWeight(pValue.AsRaw<CFX_CSSEnumValue>()->Value());
} else if (eType == CFX_CSSValue::PrimitiveType::kNumber) {
int32_t iValue =
static_cast<int32_t>(pValue.AsRaw<CFX_CSSNumberValue>()->value()) /
100;
if (iValue >= 1 && iValue <= 9) {
- pComputedStyle->m_InheritedData.m_wFontWeight = iValue * 100;
+ pComputedStyle->inherited_data_.wfont_weight_ = iValue * 100;
}
}
break;
case CFX_CSSProperty::FontStyle:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_InheritedData.m_eFontStyle =
+ pComputedStyle->inherited_data_.font_style_ =
ToFontStyle(pValue.AsRaw<CFX_CSSEnumValue>()->Value());
}
break;
case CFX_CSSProperty::Color:
if (eType == CFX_CSSValue::PrimitiveType::kRGB) {
- pComputedStyle->m_InheritedData.m_dwFontColor =
+ pComputedStyle->inherited_data_.font_color_ =
pValue.AsRaw<CFX_CSSColorValue>()->Value();
}
break;
case CFX_CSSProperty::MarginLeft:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_MarginWidth.left, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasMargin = true;
+ pComputedStyle->non_inherited_data_.margin_width_.left, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_margin_ = true;
}
break;
case CFX_CSSProperty::MarginTop:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_MarginWidth.top, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasMargin = true;
+ pComputedStyle->non_inherited_data_.margin_width_.top, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_margin_ = true;
}
break;
case CFX_CSSProperty::MarginRight:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_MarginWidth.right, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasMargin = true;
+ pComputedStyle->non_inherited_data_.margin_width_.right, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_margin_ = true;
}
break;
case CFX_CSSProperty::MarginBottom:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_MarginWidth.bottom, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasMargin = true;
+ pComputedStyle->non_inherited_data_.margin_width_.bottom, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_margin_ = true;
}
break;
case CFX_CSSProperty::PaddingLeft:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_PaddingWidth.left, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasPadding = true;
+ pComputedStyle->non_inherited_data_.padding_width_.left, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_padding_ = true;
}
break;
case CFX_CSSProperty::PaddingTop:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_PaddingWidth.top, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasPadding = true;
+ pComputedStyle->non_inherited_data_.padding_width_.top, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_padding_ = true;
}
break;
case CFX_CSSProperty::PaddingRight:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_PaddingWidth.right, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasPadding = true;
+ pComputedStyle->non_inherited_data_.padding_width_.right, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_padding_ = true;
}
break;
case CFX_CSSProperty::PaddingBottom:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_PaddingWidth.bottom, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasPadding = true;
+ pComputedStyle->non_inherited_data_.padding_width_.bottom, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_padding_ = true;
}
break;
case CFX_CSSProperty::BorderLeftWidth:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_BorderWidth.left, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasBorder = true;
+ pComputedStyle->non_inherited_data_.border_width_.left, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_border_ = true;
}
break;
case CFX_CSSProperty::BorderTopWidth:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_BorderWidth.top, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasBorder = true;
+ pComputedStyle->non_inherited_data_.border_width_.top, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_border_ = true;
}
break;
case CFX_CSSProperty::BorderRightWidth:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_BorderWidth.right, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasBorder = true;
+ pComputedStyle->non_inherited_data_.border_width_.right, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_border_ = true;
}
break;
case CFX_CSSProperty::BorderBottomWidth:
if (SetLengthWithPercent(
- pComputedStyle->m_NonInheritedData.m_BorderWidth.bottom, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize)) {
- pComputedStyle->m_NonInheritedData.m_bHasBorder = true;
+ pComputedStyle->non_inherited_data_.border_width_.bottom, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_)) {
+ pComputedStyle->non_inherited_data_.has_border_ = true;
}
break;
case CFX_CSSProperty::VerticalAlign:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_NonInheritedData.m_eVerticalAlignType =
+ pComputedStyle->non_inherited_data_.vertical_align_type_ =
ToVerticalAlign(pValue.AsRaw<CFX_CSSEnumValue>()->Value());
} else if (eType == CFX_CSSValue::PrimitiveType::kNumber) {
- pComputedStyle->m_NonInheritedData.m_eVerticalAlignType =
+ pComputedStyle->non_inherited_data_.vertical_align_type_ =
CFX_CSSVerticalAlign::Number;
- pComputedStyle->m_NonInheritedData.m_fVerticalAlign =
+ pComputedStyle->non_inherited_data_.vertical_align_ =
pValue.AsRaw<CFX_CSSNumberValue>()->Apply(
- pComputedStyle->m_InheritedData.m_fFontSize);
+ pComputedStyle->inherited_data_.ffont_size_);
}
break;
case CFX_CSSProperty::FontVariant:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_InheritedData.m_eFontVariant =
+ pComputedStyle->inherited_data_.font_variant_ =
ToFontVariant(pValue.AsRaw<CFX_CSSEnumValue>()->Value());
}
break;
case CFX_CSSProperty::LetterSpacing:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_InheritedData.m_LetterSpacing.Set(
+ pComputedStyle->inherited_data_.letter_spacing_.Set(
CFX_CSSLengthUnit::Normal);
} else if (eType == CFX_CSSValue::PrimitiveType::kNumber) {
if (pValue.AsRaw<CFX_CSSNumberValue>()->unit() ==
@@ -365,40 +365,40 @@
break;
}
- SetLengthWithPercent(pComputedStyle->m_InheritedData.m_LetterSpacing,
+ SetLengthWithPercent(pComputedStyle->inherited_data_.letter_spacing_,
eType, pValue,
- pComputedStyle->m_InheritedData.m_fFontSize);
+ pComputedStyle->inherited_data_.ffont_size_);
}
break;
case CFX_CSSProperty::WordSpacing:
if (eType == CFX_CSSValue::PrimitiveType::kEnum) {
- pComputedStyle->m_InheritedData.m_WordSpacing.Set(
+ pComputedStyle->inherited_data_.word_spacing_.Set(
CFX_CSSLengthUnit::Normal);
} else if (eType == CFX_CSSValue::PrimitiveType::kNumber) {
if (pValue.AsRaw<CFX_CSSNumberValue>()->unit() ==
CFX_CSSNumber::Unit::kPercent) {
break;
}
- SetLengthWithPercent(pComputedStyle->m_InheritedData.m_WordSpacing,
+ SetLengthWithPercent(pComputedStyle->inherited_data_.word_spacing_,
eType, pValue,
- pComputedStyle->m_InheritedData.m_fFontSize);
+ pComputedStyle->inherited_data_.ffont_size_);
}
break;
case CFX_CSSProperty::Top:
- SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Top, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize);
+ SetLengthWithPercent(pComputedStyle->non_inherited_data_.top_, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_);
break;
case CFX_CSSProperty::Bottom:
- SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Bottom, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize);
+ SetLengthWithPercent(pComputedStyle->non_inherited_data_.bottom_, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_);
break;
case CFX_CSSProperty::Left:
- SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Left, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize);
+ SetLengthWithPercent(pComputedStyle->non_inherited_data_.left_, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_);
break;
case CFX_CSSProperty::Right:
- SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Right, eType,
- pValue, pComputedStyle->m_InheritedData.m_fFontSize);
+ SetLengthWithPercent(pComputedStyle->non_inherited_data_.right_, eType,
+ pValue, pComputedStyle->inherited_data_.ffont_size_);
break;
default:
break;
@@ -507,19 +507,19 @@
float fCurFontSize) {
switch (eValue) {
case CFX_CSSPropertyValue::XxSmall:
- return m_fDefaultFontSize / 1.2f / 1.2f / 1.2f;
+ return default_font_size_ / 1.2f / 1.2f / 1.2f;
case CFX_CSSPropertyValue::XSmall:
- return m_fDefaultFontSize / 1.2f / 1.2f;
+ return default_font_size_ / 1.2f / 1.2f;
case CFX_CSSPropertyValue::Small:
- return m_fDefaultFontSize / 1.2f;
+ return default_font_size_ / 1.2f;
case CFX_CSSPropertyValue::Medium:
- return m_fDefaultFontSize;
+ return default_font_size_;
case CFX_CSSPropertyValue::Large:
- return m_fDefaultFontSize * 1.2f;
+ return default_font_size_ * 1.2f;
case CFX_CSSPropertyValue::XLarge:
- return m_fDefaultFontSize * 1.2f * 1.2f;
+ return default_font_size_ * 1.2f * 1.2f;
case CFX_CSSPropertyValue::XxLarge:
- return m_fDefaultFontSize * 1.2f * 1.2f * 1.2f;
+ return default_font_size_ * 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 7ff694f..6a41684 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.h
+++ b/core/fxcrt/css/cfx_cssstyleselector.h
@@ -79,9 +79,9 @@
const RetainPtr<CFX_CSSValueList>& pList);
CFX_CSSFontVariant ToFontVariant(CFX_CSSPropertyValue eValue);
- float m_fDefaultFontSize = 12.0f;
- std::unique_ptr<CFX_CSSStyleSheet> m_UAStyles;
- CFX_CSSRuleCollection m_UARules;
+ float default_font_size_ = 12.0f;
+ std::unique_ptr<CFX_CSSStyleSheet> ua_styles_;
+ CFX_CSSRuleCollection ua_rules_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSSTYLESELECTOR_H_
diff --git a/core/fxcrt/css/cfx_cssstylesheet.cpp b/core/fxcrt/css/cfx_cssstylesheet.cpp
index b888311..bddc71e 100644
--- a/core/fxcrt/css/cfx_cssstylesheet.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet.cpp
@@ -18,15 +18,15 @@
CFX_CSSStyleSheet::~CFX_CSSStyleSheet() = default;
size_t CFX_CSSStyleSheet::CountRules() const {
- return m_RuleArray.size();
+ return rule_array_.size();
}
CFX_CSSStyleRule* CFX_CSSStyleSheet::GetRule(size_t index) const {
- return m_RuleArray[index].get();
+ return rule_array_[index].get();
}
bool CFX_CSSStyleSheet::LoadBuffer(WideStringView buffer) {
- m_RuleArray.clear();
+ rule_array_.clear();
auto pSyntax = std::make_unique<CFX_CSSSyntaxParser>(buffer);
while (true) {
CFX_CSSSyntaxParser::Status eStatus = pSyntax->DoSyntaxParse();
@@ -81,7 +81,7 @@
auto rule = std::make_unique<CFX_CSSStyleRule>();
pStyleRule = rule.get();
pStyleRule->SetSelector(&selectors);
- m_RuleArray.push_back(std::move(rule));
+ rule_array_.push_back(std::move(rule));
} else {
SkipRuleSet(pSyntax);
return CFX_CSSSyntaxParser::Status::kNone;
@@ -90,7 +90,7 @@
}
case CFX_CSSSyntaxParser::Status::kDeclClose: {
if (pStyleRule && pStyleRule->GetDeclaration()->empty()) {
- m_RuleArray.pop_back();
+ rule_array_.pop_back();
pStyleRule = nullptr;
}
return CFX_CSSSyntaxParser::Status::kNone;
diff --git a/core/fxcrt/css/cfx_cssstylesheet.h b/core/fxcrt/css/cfx_cssstylesheet.h
index 392877e..654b476 100644
--- a/core/fxcrt/css/cfx_cssstylesheet.h
+++ b/core/fxcrt/css/cfx_cssstylesheet.h
@@ -28,7 +28,7 @@
CFX_CSSSyntaxParser::Status LoadStyleRule(CFX_CSSSyntaxParser* pSyntax);
void SkipRuleSet(CFX_CSSSyntaxParser* pSyntax);
- std::vector<std::unique_ptr<CFX_CSSStyleRule>> m_RuleArray;
+ std::vector<std::unique_ptr<CFX_CSSStyleRule>> rule_array_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSSTYLESHEET_H_
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index e5a4d41..a32309a 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -20,42 +20,43 @@
} // namespace
-CFX_CSSSyntaxParser::CFX_CSSSyntaxParser(WideStringView str) : m_Input(str) {}
+CFX_CSSSyntaxParser::CFX_CSSSyntaxParser(WideStringView str) : input_(str) {}
CFX_CSSSyntaxParser::~CFX_CSSSyntaxParser() = default;
void CFX_CSSSyntaxParser::SetParseOnlyDeclarations() {
- m_eMode = Mode::kPropertyName;
+ mode_ = Mode::kPropertyName;
}
CFX_CSSSyntaxParser::Status CFX_CSSSyntaxParser::DoSyntaxParse() {
- m_Output.Clear();
- if (m_bHasError)
+ output_.Clear();
+ if (has_error_) {
return Status::kError;
+ }
- while (!m_Input.IsEOF()) {
- wchar_t wch = m_Input.GetChar();
- switch (m_eMode) {
+ while (!input_.IsEOF()) {
+ wchar_t wch = input_.GetChar();
+ switch (mode_) {
case Mode::kRuleSet:
switch (wch) {
case '}':
- m_bHasError = true;
+ has_error_ = true;
return Status::kError;
case '/':
- if (m_Input.GetNextChar() == '*') {
+ if (input_.GetNextChar() == '*') {
SaveMode(Mode::kRuleSet);
- m_eMode = Mode::kComment;
+ mode_ = Mode::kComment;
break;
}
[[fallthrough]];
default:
if (wch <= ' ') {
- m_Input.MoveNext();
+ input_.MoveNext();
} else if (IsSelectorStart(wch)) {
- m_eMode = Mode::kSelector;
+ mode_ = Mode::kSelector;
return Status::kStyleRule;
} else {
- m_bHasError = true;
+ has_error_ = true;
return Status::kError;
}
break;
@@ -64,112 +65,118 @@
case Mode::kSelector:
switch (wch) {
case ',':
- m_Input.MoveNext();
- if (!m_Output.IsEmpty())
+ input_.MoveNext();
+ if (!output_.IsEmpty()) {
return Status::kSelector;
+ }
break;
case '{':
- if (!m_Output.IsEmpty())
+ if (!output_.IsEmpty()) {
return Status::kSelector;
- m_Input.MoveNext();
+ }
+ input_.MoveNext();
SaveMode(Mode::kRuleSet); // Back to validate ruleset again.
- m_eMode = Mode::kPropertyName;
+ mode_ = Mode::kPropertyName;
return Status::kDeclOpen;
case '/':
- if (m_Input.GetNextChar() == '*') {
+ if (input_.GetNextChar() == '*') {
SaveMode(Mode::kSelector);
- m_eMode = Mode::kComment;
- if (!m_Output.IsEmpty())
+ mode_ = Mode::kComment;
+ if (!output_.IsEmpty()) {
return Status::kSelector;
+ }
break;
}
[[fallthrough]];
default:
- m_Output.AppendCharIfNotLeadingBlank(wch);
- m_Input.MoveNext();
+ output_.AppendCharIfNotLeadingBlank(wch);
+ input_.MoveNext();
break;
}
break;
case Mode::kPropertyName:
switch (wch) {
case ':':
- m_Input.MoveNext();
- m_eMode = Mode::kPropertyValue;
+ input_.MoveNext();
+ mode_ = Mode::kPropertyValue;
return Status::kPropertyName;
case '}':
- m_Input.MoveNext();
+ input_.MoveNext();
if (!RestoreMode())
return Status::kError;
return Status::kDeclClose;
case '/':
- if (m_Input.GetNextChar() == '*') {
+ if (input_.GetNextChar() == '*') {
SaveMode(Mode::kPropertyName);
- m_eMode = Mode::kComment;
- if (!m_Output.IsEmpty())
+ mode_ = Mode::kComment;
+ if (!output_.IsEmpty()) {
return Status::kPropertyName;
+ }
break;
}
[[fallthrough]];
default:
- m_Output.AppendCharIfNotLeadingBlank(wch);
- m_Input.MoveNext();
+ output_.AppendCharIfNotLeadingBlank(wch);
+ input_.MoveNext();
break;
}
break;
case Mode::kPropertyValue:
switch (wch) {
case ';':
- m_Input.MoveNext();
+ input_.MoveNext();
[[fallthrough]];
case '}':
- m_eMode = Mode::kPropertyName;
+ mode_ = Mode::kPropertyName;
return Status::kPropertyValue;
case '/':
- if (m_Input.GetNextChar() == '*') {
+ if (input_.GetNextChar() == '*') {
SaveMode(Mode::kPropertyValue);
- m_eMode = Mode::kComment;
- if (!m_Output.IsEmpty())
+ mode_ = Mode::kComment;
+ if (!output_.IsEmpty()) {
return Status::kPropertyValue;
+ }
break;
}
[[fallthrough]];
default:
- m_Output.AppendCharIfNotLeadingBlank(wch);
- m_Input.MoveNext();
+ output_.AppendCharIfNotLeadingBlank(wch);
+ input_.MoveNext();
break;
}
break;
case Mode::kComment:
- if (wch == '*' && m_Input.GetNextChar() == '/') {
+ if (wch == '*' && input_.GetNextChar() == '/') {
if (!RestoreMode())
return Status::kError;
- m_Input.MoveNext();
+ input_.MoveNext();
}
- m_Input.MoveNext();
+ input_.MoveNext();
break;
}
}
- if (m_eMode == Mode::kPropertyValue && !m_Output.IsEmpty())
+ if (mode_ == Mode::kPropertyValue && !output_.IsEmpty()) {
return Status::kPropertyValue;
+ }
return Status::kEOS;
}
void CFX_CSSSyntaxParser::SaveMode(Mode mode) {
- m_ModeStack.push(mode);
+ mode_stack_.push(mode);
}
bool CFX_CSSSyntaxParser::RestoreMode() {
- if (m_ModeStack.empty()) {
- m_bHasError = true;
+ if (mode_stack_.empty()) {
+ has_error_ = true;
return false;
}
- m_eMode = m_ModeStack.top();
- m_ModeStack.pop();
+ mode_ = mode_stack_.top();
+ mode_stack_.pop();
return true;
}
WideStringView CFX_CSSSyntaxParser::GetCurrentString() const {
- return m_Output.GetTrailingBlankTrimmedString();
+ return output_.GetTrailingBlankTrimmedString();
}
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.h b/core/fxcrt/css/cfx_csssyntaxparser.h
index 1f66f30..b39c8c2 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.h
+++ b/core/fxcrt/css/cfx_csssyntaxparser.h
@@ -46,11 +46,11 @@
void SaveMode(Mode eMode);
bool RestoreMode();
- bool m_bHasError = false;
- Mode m_eMode = Mode::kRuleSet;
- CFX_CSSOutputTextBuf m_Output;
- CFX_CSSInputTextBuf m_Input;
- std::stack<Mode> m_ModeStack;
+ bool has_error_ = false;
+ Mode mode_ = Mode::kRuleSet;
+ CFX_CSSOutputTextBuf output_;
+ CFX_CSSInputTextBuf input_;
+ std::stack<Mode> mode_stack_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSSYNTAXPARSER_H_
diff --git a/core/fxcrt/css/cfx_cssvalue.cpp b/core/fxcrt/css/cfx_cssvalue.cpp
index 9e22437..f133dc8 100644
--- a/core/fxcrt/css/cfx_cssvalue.cpp
+++ b/core/fxcrt/css/cfx_cssvalue.cpp
@@ -6,6 +6,6 @@
#include "core/fxcrt/css/cfx_cssvalue.h"
-CFX_CSSValue::CFX_CSSValue(PrimitiveType type) : m_value(type) {}
+CFX_CSSValue::CFX_CSSValue(PrimitiveType type) : value_(type) {}
CFX_CSSValue::~CFX_CSSValue() = default;
diff --git a/core/fxcrt/css/cfx_cssvalue.h b/core/fxcrt/css/cfx_cssvalue.h
index ccb8bbe..90bbf89 100644
--- a/core/fxcrt/css/cfx_cssvalue.h
+++ b/core/fxcrt/css/cfx_cssvalue.h
@@ -22,14 +22,14 @@
kList,
};
- PrimitiveType GetType() const { return m_value; }
+ PrimitiveType GetType() const { return value_; }
protected:
explicit CFX_CSSValue(PrimitiveType type);
~CFX_CSSValue() override;
private:
- const PrimitiveType m_value;
+ const PrimitiveType value_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSVALUE_H_
diff --git a/core/fxcrt/css/cfx_cssvaluelistparser.cpp b/core/fxcrt/css/cfx_cssvaluelistparser.cpp
index 4fcd7be..0669115 100644
--- a/core/fxcrt/css/cfx_cssvaluelistparser.cpp
+++ b/core/fxcrt/css/cfx_cssvaluelistparser.cpp
@@ -14,7 +14,7 @@
CFX_CSSValueListParser::CFX_CSSValueListParser(WideStringView list,
wchar_t separator)
- : m_Cur(list), m_Separator(separator) {
+ : cur_(list), separator_(separator) {
DCHECK(CharsRemain());
}
@@ -23,14 +23,14 @@
std::optional<CFX_CSSValueListParser::Result>
CFX_CSSValueListParser::NextValue() {
while (CharsRemain() &&
- (CurrentChar() <= ' ' || CurrentChar() == m_Separator)) {
+ (CurrentChar() <= ' ' || CurrentChar() == separator_)) {
Advance();
}
if (!CharsRemain()) {
return std::nullopt;
}
auto eType = CFX_CSSValue::PrimitiveType::kUnknown;
- WideStringView start = m_Cur;
+ WideStringView start = cur_;
size_t nLength = 0;
wchar_t wch = CurrentChar();
if (wch == '#') {
@@ -41,7 +41,7 @@
} else if (FXSYS_IsDecimalDigit(wch) || wch == '.' || wch == '-' ||
wch == '+') {
while (CharsRemain() &&
- (CurrentChar() > ' ' && CurrentChar() != m_Separator)) {
+ (CurrentChar() > ' ' && CurrentChar() != separator_)) {
++nLength;
Advance();
}
@@ -52,13 +52,12 @@
nLength = SkipToChar(wch);
Advance();
eType = CFX_CSSValue::PrimitiveType::kString;
- } else if (m_Cur.First(4).EqualsASCIINoCase(
- "rgb(")) { // First() always safe.
+ } else if (cur_.First(4).EqualsASCIINoCase("rgb(")) { // First() always safe.
nLength = SkipToChar(')') + 1;
Advance();
eType = CFX_CSSValue::PrimitiveType::kRGB;
} else {
- nLength = SkipToCharMatchingParens(m_Separator);
+ nLength = SkipToCharMatchingParens(separator_);
eType = CFX_CSSValue::PrimitiveType::kString;
}
if (nLength == 0) {
diff --git a/core/fxcrt/css/cfx_cssvaluelistparser.h b/core/fxcrt/css/cfx_cssvaluelistparser.h
index 2673520..934b48d 100644
--- a/core/fxcrt/css/cfx_cssvaluelistparser.h
+++ b/core/fxcrt/css/cfx_cssvaluelistparser.h
@@ -25,22 +25,22 @@
~CFX_CSSValueListParser();
std::optional<Result> NextValue();
- void UseCommaSeparator() { m_Separator = ','; }
+ void UseCommaSeparator() { separator_ = ','; }
private:
- bool CharsRemain() const { return !m_Cur.IsEmpty(); }
+ bool CharsRemain() const { return !cur_.IsEmpty(); }
// Safe to call even when input exhausted, stays unchanged.
- void Advance() { m_Cur = m_Cur.Substr(1); }
+ void Advance() { cur_ = cur_.Substr(1); }
// Safe to call even when input exhausted, returns NUL.
- wchar_t CurrentChar() const { return static_cast<wchar_t>(m_Cur.Front()); }
+ wchar_t CurrentChar() const { return static_cast<wchar_t>(cur_.Front()); }
size_t SkipToChar(wchar_t wch);
size_t SkipToCharMatchingParens(wchar_t wch);
- WideStringView m_Cur;
- wchar_t m_Separator;
+ WideStringView cur_;
+ wchar_t separator_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSVALUELISTPARSER_H_