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-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 15 matching lines...) Expand all Loading... |
26 { | 26 { |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 bool CPluginDomTraverser::OnIFrame(IHTMLElement* pEl, const std::wstring& url, C
String& indent) | 30 bool CPluginDomTraverser::OnIFrame(IHTMLElement* pEl, const std::wstring& url, C
String& indent) |
31 { | 31 { |
32 CPluginClient* client = CPluginClient::GetInstance(); | 32 CPluginClient* client = CPluginClient::GetInstance(); |
33 | 33 |
34 // If src should be blocked, set style display:none on iframe | 34 // If src should be blocked, set style display:none on iframe |
35 bool isBlocked = client->ShouldBlock(url, | 35 bool isBlocked = client->ShouldBlock(url, |
36 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT, m_domain); | 36 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT, m_document
Url); |
37 if (isBlocked) | 37 if (isBlocked) |
38 { | 38 { |
39 HideElement(pEl, "iframe", url, true, indent); | 39 HideElement(pEl, "iframe", url, true, indent); |
40 } | 40 } |
41 | 41 |
42 return !isBlocked; | 42 return !isBlocked; |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 bool CPluginDomTraverser::OnElement(IHTMLElement* pEl, const CString& tag, CPlug
inDomTraverserCache* cache, bool isDebug, CString& indent) | 46 bool CPluginDomTraverser::OnElement(IHTMLElement* pEl, const CString& tag, CPlug
inDomTraverserCache* cache, bool isDebug, CString& indent) |
(...skipping 17 matching lines...) Expand all Loading... |
64 if (tag == "img") | 64 if (tag == "img") |
65 { | 65 { |
66 CComVariant vAttr; | 66 CComVariant vAttr; |
67 | 67 |
68 if (SUCCEEDED(pEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr.
vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) | 68 if (SUCCEEDED(pEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr.
vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) |
69 { | 69 { |
70 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal)); | 70 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal)); |
71 | 71 |
72 // If src should be blocked, set style display:none on image | 72 // If src should be blocked, set style display:none on image |
73 cache->m_isHidden = client->ShouldBlock(src, | 73 cache->m_isHidden = client->ShouldBlock(src, |
74 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_IMAGE, m_domain); | 74 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_IMAGE, m_documentUr
l); |
75 if (cache->m_isHidden) | 75 if (cache->m_isHidden) |
76 { | 76 { |
77 HideElement(pEl, "image", src, true, indent); | 77 HideElement(pEl, "image", src, true, indent); |
78 return false; | 78 return false; |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 // Objects | 82 // Objects |
83 else if (tag == "object") | 83 else if (tag == "object") |
84 { | 84 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 #ifdef ENABLE_DEBUG_RESULT | 152 #ifdef ENABLE_DEBUG_RESULT |
153 if (isDebug) | 153 if (isDebug) |
154 { | 154 { |
155 CPluginDebug::DebugResultHiding(ToWstring(type), url, L"-"); | 155 CPluginDebug::DebugResultHiding(ToWstring(type), url, L"-"); |
156 } | 156 } |
157 #endif // ENABLE_DEBUG_RESULT | 157 #endif // ENABLE_DEBUG_RESULT |
158 } | 158 } |
159 } | 159 } |
160 } | 160 } |
OLD | NEW |