Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/AdblockPlusDomTraverser.cpp

Issue 5316782940225536: Issue 1557 - Update to the recent libadblockplus to reduce additional updates in the logic later. (Closed)
Patch Set: rebase and remove member of CFilter Created Feb. 4, 2015, 12:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/AdblockPlusClient.cpp ('k') | src/plugin/PluginFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 16 matching lines...) Expand all
27 CPluginDomTraverser::CPluginDomTraverser(CPluginTab* tab) : CPluginDomTraverserB ase(tab) 27 CPluginDomTraverser::CPluginDomTraverser(CPluginTab* tab) : CPluginDomTraverserB ase(tab)
28 { 28 {
29 } 29 }
30 30
31 31
32 bool CPluginDomTraverser::OnIFrame(IHTMLElement* pEl, const std::wstring& url, C String& indent) 32 bool CPluginDomTraverser::OnIFrame(IHTMLElement* pEl, const std::wstring& url, C String& indent)
33 { 33 {
34 CPluginClient* client = CPluginClient::GetInstance(); 34 CPluginClient* client = CPluginClient::GetInstance();
35 35
36 // If src should be blocked, set style display:none on iframe 36 // If src should be blocked, set style display:none on iframe
37 bool isBlocked = client->ShouldBlock(url, CFilter::contentTypeSubdocument, m_d omain); 37 bool isBlocked = client->ShouldBlock(url,
38 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT, m_domain);
38 if (isBlocked) 39 if (isBlocked)
39 { 40 {
40 HideElement(pEl, "iframe", url, true, indent); 41 HideElement(pEl, "iframe", url, true, indent);
41 } 42 }
42 43
43 return !isBlocked; 44 return !isBlocked;
44 } 45 }
45 46
46 47
47 bool CPluginDomTraverser::OnElement(IHTMLElement* pEl, const CString& tag, CPlug inDomTraverserCache* cache, bool isDebug, CString& indent) 48 bool CPluginDomTraverser::OnElement(IHTMLElement* pEl, const CString& tag, CPlug inDomTraverserCache* cache, bool isDebug, CString& indent)
(...skipping 17 matching lines...) Expand all
65 if (tag == "img") 66 if (tag == "img")
66 { 67 {
67 CComVariant vAttr; 68 CComVariant vAttr;
68 69
69 if (SUCCEEDED(pEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr. vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) 70 if (SUCCEEDED(pEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr. vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0)
70 { 71 {
71 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal)); 72 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal));
72 UnescapeUrl(src); 73 UnescapeUrl(src);
73 74
74 // If src should be blocked, set style display:none on image 75 // If src should be blocked, set style display:none on image
75 cache->m_isHidden = client->ShouldBlock(src, CFilter::contentTypeImage, m_ domain); 76 cache->m_isHidden = client->ShouldBlock(src,
77 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_IMAGE, m_domain);
76 if (cache->m_isHidden) 78 if (cache->m_isHidden)
77 { 79 {
78 HideElement(pEl, "image", src, true, indent); 80 HideElement(pEl, "image", src, true, indent);
79 return false; 81 return false;
80 } 82 }
81 } 83 }
82 } 84 }
83 // Objects 85 // Objects
84 else if (tag == "object") 86 else if (tag == "object")
85 { 87 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 154
153 #ifdef ENABLE_DEBUG_RESULT 155 #ifdef ENABLE_DEBUG_RESULT
154 if (isDebug) 156 if (isDebug)
155 { 157 {
156 CPluginDebug::DebugResultHiding(type, ToCString(url), "-"); 158 CPluginDebug::DebugResultHiding(type, ToCString(url), "-");
157 } 159 }
158 #endif // ENABLE_DEBUG_RESULT 160 #endif // ENABLE_DEBUG_RESULT
159 } 161 }
160 } 162 }
161 } 163 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlusClient.cpp ('k') | src/plugin/PluginFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld