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

Unified Diff: lib/content/elemHideEmulation.js

Issue 29759621: Issue 6610 - Prefer inline style for :-abp-properties() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created April 23, 2018, 2:39 p.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
@@ -243,17 +243,16 @@
const incompletePrefixRegexp = /[\s>+~]$/;
function HasSelector(selectors)
{
this._innerSelectors = selectors;
}
HasSelector.prototype = {
- requiresHiding: true,
dependsOnDOM: true,
get dependsOnStyles()
{
return this._innerSelectors.some(selector => selector.dependsOnStyles);
},
get dependsOnCharacterData()
@@ -306,17 +305,16 @@
};
function ContainsSelector(textContent)
{
this._regexp = makeRegExpParameter(textContent);
}
ContainsSelector.prototype = {
- requiresHiding: true,
dependsOnDOM: true,
dependsOnCharacterData: true,
*getSelectors(prefix, subtree, styles)
{
for (let element of this.getElements(prefix, subtree, styles))
yield [makeSelector(element), subtree];
},
@@ -364,17 +362,16 @@
}
else
regexpString = filterToRegExp(propertyExpression);
this._regexp = new RegExp(regexpString, "i");
}
PropsSelector.prototype = {
- preferHideWithSelector: true,
dependsOnStyles: true,
*findPropsSelectors(styles, prefix, regexp)
{
for (let style of styles)
if (regexp.test(style.style))
for (let subSelector of style.subSelectors)
{
@@ -399,25 +396,16 @@
function Pattern(selectors, text)
{
this.selectors = selectors;
this.text = text;
}
Pattern.prototype = {
- isSelectorHidingOnlyPattern()
- {
- return getCachedPropertyValue(
- this, "_selectorHidingOnlyPattern",
- () => this.selectors.some(selector => selector.preferHideWithSelector) &&
- !this.selectors.some(selector => selector.requiresHiding)
- );
- },
-
get dependsOnStyles()
{
return getCachedPropertyValue(
this, "_dependsOnStyles",
() => this.selectors.some(selector => selector.dependsOnStyles)
);
},
@@ -671,18 +659,17 @@
generator = evaluate(pattern.selectors, 0, "",
this.document, cssStyles);
}
for (let selector of generator)
{
if (selector != null)
{
- if (!this.useInlineStyles ||
- pattern.isSelectorHidingOnlyPattern())
+ if (!this.useInlineStyles)
{
selectors.push(selector);
selectorFilters.push(pattern.text);
}
else
{
for (let element of this.document.querySelectorAll(selector))
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld