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

Side by Side Diff: Source/core/css/DocumentRuleSets.cpp

Issue 66383005: Remove the concept of user stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix WebFrameCSSCallbackTest tests 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/DocumentRuleSets.h ('k') | Source/core/css/InspectorCSSOMWrappers.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 29 matching lines...) Expand all
40 namespace WebCore { 40 namespace WebCore {
41 41
42 DocumentRuleSets::DocumentRuleSets() 42 DocumentRuleSets::DocumentRuleSets()
43 { 43 {
44 } 44 }
45 45
46 DocumentRuleSets::~DocumentRuleSets() 46 DocumentRuleSets::~DocumentRuleSets()
47 { 47 {
48 } 48 }
49 49
50 void DocumentRuleSets::initUserStyle(StyleEngine* styleSheetCollection, const Ve ctor<RefPtr<StyleRule> >& watchedSelectors, const MediaQueryEvaluator& medium, S tyleResolver& resolver) 50 void DocumentRuleSets::initWatchedSelectorRules(const Vector<RefPtr<StyleRule> > & watchedSelectors)
51 { 51 {
52 OwnPtr<RuleSet> tempUserStyle = RuleSet::create(); 52 if (!watchedSelectors.size())
53 if (CSSStyleSheet* pageUserSheet = styleSheetCollection->pageUserSheet()) 53 return;
54 tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), medium, &res olver); 54 m_watchedSelectorsRules = RuleSet::create();
55 collectRulesFromUserStyleSheets(styleSheetCollection->documentUserStyleSheet s(), *tempUserStyle, medium, resolver);
56 collectRulesFromWatchedSelectors(watchedSelectors, *tempUserStyle);
57 if (tempUserStyle->ruleCount() > 0 || tempUserStyle->pageRules().size() > 0)
58 m_userStyle = tempUserStyle.release();
59 }
60
61 void DocumentRuleSets::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSSt yleSheet> >& userSheets, RuleSet& userStyle, const MediaQueryEvaluator& medium, StyleResolver& resolver)
62 {
63 for (unsigned i = 0; i < userSheets.size(); ++i) {
64 ASSERT(userSheets[i]->contents()->isUserStyleSheet());
65 userStyle.addRulesFromSheet(userSheets[i]->contents(), medium, &resolver );
66 resolver.addFontFaceRules(userStyle.fontFaceRules());
67 }
68 }
69
70 void DocumentRuleSets::collectRulesFromWatchedSelectors(const Vector<RefPtr<Styl eRule> >& watchedSelectors, RuleSet& userStyle)
71 {
72 for (unsigned i = 0; i < watchedSelectors.size(); ++i) 55 for (unsigned i = 0; i < watchedSelectors.size(); ++i)
73 userStyle.addStyleRule(watchedSelectors[i].get(), RuleHasNoSpecialState) ; 56 m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHas NoSpecialState);
74 } 57 }
75 58
76 void DocumentRuleSets::resetAuthorStyle() 59 void DocumentRuleSets::resetAuthorStyle()
77 { 60 {
78 m_treeBoundaryCrossingRules.clear(); 61 m_treeBoundaryCrossingRules.clear();
79 } 62 }
80 63
81 void DocumentRuleSets::collectFeaturesTo(RuleFeatureSet& features, bool isViewSo urce) 64 void DocumentRuleSets::collectFeaturesTo(RuleFeatureSet& features, bool isViewSo urce)
82 { 65 {
83 // Collect all ids and rules using sibling selectors (:first-child and simil ar) 66 // Collect all ids and rules using sibling selectors (:first-child and simil ar)
84 // in the current set of stylesheets. Style sharing code uses this informati on to reject 67 // in the current set of stylesheets. Style sharing code uses this informati on to reject
85 // sharing candidates. 68 // sharing candidates.
86 if (CSSDefaultStyleSheets::defaultStyle) 69 if (CSSDefaultStyleSheets::defaultStyle)
87 features.add(CSSDefaultStyleSheets::defaultStyle->features()); 70 features.add(CSSDefaultStyleSheets::defaultStyle->features());
88 71
89 if (isViewSource) 72 if (isViewSource)
90 features.add(CSSDefaultStyleSheets::viewSourceStyle()->features()); 73 features.add(CSSDefaultStyleSheets::viewSourceStyle()->features());
91 74
92 if (m_userStyle) 75 if (m_watchedSelectorsRules)
93 features.add(m_userStyle->features()); 76 features.add(m_watchedSelectorsRules->features());
94 77
95 m_treeBoundaryCrossingRules.collectFeaturesTo(features); 78 m_treeBoundaryCrossingRules.collectFeaturesTo(features);
96 } 79 }
97 80
98 } // namespace WebCore 81 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/DocumentRuleSets.h ('k') | Source/core/css/InspectorCSSOMWrappers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698