OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 } | 148 } |
149 ); | 149 ); |
150 }); | 150 }); |
151 | 151 |
152 observer.observe(style.parentNode, {childList: true}); | 152 observer.observe(style.parentNode, {childList: true}); |
153 } | 153 } |
154 | 154 |
155 function init(document) | 155 function init(document) |
156 { | 156 { |
157 // use Shadow DOM if available to don't mess with web pages that | 157 // Use Shadow DOM if available to don't mess with web pages that rely on |
158 // rely on the order of their own <style> tags (#309). However we | 158 // the order of their own <style> tags (#309). |
159 // must not create the shadow root in the response callback passed | 159 // |
160 // to sendMessage(), otherwise Chrome breaks some websites (#450). | 160 // However, creating a shadow root breaks running CSS transitions. So we |
| 161 // have to create the shadow root before transistions might start (#452). |
| 162 // |
| 163 // Also, we can't use shadow DOM on Google Docs, since it breaks printing |
| 164 // there (#1770). |
161 var shadow = null; | 165 var shadow = null; |
162 if ("createShadowRoot" in document.documentElement) | 166 if ("createShadowRoot" in document.documentElement && document.domain != "docs
.google.com") |
163 { | 167 { |
164 shadow = document.documentElement.createShadowRoot(); | 168 shadow = document.documentElement.createShadowRoot(); |
165 shadow.appendChild(document.createElement("shadow")); | 169 shadow.appendChild(document.createElement("shadow")); |
166 } | 170 } |
167 | 171 |
168 // Sets the currently used CSS rules for elemhide filters | 172 // Sets the currently used CSS rules for elemhide filters |
169 var setElemhideCSSRules = function(selectors) | 173 var setElemhideCSSRules = function(selectors) |
170 { | 174 { |
171 if (selectors.length == 0) | 175 if (selectors.length == 0) |
172 return; | 176 return; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 }, true); | 242 }, true); |
239 | 243 |
240 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); | 244 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); |
241 } | 245 } |
242 | 246 |
243 if (document instanceof HTMLDocument) | 247 if (document instanceof HTMLDocument) |
244 { | 248 { |
245 checkSitekey(); | 249 checkSitekey(); |
246 init(document); | 250 init(document); |
247 } | 251 } |
OLD | NEW |