diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-08-19 15:21:36 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-08-19 15:21:36 +0200 |
commit | a3f4b43ff806c3dab1f2410d6dc5017c6a05accb (patch) | |
tree | 7beab7f7433064692ace51fea3c81dd18e173478 /src/adblock/adblockruletextmatchimpl.cpp | |
parent | BookmarkOwner class clean-up (diff) | |
parent | Skip the hiding rules specific to domains (diff) | |
download | rekonq-a3f4b43ff806c3dab1f2410d6dc5017c6a05accb.tar.xz |
Merge commit 'refs/merge-requests/179' of git://gitorious.org/rekonq/mainline into m179
Diffstat (limited to 'src/adblock/adblockruletextmatchimpl.cpp')
-rw-r--r-- | src/adblock/adblockruletextmatchimpl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/adblock/adblockruletextmatchimpl.cpp b/src/adblock/adblockruletextmatchimpl.cpp index 7c02ea37..892d78e0 100644 --- a/src/adblock/adblockruletextmatchimpl.cpp +++ b/src/adblock/adblockruletextmatchimpl.cpp @@ -34,13 +34,18 @@ AdBlockRuleTextMatchImpl::AdBlockRuleTextMatchImpl(const QString &filter) { Q_ASSERT(AdBlockRuleTextMatchImpl::isTextMatchFilter(filter)); - m_textToMatch = filter; + m_textToMatch = filter.toLower(); m_textToMatch.remove(QL1C('*')); } -bool AdBlockRuleTextMatchImpl::match(const QString &encodedUrl) const +bool AdBlockRuleTextMatchImpl::match(const QString &encodedUrl, const QString &encodedUrlLowerCase) const { - return encodedUrl.contains(m_textToMatch, Qt::CaseInsensitive); + Q_UNUSED(encodedUrl); + // Case sensitive compare is faster, but would be incorrect with encodedUrl since + // we do want case insensitive. + // What we do is work on a lowercase version of m_textToMatch, and compare to the lowercase + // version of encodedUrl. + return encodedUrlLowerCase.contains(m_textToMatch, Qt::CaseSensitive); } bool AdBlockRuleTextMatchImpl::isTextMatchFilter(const QString &filter) |