OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ASSERT(!cssSheet->disabled()); | 186 ASSERT(!cssSheet->disabled()); |
187 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) | 187 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) |
188 return; | 188 return; |
189 | 189 |
190 TreeScope* treeScope = ScopedStyleResolver::treeScopeFor(document(), cssShee
t); | 190 TreeScope* treeScope = ScopedStyleResolver::treeScopeFor(document(), cssShee
t); |
191 if (!treeScope) | 191 if (!treeScope) |
192 return; | 192 return; |
193 | 193 |
194 ScopedStyleResolver& resolver = treeScope->ensureScopedStyleResolver(); | 194 ScopedStyleResolver& resolver = treeScope->ensureScopedStyleResolver(); |
195 document().styleEngine()->addScopedStyleResolver(&resolver); | 195 document().styleEngine()->addScopedStyleResolver(&resolver); |
196 resolver.addRulesFromSheet(cssSheet, *m_medium, this); | 196 unsigned index = resolver.appendCSSStyleSheet(cssSheet); |
| 197 |
| 198 addRulesFromSheet(cssSheet, treeScope, index); |
| 199 } |
| 200 |
| 201 void StyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, TreeScope* treeSc
ope, unsigned index) |
| 202 { |
| 203 StyleSheetContents* sheet = cssSheet->contents(); |
| 204 AddRuleFlags addRuleFlags = document().securityOrigin()->canRequest(sheet->b
aseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; |
| 205 const RuleSet& ruleSet = sheet->ensureRuleSet(*m_medium, addRuleFlags); |
| 206 |
| 207 addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()); |
| 208 processScopedRules(ruleSet, cssSheet, index, treeScope->rootNode()); |
197 } | 209 } |
198 | 210 |
199 void StyleResolver::appendPendingAuthorStyleSheets() | 211 void StyleResolver::appendPendingAuthorStyleSheets() |
200 { | 212 { |
201 for (WillBeHeapListHashSet<RawPtrWillBeMember<CSSStyleSheet>, 16>::iterator
it = m_pendingStyleSheets.begin(); it != m_pendingStyleSheets.end(); ++it) | 213 for (WillBeHeapListHashSet<RawPtrWillBeMember<CSSStyleSheet>, 16>::iterator
it = m_pendingStyleSheets.begin(); it != m_pendingStyleSheets.end(); ++it) |
202 appendCSSStyleSheet(*it); | 214 appendCSSStyleSheet(*it); |
203 | 215 |
204 m_pendingStyleSheets.clear(); | 216 m_pendingStyleSheets.clear(); |
205 finishAppendAuthorStyleSheets(); | 217 finishAppendAuthorStyleSheets(); |
206 } | 218 } |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 visitor->trace(m_uncommonAttributeRuleSet); | 1594 visitor->trace(m_uncommonAttributeRuleSet); |
1583 visitor->trace(m_watchedSelectorsRules); | 1595 visitor->trace(m_watchedSelectorsRules); |
1584 visitor->trace(m_treeBoundaryCrossingRules); | 1596 visitor->trace(m_treeBoundaryCrossingRules); |
1585 visitor->trace(m_styleSharingLists); | 1597 visitor->trace(m_styleSharingLists); |
1586 visitor->trace(m_pendingStyleSheets); | 1598 visitor->trace(m_pendingStyleSheets); |
1587 visitor->trace(m_document); | 1599 visitor->trace(m_document); |
1588 #endif | 1600 #endif |
1589 } | 1601 } |
1590 | 1602 |
1591 } // namespace blink | 1603 } // namespace blink |
OLD | NEW |