| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 appendCSSStyleSheet(*styleSheet); | 210 appendCSSStyleSheet(*styleSheet); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void StyleResolver::finishAppendAuthorStyleSheets() | 213 void StyleResolver::finishAppendAuthorStyleSheets() |
| 214 { | 214 { |
| 215 collectFeatures(); | 215 collectFeatures(); |
| 216 | 216 |
| 217 if (document().layoutView() && document().layoutView()->style()) | 217 if (document().layoutView() && document().layoutView()->style()) |
| 218 document().layoutView()->style()->font().update(document().styleEngine()
.fontSelector()); | 218 document().layoutView()->style()->font().update(document().styleEngine()
.fontSelector()); |
| 219 | 219 |
| 220 collectViewportRules(); | 220 m_viewportStyleResolver->collectViewportRules(); |
| 221 | 221 |
| 222 document().styleEngine().resetCSSFeatureFlags(m_features); | 222 document().styleEngine().resetCSSFeatureFlags(m_features); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void StyleResolver::resetRuleFeatures() | 225 void StyleResolver::resetRuleFeatures() |
| 226 { | 226 { |
| 227 // Need to recreate RuleFeatureSet. | 227 // Need to recreate RuleFeatureSet. |
| 228 m_features.clear(); | 228 m_features.clear(); |
| 229 m_siblingRuleSet.clear(); | 229 m_siblingRuleSet.clear(); |
| 230 m_uncommonAttributeRuleSet.clear(); | 230 m_uncommonAttributeRuleSet.clear(); |
| 231 m_needCollectFeatures = true; | 231 m_needCollectFeatures = true; |
| 232 } | 232 } |
| 233 | 233 |
| 234 void StyleResolver::addTreeBoundaryCrossingScope(ContainerNode& scope) | 234 void StyleResolver::addTreeBoundaryCrossingScope(ContainerNode& scope) |
| 235 { | 235 { |
| 236 m_treeBoundaryCrossingRules.addScope(scope); | 236 m_treeBoundaryCrossingRules.addScope(scope); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void StyleResolver::resetAuthorStyle(TreeScope& treeScope) | 239 void StyleResolver::resetAuthorStyle(TreeScope& treeScope) |
| 240 { | 240 { |
| 241 m_treeBoundaryCrossingRules.removeScope(treeScope.rootNode()); | 241 m_treeBoundaryCrossingRules.removeScope(treeScope.rootNode()); |
| 242 resetRuleFeatures(); | 242 resetRuleFeatures(); |
| 243 | 243 |
| 244 ScopedStyleResolver* resolver = treeScope.scopedStyleResolver(); | 244 ScopedStyleResolver* resolver = treeScope.scopedStyleResolver(); |
| 245 if (!resolver) | 245 if (!resolver) |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 resolver->resetAuthorStyle(); | 248 if (treeScope.rootNode().isDocumentNode()) { |
| 249 if (treeScope.rootNode().isDocumentNode()) | 249 resolver->resetAuthorStyle(); |
| 250 return; | 250 return; |
| 251 } |
| 251 | 252 |
| 252 // resolver is going to be freed below. | 253 // resolver is going to be freed below. |
| 253 treeScope.clearScopedStyleResolver(); | 254 treeScope.clearScopedStyleResolver(); |
| 254 } | 255 } |
| 255 | 256 |
| 256 static PassOwnPtrWillBeRawPtr<RuleSet> makeRuleSet(const WillBeHeapVector<RuleFe
ature>& rules) | 257 static PassOwnPtrWillBeRawPtr<RuleSet> makeRuleSet(const WillBeHeapVector<RuleFe
ature>& rules) |
| 257 { | 258 { |
| 258 size_t size = rules.size(); | 259 size_t size = rules.size(); |
| 259 if (!size) | 260 if (!size) |
| 260 return nullptr; | 261 return nullptr; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 applyMatchedProperties<LowPropertyPriority>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); | 879 applyMatchedProperties<LowPropertyPriority>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); |
| 879 | 880 |
| 880 loadPendingResources(state); | 881 loadPendingResources(state); |
| 881 | 882 |
| 882 didAccess(); | 883 didAccess(); |
| 883 | 884 |
| 884 // Now return the style. | 885 // Now return the style. |
| 885 return state.takeStyle(); | 886 return state.takeStyle(); |
| 886 } | 887 } |
| 887 | 888 |
| 888 void StyleResolver::collectViewportRules() | |
| 889 { | |
| 890 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); | |
| 891 viewportStyleResolver()->collectViewportRules(defaultStyleSheets.defaultStyl
e(), ViewportStyleResolver::UserAgentOrigin); | |
| 892 | |
| 893 if (!InspectorInstrumentation::applyViewportStyleOverride(&document(), this)
) | |
| 894 viewportStyleResolver()->collectViewportRules(defaultStyleSheets.default
ViewportStyle(), ViewportStyleResolver::UserAgentOrigin); | |
| 895 | |
| 896 if (document().isMobileDocument()) | |
| 897 viewportStyleResolver()->collectViewportRules(defaultStyleSheets.default
XHTMLMobileProfileStyle(), ViewportStyleResolver::UserAgentOrigin); | |
| 898 | |
| 899 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) | |
| 900 scopedResolver->collectViewportRulesTo(this); | |
| 901 | |
| 902 viewportStyleResolver()->resolve(); | |
| 903 } | |
| 904 | |
| 905 PassRefPtr<LayoutStyle> StyleResolver::defaultStyleForElement() | 889 PassRefPtr<LayoutStyle> StyleResolver::defaultStyleForElement() |
| 906 { | 890 { |
| 907 RefPtr<LayoutStyle> style = LayoutStyle::create(); | 891 RefPtr<LayoutStyle> style = LayoutStyle::create(); |
| 908 FontBuilder fontBuilder(document()); | 892 FontBuilder fontBuilder(document()); |
| 909 fontBuilder.setInitial(style->effectiveZoom()); | 893 fontBuilder.setInitial(style->effectiveZoom()); |
| 910 fontBuilder.createFont(document().styleEngine().fontSelector(), *style); | 894 fontBuilder.createFont(document().styleEngine().fontSelector(), *style); |
| 911 return style.release(); | 895 return style.release(); |
| 912 } | 896 } |
| 913 | 897 |
| 914 PassRefPtr<LayoutStyle> StyleResolver::styleForText(Text* textNode) | 898 PassRefPtr<LayoutStyle> StyleResolver::styleForText(Text* textNode) |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); | 1297 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); |
| 1314 } | 1298 } |
| 1315 | 1299 |
| 1316 void StyleResolver::invalidateMatchedPropertiesCache() | 1300 void StyleResolver::invalidateMatchedPropertiesCache() |
| 1317 { | 1301 { |
| 1318 m_matchedPropertiesCache.clear(); | 1302 m_matchedPropertiesCache.clear(); |
| 1319 } | 1303 } |
| 1320 | 1304 |
| 1321 void StyleResolver::notifyResizeForViewportUnits() | 1305 void StyleResolver::notifyResizeForViewportUnits() |
| 1322 { | 1306 { |
| 1323 collectViewportRules(); | 1307 m_viewportStyleResolver->collectViewportRules(); |
| 1324 m_matchedPropertiesCache.clearViewportDependent(); | 1308 m_matchedPropertiesCache.clearViewportDependent(); |
| 1325 } | 1309 } |
| 1326 | 1310 |
| 1327 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult) | 1311 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult) |
| 1328 { | 1312 { |
| 1329 const Element* element = state.element(); | 1313 const Element* element = state.element(); |
| 1330 ASSERT(element); | 1314 ASSERT(element); |
| 1331 | 1315 |
| 1332 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply); | 1316 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply); |
| 1333 | 1317 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 visitor->trace(m_uncommonAttributeRuleSet); | 1499 visitor->trace(m_uncommonAttributeRuleSet); |
| 1516 visitor->trace(m_watchedSelectorsRules); | 1500 visitor->trace(m_watchedSelectorsRules); |
| 1517 visitor->trace(m_treeBoundaryCrossingRules); | 1501 visitor->trace(m_treeBoundaryCrossingRules); |
| 1518 visitor->trace(m_styleSharingLists); | 1502 visitor->trace(m_styleSharingLists); |
| 1519 visitor->trace(m_pendingStyleSheets); | 1503 visitor->trace(m_pendingStyleSheets); |
| 1520 visitor->trace(m_document); | 1504 visitor->trace(m_document); |
| 1521 #endif | 1505 #endif |
| 1522 } | 1506 } |
| 1523 | 1507 |
| 1524 } // namespace blink | 1508 } // namespace blink |
| OLD | NEW |