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

Unified Diff: lib/content/elemHideEmulation.js

Issue 29847558: Issue 6504 - Remove useInlineStyles for now (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Remove one more reference to useInlineStyles Created Aug. 15, 2018, 7:47 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/content/elemHideEmulation.js
===================================================================
--- a/lib/content/elemHideEmulation.js
+++ b/lib/content/elemHideEmulation.js
@@ -599,17 +599,16 @@
}
function ElemHideEmulation(addSelectorsFunc, hideElemsFunc)
{
this.document = document;
this.addSelectorsFunc = addSelectorsFunc;
this.hideElemsFunc = hideElemsFunc;
this.observer = new MutationObserver(this.observe.bind(this));
- this.useInlineStyles = true;
}
ElemHideEmulation.prototype = {
isSameOrigin(stylesheet)
{
try
{
return new URL(stylesheet.href).origin == this.document.location.origin;
@@ -789,40 +788,27 @@
// If the pattern appears to contain any sibling combinators, we can't
// easily optimize based on the mutation targets. Since this is a
// special case, skip the optimization. By setting it to null here we
// make sure we process the entire DOM.
if (pattern.maybeContainsSiblingCombinators)
evaluationTargets = null;
- // Ignore mutation targets when using style sheets, because we may have
- // to update all the CSS selectors.
- if (!this.useInlineStyles)
- evaluationTargets = null;
-
generator = evaluate(pattern.selectors, 0, "",
this.document, cssStyles, evaluationTargets);
}
for (let selector of generator)
{
if (selector != null)
{
- if (!this.useInlineStyles)
+ for (let element of this.document.querySelectorAll(selector))
{
- selectors.push(selector);
- selectorFilters.push(pattern.text);
- }
- else
- {
- for (let element of this.document.querySelectorAll(selector))
- {
- elements.push(element);
- elementFilters.push(pattern.text);
- }
+ elements.push(element);
+ elementFilters.push(pattern.text);
}
}
if (performance.now() - cycleStart > MAX_SYNCHRONOUS_PROCESSING_TIME)
{
setTimeout(processPatterns, 0);
return;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld