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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 103273002: CSSSegmentedFontFaceCache should not know about Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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/CSSSegmentedFontFaceCache.cpp ('k') | no next file » | 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, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 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 24 matching lines...) Expand all
35 #include "StylePropertyShorthand.h" 35 #include "StylePropertyShorthand.h"
36 #include "core/animation/ActiveAnimations.h" 36 #include "core/animation/ActiveAnimations.h"
37 #include "core/animation/AnimatableLength.h" 37 #include "core/animation/AnimatableLength.h"
38 #include "core/animation/AnimatableValue.h" 38 #include "core/animation/AnimatableValue.h"
39 #include "core/animation/Animation.h" 39 #include "core/animation/Animation.h"
40 #include "core/animation/DocumentTimeline.h" 40 #include "core/animation/DocumentTimeline.h"
41 #include "core/animation/css/CSSAnimatableValueFactory.h" 41 #include "core/animation/css/CSSAnimatableValueFactory.h"
42 #include "core/animation/css/CSSAnimations.h" 42 #include "core/animation/css/CSSAnimations.h"
43 #include "core/css/CSSCalculationValue.h" 43 #include "core/css/CSSCalculationValue.h"
44 #include "core/css/CSSDefaultStyleSheets.h" 44 #include "core/css/CSSDefaultStyleSheets.h"
45 #include "core/css/CSSFontFace.h"
45 #include "core/css/CSSFontSelector.h" 46 #include "core/css/CSSFontSelector.h"
46 #include "core/css/CSSKeyframeRule.h" 47 #include "core/css/CSSKeyframeRule.h"
47 #include "core/css/CSSKeyframesRule.h" 48 #include "core/css/CSSKeyframesRule.h"
48 #include "core/css/CSSParser.h" 49 #include "core/css/CSSParser.h"
49 #include "core/css/CSSReflectValue.h" 50 #include "core/css/CSSReflectValue.h"
50 #include "core/css/CSSRuleList.h" 51 #include "core/css/CSSRuleList.h"
51 #include "core/css/CSSSelector.h" 52 #include "core/css/CSSSelector.h"
52 #include "core/css/CSSStyleRule.h" 53 #include "core/css/CSSStyleRule.h"
53 #include "core/css/CSSValueList.h" 54 #include "core/css/CSSValueList.h"
54 #include "core/css/CSSVariableValue.h" 55 #include "core/css/CSSVariableValue.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 115 }
115 116
116 static StylePropertySet* rightToLeftDeclaration() 117 static StylePropertySet* rightToLeftDeclaration()
117 { 118 {
118 DEFINE_STATIC_REF(MutableStylePropertySet, rightToLeftDecl, (MutableStylePro pertySet::create())); 119 DEFINE_STATIC_REF(MutableStylePropertySet, rightToLeftDecl, (MutableStylePro pertySet::create()));
119 if (rightToLeftDecl->isEmpty()) 120 if (rightToLeftDecl->isEmpty())
120 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); 121 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl);
121 return rightToLeftDecl; 122 return rightToLeftDecl;
122 } 123 }
123 124
125 static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector , const StyleRuleFontFace* fontFaceRule)
126 {
127 RefPtr<CSSFontFace> cssFontFace = CSSFontFace::createFromStyleRule(document, fontFaceRule);
128 if (cssFontFace)
129 cssFontSelector->addFontFaceRule(fontFaceRule, cssFontFace);
130 }
131
124 StyleResolver::StyleResolver(Document& document) 132 StyleResolver::StyleResolver(Document& document)
125 : m_document(document) 133 : m_document(document)
126 , m_fontSelector(CSSFontSelector::create(&document)) 134 , m_fontSelector(CSSFontSelector::create(&document))
127 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) 135 , m_viewportStyleResolver(ViewportStyleResolver::create(&document))
128 , m_needCollectFeatures(false) 136 , m_needCollectFeatures(false)
129 , m_styleResourceLoader(document.fetcher()) 137 , m_styleResourceLoader(document.fetcher())
130 , m_styleResolverStatsSequence(0) 138 , m_styleResolverStatsSequence(0)
131 , m_accessCount(0) 139 , m_accessCount(0)
132 { 140 {
133 m_fontSelector->registerForInvalidationCallbacks(this); 141 m_fontSelector->registerForInvalidationCallbacks(this);
(...skipping 22 matching lines...) Expand all
156 164
157 m_styleTree.clear(); 165 m_styleTree.clear();
158 166
159 initWatchedSelectorRules(CSSSelectorWatch::from(document).watchedCallbackSel ectors()); 167 initWatchedSelectorRules(CSSSelectorWatch::from(document).watchedCallbackSel ectors());
160 168
161 #if ENABLE(SVG_FONTS) 169 #if ENABLE(SVG_FONTS)
162 if (document.svgExtensions()) { 170 if (document.svgExtensions()) {
163 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx tensions()->svgFontFaceElements(); 171 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx tensions()->svgFontFaceElements();
164 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); 172 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd();
165 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) 173 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it)
166 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); 174 addFontFaceRule(&document, fontSelector(), (*it)->fontFaceRule());
167 } 175 }
168 #endif 176 #endif
169 } 177 }
170 178
171 void StyleResolver::initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& w atchedSelectors) 179 void StyleResolver::initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& w atchedSelectors)
172 { 180 {
173 if (!watchedSelectors.size()) 181 if (!watchedSelectors.size())
174 return; 182 return;
175 m_watchedSelectorsRules = RuleSet::create(); 183 m_watchedSelectorsRules = RuleSet::create();
176 for (unsigned i = 0; i < watchedSelectors.size(); ++i) 184 for (unsigned i = 0; i < watchedSelectors.size(); ++i)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 const Vector<StyleRuleKeyframes*> keyframesRules = authorRules.keyframesRule s(); 269 const Vector<StyleRuleKeyframes*> keyframesRules = authorRules.keyframesRule s();
262 for (unsigned i = 0; i < keyframesRules.size(); ++i) 270 for (unsigned i = 0; i < keyframesRules.size(); ++i)
263 ensureScopedStyleResolver(scope)->addKeyframeStyle(keyframesRules[i]); 271 ensureScopedStyleResolver(scope)->addKeyframeStyle(keyframesRules[i]);
264 272
265 addTreeBoundaryCrossingRules(authorRules.treeBoundaryCrossingRules(), scope) ; 273 addTreeBoundaryCrossingRules(authorRules.treeBoundaryCrossingRules(), scope) ;
266 274
267 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets fo r the moment. 275 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets fo r the moment.
268 if (!scope || scope->isDocumentNode()) { 276 if (!scope || scope->isDocumentNode()) {
269 const Vector<StyleRuleFontFace*> fontFaceRules = authorRules.fontFaceRul es(); 277 const Vector<StyleRuleFontFace*> fontFaceRules = authorRules.fontFaceRul es();
270 for (unsigned i = 0; i < fontFaceRules.size(); ++i) 278 for (unsigned i = 0; i < fontFaceRules.size(); ++i)
271 fontSelector()->addFontFaceRule(fontFaceRules[i]); 279 addFontFaceRule(&m_document, fontSelector(), fontFaceRules[i]);
272 if (fontFaceRules.size()) 280 if (fontFaceRules.size())
273 invalidateMatchedPropertiesCache(); 281 invalidateMatchedPropertiesCache();
274 } else { 282 } else {
275 addTreeBoundaryCrossingRules(authorRules.shadowDistributedRules(), scope ); 283 addTreeBoundaryCrossingRules(authorRules.shadowDistributedRules(), scope );
276 } 284 }
277 } 285 }
278 286
279 void StyleResolver::resetFontSelector() 287 void StyleResolver::resetFontSelector()
280 { 288 {
281 ASSERT(m_fontSelector); 289 ASSERT(m_fontSelector);
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 bool StyleResolver::affectedByViewportChange() const 1439 bool StyleResolver::affectedByViewportChange() const
1432 { 1440 {
1433 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1441 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1434 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1442 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1435 return true; 1443 return true;
1436 } 1444 }
1437 return false; 1445 return false;
1438 } 1446 }
1439 1447
1440 } // namespace WebCore 1448 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSSegmentedFontFaceCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698