Remove CFX_CSSRuleCollection::m_iSelectors
Redundant int member tracking vector size that could be too small
vis-a-vis size_t.
Change-Id: Id246f4ad100d2b3bc2b4b4aed589a263755f4c1b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93090
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/css/cfx_cssrulecollection.cpp b/core/fxcrt/css/cfx_cssrulecollection.cpp
index a2a3f2d..b8c96cd 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.cpp
+++ b/core/fxcrt/css/cfx_cssrulecollection.cpp
@@ -23,7 +23,6 @@
void CFX_CSSRuleCollection::Clear() {
m_TagRules.clear();
- m_iSelectors = 0;
}
const std::vector<std::unique_ptr<CFX_CSSRuleCollection::Data>>*
@@ -45,7 +44,6 @@
CFX_CSSSelector* pSelector = pStyleRule->GetSelectorList(i);
m_TagRules[pSelector->name_hash()].push_back(
std::make_unique<Data>(pSelector, pDeclaration));
- m_iSelectors++;
}
}
diff --git a/core/fxcrt/css/cfx_cssrulecollection.h b/core/fxcrt/css/cfx_cssrulecollection.h
index e870d11..e63edd7 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.h
+++ b/core/fxcrt/css/cfx_cssrulecollection.h
@@ -31,9 +31,9 @@
CFX_CSSRuleCollection();
~CFX_CSSRuleCollection();
+ bool IsEmpty() const { return m_TagRules.empty(); }
void AddRulesFrom(const CFX_CSSStyleSheet* sheet);
void Clear();
- int32_t CountSelectors() const { return m_iSelectors; }
const std::vector<std::unique_ptr<Data>>* GetTagRuleData(
const WideString& tagname) const;
@@ -43,7 +43,6 @@
CFX_CSSStyleRule* pRule);
std::map<uint32_t, std::vector<std::unique_ptr<Data>>> m_TagRules;
- int32_t m_iSelectors = 0;
};
#endif // CORE_FXCRT_CSS_CFX_CSSRULECOLLECTION_H_
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index 3237b51..e477b9e 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -53,7 +53,7 @@
std::vector<const CFX_CSSDeclaration*> CFX_CSSStyleSelector::MatchDeclarations(
const WideString& tagname) {
std::vector<const CFX_CSSDeclaration*> matchedDecls;
- if (m_UARules.CountSelectors() == 0 || tagname.IsEmpty())
+ if (m_UARules.IsEmpty() || tagname.IsEmpty())
return matchedDecls;
auto* rules = m_UARules.GetTagRuleData(tagname);