OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 { | 211 { |
212 data.mSitekeysStart = valueStart; | 212 data.mSitekeysStart = valueStart; |
213 data.mSitekeysEnd = valueEnd; | 213 data.mSitekeysEnd = valueEnd; |
214 } | 214 } |
215 } | 215 } |
216 else if (name.equals(u"match-case"_str)) | 216 else if (name.equals(u"match-case"_str)) |
217 data.mMatchCase = !reverse; | 217 data.mMatchCase = !reverse; |
218 else if (name.equals(u"third-party"_str)) | 218 else if (name.equals(u"third-party"_str)) |
219 data.mThirdParty = reverse ? TrippleState::NO : TrippleState::YES; | 219 data.mThirdParty = reverse ? TrippleState::NO : TrippleState::YES; |
220 else if (name.equals(u"collapse"_str)) | 220 else if (name.equals(u"collapse"_str)) |
221 data.mCollapse = reverse ? TrippleState::NO : TrippleState::YES; | 221 data.mCollapse = !reverse; |
222 else | 222 else |
223 error.reset(u"filter_unknown_option"_str); | 223 error.reset(u"filter_unknown_option"_str); |
224 } | 224 } |
225 | 225 |
226 void ParseOptions(String& text, DependentString& error, RegExpFilterData& data
, | 226 void ParseOptions(String& text, DependentString& error, RegExpFilterData& data
, |
227 String::size_type optionsStart) | 227 String::size_type optionsStart) |
228 { | 228 { |
229 data.mMatchCase = false; | 229 data.mMatchCase = false; |
230 data.mThirdParty = TrippleState::ANY; | 230 data.mThirdParty = TrippleState::ANY; |
231 data.mCollapse = TrippleState::ANY; | 231 data.mCollapse = true; |
232 data.mDomainsStart = String::npos; | 232 data.mDomainsStart = String::npos; |
233 data.mSitekeysStart = String::npos; | 233 data.mSitekeysStart = String::npos; |
234 if (optionsStart >= text.length()) | 234 if (optionsStart >= text.length()) |
235 { | 235 { |
236 data.mContentType = defaultTypeMask; | 236 data.mContentType = defaultTypeMask; |
237 return; | 237 return; |
238 } | 238 } |
239 | 239 |
240 data.mContentType = -1; | 240 data.mContentType = -1; |
241 | 241 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return false; | 388 return false; |
389 } | 389 } |
390 | 390 |
391 if (!mData.RegExpParsingDone()) | 391 if (!mData.RegExpParsingDone()) |
392 { | 392 { |
393 const OwnedString pattern(mData.GetRegExpSource(mText)); | 393 const OwnedString pattern(mData.GetRegExpSource(mText)); |
394 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
; | 394 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
; |
395 } | 395 } |
396 return TestRegExp(mData.mRegexpId, location); | 396 return TestRegExp(mData.mRegexpId, location); |
397 } | 397 } |
OLD | NEW |