OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
| 3 #include "COM_Value.h" |
3 #include "PluginClient.h" | 4 #include "PluginClient.h" |
4 #include "PluginFilter.h" | 5 #include "PluginFilter.h" |
5 #include "PluginSettings.h" | 6 #include "PluginSettings.h" |
6 | 7 |
7 #include "AdblockPlusDomTraverser.h" | 8 #include "AdblockPlusDomTraverser.h" |
8 | 9 |
9 | 10 |
10 CPluginDomTraverser::CPluginDomTraverser(CPluginTab* tab) : CPluginDomTraverserB
ase(tab) | 11 CPluginDomTraverser::CPluginDomTraverser(CPluginTab* tab) : CPluginDomTraverserB
ase(tab) |
11 { | 12 { |
12 } | 13 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (cache->m_isHidden) | 60 if (cache->m_isHidden) |
60 { | 61 { |
61 HideElement(pEl, "image", src, true, indent); | 62 HideElement(pEl, "image", src, true, indent); |
62 return false; | 63 return false; |
63 } | 64 } |
64 } | 65 } |
65 } | 66 } |
66 // Objects | 67 // Objects |
67 else if (tag == "object") | 68 else if (tag == "object") |
68 { | 69 { |
69 CComBSTR bstrInnerHtml; | 70 AdblockPlus::COM::BSTR_ParamResult inner_HTML; |
70 | 71 if (SUCCEEDED(pEl->get_innerHTML(&inner_HTML))) |
71 if (SUCCEEDED(pEl->get_innerHTML(&bstrInnerHtml)) && bstrInnerHtml) | |
72 { | 72 { |
73 CString sObjectHtml = bstrInnerHtml; | 73 CString sObjectHtml = to_CString(inner_HTML); |
74 CString src; | 74 CString src; |
75 | 75 |
76 int posBegin = sObjectHtml.Find(L"VALUE=\""); | 76 int posBegin = sObjectHtml.Find(L"VALUE=\""); |
77 int posEnd = posBegin >= 0 ? sObjectHtml.Find('\"', posBegin + 7) : -1; | 77 int posEnd = posBegin >= 0 ? sObjectHtml.Find('\"', posBegin + 7) : -1; |
78 | 78 |
79 while (posBegin >= 0 && posEnd >= 0) | 79 while (posBegin >= 0 && posEnd >= 0) |
80 { | 80 { |
81 posBegin += 7; | 81 posBegin += 7; |
82 | 82 |
83 src = sObjectHtml.Mid(posBegin, posEnd - posBegin); | 83 src = sObjectHtml.Mid(posBegin, posEnd - posBegin); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return client && CPluginSettings::GetInstance()->IsPluginEnabled() && !client-
>IsWhitelistedUrl(std::wstring(m_domain)); | 115 return client && CPluginSettings::GetInstance()->IsPluginEnabled() && !client-
>IsWhitelistedUrl(std::wstring(m_domain)); |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 void CPluginDomTraverser::HideElement(IHTMLElement* pEl, const CString& type, co
nst CString& url, bool isDebug, CString& indent) | 119 void CPluginDomTraverser::HideElement(IHTMLElement* pEl, const CString& type, co
nst CString& url, bool isDebug, CString& indent) |
120 { | 120 { |
121 CComPtr<IHTMLStyle> pStyle; | 121 CComPtr<IHTMLStyle> pStyle; |
122 | 122 |
123 if (SUCCEEDED(pEl->get_style(&pStyle)) && pStyle) | 123 if (SUCCEEDED(pEl->get_style(&pStyle)) && pStyle) |
124 { | 124 { |
125 CComBSTR bstrDisplay; | 125 AdblockPlus::COM::BSTR_ParamResult display; |
126 | 126 // Explicit call to conversion operator compensates for deficiencies in VS20
12 |
127 if (SUCCEEDED(pStyle->get_display(&bstrDisplay)) && bstrDisplay && CString(b
strDisplay) == L"none") | 127 if (SUCCEEDED(pStyle->get_display(&display)) && display.operator std::wstrin
g() == L"none") |
128 { | 128 { |
129 return; | 129 return; |
130 } | 130 } |
131 | 131 |
132 static const CComBSTR sbstrNone(L"none"); | 132 static const AdblockPlus::COM::BSTR_ParamArgument none(std::wstring(L"none")
); |
133 | 133 if (SUCCEEDED(pStyle->put_display(none))) |
134 if (SUCCEEDED(pStyle->put_display(sbstrNone))) | |
135 { | 134 { |
136 DEBUG_HIDE_EL(indent + L"HideEl::Hiding " + type + L" url:" + url) | 135 DEBUG_HIDE_EL(indent + L"HideEl::Hiding " + type + L" url:" + url) |
137 | 136 |
138 #ifdef ENABLE_DEBUG_RESULT | 137 #ifdef ENABLE_DEBUG_RESULT |
139 if (isDebug) | 138 if (isDebug) |
140 { | 139 { |
141 CPluginDebug::DebugResultHiding(type, url, "-"); | 140 CPluginDebug::DebugResultHiding(type, url, "-"); |
142 } | 141 } |
143 #endif // ENABLE_DEBUG_RESULT | 142 #endif // ENABLE_DEBUG_RESULT |
144 } | 143 } |
145 } | 144 } |
146 } | 145 } |
OLD | NEW |