| Index: compiled/filter/RegExpFilter.h |
| =================================================================== |
| --- a/compiled/filter/RegExpFilter.h |
| +++ b/compiled/filter/RegExpFilter.h |
| @@ -21,39 +21,30 @@ |
| #include "ActiveFilter.h" |
| #include "../bindings/runtime.h" |
| enum class TrippleState {YES, NO, ANY}; |
| struct RegExpFilterData |
| { |
| mutable String::size_type mPatternStart; |
| - union |
| - { |
| - mutable int mRegexpId; |
| - mutable String::size_type mPatternEnd; |
| - }; |
|
Wladimir Palant
2017/10/17 12:51:21
The matcher might need to access the pattern part
|
| + mutable String::size_type mPatternEnd; |
| + mutable int mRegexpId; |
| mutable String::size_type mDomainsStart; |
| mutable String::size_type mDomainsEnd; |
| mutable String::size_type mSitekeysStart; |
| mutable String::size_type mSitekeysEnd; |
| int mContentType; |
| bool mMatchCase; |
| TrippleState mThirdParty; |
| TrippleState mCollapse; |
| bool RegExpParsingDone() const |
| { |
| - return mPatternStart == String::npos; |
| - } |
| - |
| - void SetRegExp(int regexpId) const |
| - { |
| - mRegexpId = regexpId; |
| - mPatternStart = String::npos; |
| + return mRegexpId >= 0; |
| } |
| bool HasRegExp() const |
| { |
| return RegExpParsingDone() && mRegexpId; |
| } |
| const DependentString GetRegExpSource(const String& text) const |
| @@ -106,11 +97,15 @@ public: |
| static constexpr Type classType = Type::REGEXP; |
| explicit RegExpFilter(Type type, const String& text, const RegExpFilterData& data); |
| ~RegExpFilter(); |
| static Type Parse(DependentString& text, DependentString& error, |
| RegExpFilterData& data); |
| static void GenerateCustomBindings(); |
| bool BINDINGS_EXPORTED Matches(const String& location, int typeMask, |
| DependentString& docDomain, bool thirdParty, const String& sitekey) const; |
| + const DependentString GetRegExpSource() const |
| + { |
| + return mData.GetRegExpSource(mText); |
| + } |
| }; |
| typedef intrusive_ptr<RegExpFilter> RegExpFilterPtr; |