Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 66383005: Remove the concept of user stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 111d1e5a783c6b9ada4b8ff012e4c6d77c18b74e..54b13afea2f310a74a438ce827eabc1e43d06423 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -175,7 +175,6 @@ StyleResolver::StyleResolver(Document& document, bool matchAuthorAndUserStyles)
m_styleTree.clear();
StyleEngine* styleSheetCollection = document.styleEngine();
- m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(document).watchedCallbackSelectors(), *m_medium, *this);
#if ENABLE(SVG_FONTS)
if (document.svgExtensions()) {
@@ -480,22 +479,6 @@ void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
matchHostRules(element, resolvers.first(), collector, includeEmptyRules);
}
-void StyleResolver::matchUserRules(ElementRuleCollector& collector, bool includeEmptyRules)
-{
- if (!m_ruleSets.userStyle())
- return;
-
- collector.clearMatchedRules();
- collector.matchedResult().ranges.lastUserRule = collector.matchedResult().matchedProperties.size() - 1;
-
- MatchRequest matchRequest(m_ruleSets.userStyle(), includeEmptyRules);
- RuleRange ruleRange = collector.matchedResult().ranges.userRuleRange();
- collector.collectMatchingRules(matchRequest, ruleRange);
- collector.collectMatchingRulesForRegion(matchRequest, ruleRange);
-
- collector.sortAndTransferMatchedRules();
-}
-
void StyleResolver::matchUARules(ElementRuleCollector& collector)
{
collector.setMatchingUARules(true);
@@ -534,10 +517,6 @@ void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
{
matchUARules(collector);
- // Now we check user sheet rules.
- if (matchAuthorAndUserStyles)
- matchUserRules(collector, false);
-
// Now check author rules, beginning first with presentational attributes mapped from HTML.
if (state.element()->isStyledElement()) {
collector.addElementStyleProperties(state.element()->presentationAttributeStyle());
@@ -1043,10 +1022,8 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
collector.setPseudoStyleRequest(pseudoStyleRequest);
matchUARules(collector);
- if (m_matchAuthorAndUserStyles) {
- matchUserRules(collector, false);
+ if (m_matchAuthorAndUserStyles)
matchAuthorRules(state.element(), collector, false);
- }
if (collector.matchedResult().matchedProperties.isEmpty())
return 0;
@@ -1088,7 +1065,6 @@ PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex)
PageRuleCollector collector(rootElementStyle, pageIndex);
collector.matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle);
- collector.matchPageRules(m_ruleSets.userStyle());
if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument())
scopedResolver->matchPageRules(collector);
@@ -1127,9 +1103,6 @@ void StyleResolver::collectViewportRules()
if (document().isMobileDocument())
viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::xhtmlMobileProfileStyle(), ViewportStyleResolver::UserAgentOrigin);
- if (m_ruleSets.userStyle())
- viewportStyleResolver()->collectViewportRules(m_ruleSets.userStyle(), ViewportStyleResolver::UserAgentOrigin);
-
if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument())
scopedResolver->collectViewportRulesTo(this);
@@ -1163,20 +1136,10 @@ bool StyleResolver::checkRegionStyle(Element* regionElement)
{
// FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment,
// so all region rules are global by default. Verify whether that can stand or needs changing.
-
- if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument())
+ if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument()) {
if (scopedResolver->checkRegionStyle(regionElement))
return true;
-
- if (m_ruleSets.userStyle()) {
- unsigned rulesSize = m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.size();
- for (unsigned i = 0; i < rulesSize; ++i) {
- ASSERT(m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.at(i).ruleSet.get());
- if (checkRegionSelector(m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.at(i).selector, regionElement))
- return true;
- }
}
-
return false;
}
@@ -1217,10 +1180,6 @@ void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
if (rulesToInclude & UAAndUserCSSRules) {
// First we match rules from the user agent sheet.
matchUARules(collector);
-
- // Now we check user sheet rules.
- if (m_matchAuthorAndUserStyles)
- matchUserRules(collector, rulesToInclude & EmptyCSSRules);
}
if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) {

Powered by Google App Engine
This is Rietveld 408576698