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

Delta Between Two Patch Sets: include.preload.js

Issue 29331619: Issue 2397 - Integrate CSS property filters into adblockpluschrome (Closed)
Left Patch Set: Created Nov. 30, 2015, 3:46 p.m.
Right Patch Set: Updated adblockplus dependency again Created Dec. 12, 2015, 12:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « dependencies ('k') | metadata.common » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 return result; 280 return result;
281 } 281 }
282 282
283 function init(document) 283 function init(document)
284 { 284 {
285 var shadow = null; 285 var shadow = null;
286 var style = null; 286 var style = null;
287 var observer = null; 287 var observer = null;
288 var propertyFilters = new CSSPropertyFilters(window, addElemHideSelectors);
288 289
289 // Use Shadow DOM if available to don't mess with web pages that rely on 290 // Use Shadow DOM if available to don't mess with web pages that rely on
290 // the order of their own <style> tags (#309). 291 // the order of their own <style> tags (#309).
291 // 292 //
292 // However, creating a shadow root breaks running CSS transitions. So we 293 // However, creating a shadow root breaks running CSS transitions. So we
293 // have to create the shadow root before transistions might start (#452). 294 // have to create the shadow root before transistions might start (#452).
294 // 295 //
295 // Also, using shadow DOM causes issues on some Google websites, 296 // Also, using shadow DOM causes issues on some Google websites,
296 // including Google Docs and Gmail (#1770, #2602). 297 // including Google Docs and Gmail (#1770, #2602).
297 if ("createShadowRoot" in document.documentElement && !/\.google\.com$/.test(d ocument.domain)) 298 if ("createShadowRoot" in document.documentElement && !/\.google\.com$/.test(d ocument.domain))
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 352
352 if (observer) 353 if (observer)
353 observer.disconnect(); 354 observer.disconnect();
354 observer = null; 355 observer = null;
355 356
356 if (style && style.parentElement) 357 if (style && style.parentElement)
357 style.parentElement.removeChild(style); 358 style.parentElement.removeChild(style);
358 style = null; 359 style = null;
359 360
360 addElemHideSelectors(selectors); 361 addElemHideSelectors(selectors);
361 CSSPropertyFilters.apply(); 362 propertyFilters.apply();
Sebastian Noack 2015/11/30 16:06:29 This method doesn't exist anymore, since we turned
kzar 2015/11/30 17:39:07 Acknowledged.
362 }; 363 };
363 364
364 ext.backgroundPage.sendMessage({type: "get-selectors"}, function(response) 365 ext.backgroundPage.sendMessage({type: "get-selectors"}, function(response)
365 { 366 {
366 selectors = response; 367 selectors = response;
367 checkLoaded(); 368 checkLoaded();
368 }); 369 });
369 370
370 CSSPropertyFilters.load(function() 371 propertyFilters.load(function()
Sebastian Noack 2015/11/30 16:06:29 Same for that one. Or do I miss something?
kzar 2015/11/30 17:39:07 No, you're right. I think it's only a coincidence
371 { 372 {
372 CSSPropertyFiltersLoaded = true; 373 CSSPropertyFiltersLoaded = true;
373 checkLoaded(); 374 checkLoaded();
374 }); 375 });
375 }; 376 };
376 377
377 ext.backgroundPage.sendMessage({type: "get-selectors"}, addElemHideSelectors); 378 updateStylesheet();
378 379
379 document.addEventListener("error", function(event) 380 document.addEventListener("error", function(event)
380 { 381 {
381 checkCollapse(event.target); 382 checkCollapse(event.target);
382 }, true); 383 }, true);
383 384
384 document.addEventListener("load", function(event) 385 document.addEventListener("load", function(event)
385 { 386 {
386 var element = event.target; 387 var element = event.target;
387 388
(...skipping 19 matching lines...) Expand all
407 // Moreover, "load" and "error" events aren't dispatched for elements 408 // Moreover, "load" and "error" events aren't dispatched for elements
408 // in dynamically created frames due to https://crbug.com/442107. 409 // in dynamically created frames due to https://crbug.com/442107.
409 // So we also have to apply element collpasing from the parent frame. 410 // So we also have to apply element collpasing from the parent frame.
410 if (!contentWindow.collapsing) 411 if (!contentWindow.collapsing)
411 [].forEach.call(contentDocument.querySelectorAll(Object.keys(typeMap ).join(",")), checkCollapse); 412 [].forEach.call(contentDocument.querySelectorAll(Object.keys(typeMap ).join(",")), checkCollapse);
412 } 413 }
413 } 414 }
414 } 415 }
415 }, true); 416 }, true);
416 417
417 if (window.document == document) 418 return updateStylesheet;
418 {
419 new CSSPropertyFilters(window, addElemHideSelectors);
kzar 2015/11/30 15:51:10 The changes to this file are almost entirely by Se
420 window.updateStylesheet = updateStylesheet;
421 }
422 } 419 }
423 420
424 if (document instanceof HTMLDocument) 421 if (document instanceof HTMLDocument)
425 { 422 {
426 checkSitekey(); 423 checkSitekey();
427 init(document); 424 window.updateStylesheet = init(document);
428 } 425 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld