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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 break; | 152 break; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 return result; | 156 return result; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 OwnedString ElemHideBase::GetSelector() const | 160 OwnedString ElemHideBase::GetSelector() const |
161 { | 161 { |
162 DependentString selector = mData.GetSelector(mText); | 162 const DependentString selector = mData.GetSelector(mText); |
163 String::size_type replacementCount = 0; | 163 String::size_type replacementCount = 0; |
164 for (String::size_type i = 0; i < selector.length(); i++) | 164 for (String::size_type i = 0; i < selector.length(); i++) |
165 if (selector[i] == '}' || selector[i] == '{') | 165 if (selector[i] == '}' || selector[i] == '{') |
166 replacementCount++; | 166 replacementCount++; |
167 if (replacementCount) | 167 if (replacementCount) |
168 return EscapeCurlies(replacementCount, selector); | 168 return EscapeCurlies(replacementCount, selector); |
169 | 169 |
170 return OwnedString(selector); | 170 return OwnedString(selector); |
171 } | 171 } |
172 | 172 |
173 OwnedString ElemHideBase::GetSelectorDomain() const | 173 OwnedString ElemHideBase::GetSelectorDomain() const |
174 { | 174 { |
175 /* TODO this is inefficient */ | 175 /* TODO this is inefficient */ |
176 OwnedString result; | 176 OwnedString result; |
177 if (mDomains) | 177 if (mDomains) |
178 { | 178 { |
179 for (const auto& item : *mDomains) | 179 for (const auto& item : *mDomains) |
180 { | 180 { |
181 if (item.second && !item.first.empty()) | 181 if (item.second && !item.first.empty()) |
182 { | 182 { |
183 if (!result.empty()) | 183 if (!result.empty()) |
184 result.append(u','); | 184 result.append(u','); |
185 result.append(item.first); | 185 result.append(item.first); |
186 } | 186 } |
187 } | 187 } |
188 } | 188 } |
189 return result; | 189 return result; |
190 } | 190 } |
OLD | NEW |