fix(css-parser): don't save unusable rules to RAM (#2604)

This commit is contained in:
Phạm Bình An authored and GitHub committed 2026-07-14 17:00:13 +03:00
1 parent 94ae750e89
commit e84840b473
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -431,6 +431,11 @@ CssStyle CssParser::parseDeclarations(std::string_view declBlock) {
// Rule processing
void CssParser::processRuleBlockWithStyle(std::string_view selectorGroup, const CssStyle& style) {
// Skip rules that don't define any supported properties to save RAM.
if (!style.defined.anySet()) {
return;
}
// Check if we've reached the rule limit before processing
if (rulesBySelector_.size() >= MAX_RULES) {
LOG_DBG("CSS", "Reached max rules limit (%zu), stopping CSS parsing", MAX_RULES);
+1 -1
View File
@@ -33,7 +33,7 @@
class CssParser {
public:
// Bump when CSS cache format or rules change; section caches are invalidated when this changes
static constexpr uint8_t CSS_CACHE_VERSION = 7;
static constexpr uint8_t CSS_CACHE_VERSION = 8;
explicit CssParser(std::string cachePath) : cachePath(std::move(cachePath)) {}
~CssParser() = default;