1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

AdBlock: Add support for parsing CSS Element hiding exceptions

Those rules are however not supported at the moment.
This commit is contained in:
David Rosca 2014-09-16 00:35:32 +02:00
parent 6dcf8c598a
commit ed866dc9a4

View File

@ -374,9 +374,9 @@ void AdBlockRule::parseFilter()
}
// CSS Element hiding rule
if (parsedLine.contains(QL1S("##"))) {
if (parsedLine.contains(QL1S("##")) || parsedLine.contains(QL1S("#@#"))) {
m_type = CssRule;
int pos = parsedLine.indexOf(QL1S("##"));
int pos = parsedLine.indexOf(QL1C('#'));
// Domain restricted rule
if (!parsedLine.startsWith(QL1S("##"))) {
@ -384,7 +384,15 @@ void AdBlockRule::parseFilter()
parseDomains(domains, QL1C(','));
}
m_matchString = parsedLine.mid(pos + 2);
m_isException = parsedLine.at(pos + 1) == QL1C('@');
m_matchString = parsedLine.mid(m_isException ? pos + 3 : pos + 2);
// CSS Element hiding exceptions not supported for now
if (m_isException) {
m_isInternalDisabled = true;
m_type = Invalid;
return;
}
// CSS rule cannot have more options -> stop parsing
return;