Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 #include "core/css/CSSRuleList.h" | 50 #include "core/css/CSSRuleList.h" |
| 51 #include "core/css/CSSSelector.h" | 51 #include "core/css/CSSSelector.h" |
| 52 #include "core/css/CSSStyleRule.h" | 52 #include "core/css/CSSStyleRule.h" |
| 53 #include "core/css/CSSValueList.h" | 53 #include "core/css/CSSValueList.h" |
| 54 #include "core/css/CSSVariableValue.h" | 54 #include "core/css/CSSVariableValue.h" |
| 55 #include "core/css/ElementRuleCollector.h" | 55 #include "core/css/ElementRuleCollector.h" |
| 56 #include "core/css/MediaQueryEvaluator.h" | 56 #include "core/css/MediaQueryEvaluator.h" |
| 57 #include "core/css/PageRuleCollector.h" | 57 #include "core/css/PageRuleCollector.h" |
| 58 #include "core/css/RuleSet.h" | 58 #include "core/css/RuleSet.h" |
| 59 #include "core/css/StylePropertySet.h" | 59 #include "core/css/StylePropertySet.h" |
| 60 #include "core/css/StyleRuleImport.h" | |
| 61 #include "core/css/StyleSheetContents.h" | |
| 60 #include "core/css/resolver/AnimatedStyleBuilder.h" | 62 #include "core/css/resolver/AnimatedStyleBuilder.h" |
| 61 #include "core/css/resolver/MatchResult.h" | 63 #include "core/css/resolver/MatchResult.h" |
| 62 #include "core/css/resolver/MediaQueryResult.h" | 64 #include "core/css/resolver/MediaQueryResult.h" |
| 63 #include "core/css/resolver/SharedStyleFinder.h" | 65 #include "core/css/resolver/SharedStyleFinder.h" |
| 64 #include "core/css/resolver/StyleAdjuster.h" | 66 #include "core/css/resolver/StyleAdjuster.h" |
| 65 #include "core/css/resolver/StyleBuilder.h" | 67 #include "core/css/resolver/StyleBuilder.h" |
| 66 #include "core/css/resolver/ViewportStyleResolver.h" | 68 #include "core/css/resolver/ViewportStyleResolver.h" |
| 67 #include "core/dom/CSSSelectorWatch.h" | 69 #include "core/dom/CSSSelectorWatch.h" |
| 68 #include "core/dom/NodeRenderStyle.h" | 70 #include "core/dom/NodeRenderStyle.h" |
| 69 #include "core/dom/StyleEngine.h" | 71 #include "core/dom/StyleEngine.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); | 134 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); |
| 133 return rightToLeftDecl.get(); | 135 return rightToLeftDecl.get(); |
| 134 } | 136 } |
| 135 | 137 |
| 136 StyleResolver::StyleResolver(Document& document, bool matchAuthorAndUserStyles) | 138 StyleResolver::StyleResolver(Document& document, bool matchAuthorAndUserStyles) |
| 137 : m_document(document) | 139 : m_document(document) |
| 138 , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles) | 140 , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles) |
| 139 , m_fontSelector(CSSFontSelector::create(&document)) | 141 , m_fontSelector(CSSFontSelector::create(&document)) |
| 140 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) | 142 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) |
| 141 , m_styleResourceLoader(document.fetcher()) | 143 , m_styleResourceLoader(document.fetcher()) |
| 144 , m_needCollectFeatures(false) | |
| 142 { | 145 { |
| 143 Element* root = document.documentElement(); | 146 Element* root = document.documentElement(); |
| 144 | 147 |
| 145 m_fontSelector->registerForInvalidationCallbacks(this); | 148 m_fontSelector->registerForInvalidationCallbacks(this); |
| 146 | 149 |
| 147 CSSDefaultStyleSheets::initDefaultStyle(root); | 150 CSSDefaultStyleSheets::initDefaultStyle(root); |
| 148 | 151 |
| 149 // construct document root element default style. this is needed | 152 // construct document root element default style. this is needed |
| 150 // to evaluate media queries that contain relative constraints, like "screen and (max-width: 10em)" | 153 // to evaluate media queries that contain relative constraints, like "screen and (max-width: 10em)" |
| 151 // This is here instead of constructor, because when constructor is run, | 154 // This is here instead of constructor, because when constructor is run, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 174 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx tensions()->svgFontFaceElements(); | 177 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx tensions()->svgFontFaceElements(); |
| 175 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); | 178 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); |
| 176 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) | 179 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) |
| 177 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); | 180 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); |
| 178 } | 181 } |
| 179 #endif | 182 #endif |
| 180 | 183 |
| 181 styleSheetCollection->appendActiveAuthorStyleSheets(this); | 184 styleSheetCollection->appendActiveAuthorStyleSheets(this); |
| 182 } | 185 } |
| 183 | 186 |
| 187 bool rulesHaveViewportOrFontFaceRule(const Vector<RefPtr<StyleRuleBase> >& rules ) | |
|
esprehn
2013/10/25 02:37:58
These are missing static.
tasak
2013/10/25 10:10:10
Yeah, thanks.
Done.
| |
| 188 { | |
| 189 for (unsigned i = 0; i < rules.size(); ++i) { | |
| 190 StyleRuleBase* rule = rules[i].get(); | |
| 191 if (rule->isFontFaceRule() || rule->isViewportRule()) | |
| 192 return true; | |
| 193 } | |
| 194 return false; | |
| 195 } | |
| 196 | |
| 197 bool styleSheetHasViewportOrFontFaceRule(StyleSheetContents* sheet) | |
|
esprehn
2013/10/25 02:37:58
static
tasak
2013/10/25 10:10:10
Done.
| |
| 198 { | |
| 199 if (!sheet) | |
| 200 return false; | |
| 201 | |
| 202 if (sheet->importRules().size() > 0) { | |
| 203 const Vector<RefPtr<StyleRuleImport> >& importRules = sheet->importRules (); | |
| 204 for (unsigned i = 0; i < importRules.size(); ++i) { | |
| 205 StyleRuleImport* importRule = importRules[i].get(); | |
| 206 if (styleSheetHasViewportOrFontFaceRule(importRule->styleSheet())) | |
| 207 return true; | |
| 208 } | |
| 209 } | |
| 210 return rulesHaveViewportOrFontFaceRule(sheet->childRules()); | |
| 211 } | |
| 212 | |
| 213 bool canAppendAuthorStyleSheetsLazily(unsigned firstNew, const Vector<RefPtr<CSS StyleSheet> >& styleSheets) | |
|
esprehn
2013/10/25 02:37:58
static
tasak
2013/10/25 10:10:10
Done.
| |
| 214 { | |
| 215 unsigned size = styleSheets.size(); | |
| 216 for (unsigned i = firstNew; i < size; ++i) { | |
| 217 if (styleSheetHasViewportOrFontFaceRule(styleSheets[i]->contents())) | |
| 218 return false; | |
| 219 } | |
| 220 return true; | |
| 221 } | |
| 222 | |
| 223 void StyleResolver::lazyAppendAuthorStyleSheets(unsigned firstNew, const Vector< RefPtr<CSSStyleSheet> >& styleSheets) | |
| 224 { | |
| 225 // We cannot lazy apppend stylesheets if the sheets have @viewport and @font -face rules. | |
|
esprehn
2013/10/25 02:37:58
extra p in append. Also why can't we lazy append t
tasak
2013/10/25 10:10:10
Yeah, I agree that we should solve in a future pat
| |
| 226 bool canLazyAppend = canAppendAuthorStyleSheetsLazily(firstNew, styleSheets) ; | |
| 227 | |
| 228 unsigned size = styleSheets.size(); | |
| 229 for (unsigned i = firstNew; i < size; ++i) | |
| 230 m_pendingStyleSheets.add(styleSheets[i].get()); | |
| 231 | |
| 232 if (!canLazyAppend) | |
| 233 appendPendingAuthorStyleSheets(); | |
| 234 } | |
| 235 | |
| 236 void StyleResolver::removePendingAuthorStyleSheets(const Vector<RefPtr<CSSStyleS heet> >& styleSheets) | |
| 237 { | |
| 238 for (unsigned i = i; i < styleSheets.size(); ++i) | |
| 239 m_pendingStyleSheets.remove(styleSheets[i].get()); | |
| 240 } | |
| 241 | |
| 242 void StyleResolver::appendPendingAuthorStyleSheets() | |
| 243 { | |
| 244 setBuildScopedStyleTreeInDocumentOrder(false); | |
| 245 for (ListHashSet<CSSStyleSheet*, 16>::iterator it = m_pendingStyleSheets.beg in(); it != m_pendingStyleSheets.end(); ++it) { | |
| 246 CSSStyleSheet* cssSheet = *it; | |
| 247 ASSERT(!cssSheet->disabled()); | |
| 248 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries() , &m_viewportDependentMediaQueryResults)) | |
| 249 continue; | |
| 250 | |
| 251 StyleSheetContents* sheet = cssSheet->contents(); | |
| 252 const ContainerNode* scopingNode = ScopedStyleResolver::scopingNodeFor(c ssSheet); | |
| 253 if (!scopingNode && cssSheet->ownerNode() && cssSheet->ownerNode()->isIn ShadowTree()) | |
| 254 continue; | |
|
esprehn
2013/10/25 02:37:58
What's this case for?
tasak
2013/10/25 10:10:10
c.f. fast/dom/shadow/remove-styles-in-shadow-crash
| |
| 255 | |
| 256 ScopedStyleResolver* resolver = ensureScopedStyleResolver(scopingNode); | |
| 257 ASSERT(resolver); | |
| 258 resolver->addRulesFromSheet(sheet, *m_medium, this); | |
| 259 m_inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet); | |
| 260 } | |
| 261 m_pendingStyleSheets.clear(); | |
| 262 finishAppendAuthorStyleSheets(); | |
| 263 } | |
| 264 | |
| 184 void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefP tr<CSSStyleSheet> >& styleSheets) | 265 void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefP tr<CSSStyleSheet> >& styleSheets) |
| 185 { | 266 { |
| 186 // This handles sheets added to the end of the stylesheet list only. In othe r cases the style resolver | 267 // This handles sheets added to the end of the stylesheet list only. In othe r cases the style resolver |
| 187 // needs to be reconstructed. To handle insertions too the rule order number s would need to be updated. | 268 // needs to be reconstructed. To handle insertions too the rule order number s would need to be updated. |
| 188 unsigned size = styleSheets.size(); | 269 unsigned size = styleSheets.size(); |
| 189 for (unsigned i = firstNew; i < size; ++i) { | 270 for (unsigned i = firstNew; i < size; ++i) { |
| 190 CSSStyleSheet* cssSheet = styleSheets[i].get(); | 271 CSSStyleSheet* cssSheet = styleSheets[i].get(); |
| 191 ASSERT(!cssSheet->disabled()); | 272 ASSERT(!cssSheet->disabled()); |
| 192 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries() , &m_viewportDependentMediaQueryResults)) | 273 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries() , &m_viewportDependentMediaQueryResults)) |
| 193 continue; | 274 continue; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 205 } | 286 } |
| 206 | 287 |
| 207 void StyleResolver::finishAppendAuthorStyleSheets() | 288 void StyleResolver::finishAppendAuthorStyleSheets() |
| 208 { | 289 { |
| 209 collectFeatures(); | 290 collectFeatures(); |
| 210 | 291 |
| 211 if (document().renderer() && document().renderer()->style()) | 292 if (document().renderer() && document().renderer()->style()) |
| 212 document().renderer()->style()->font().update(fontSelector()); | 293 document().renderer()->style()->font().update(fontSelector()); |
| 213 | 294 |
| 214 collectViewportRules(); | 295 collectViewportRules(); |
| 296 | |
| 297 document().styleEngine()->resetCSSFeatureFlags(ruleFeatureSet()); | |
| 298 } | |
| 299 | |
| 300 void StyleResolver::resetRuleFeatures() | |
| 301 { | |
| 302 // Need to recreate RuleFeatureSet. | |
| 303 m_features.clear(); | |
| 304 m_siblingRuleSet.clear(); | |
| 305 m_uncommonAttributeRuleSet.clear(); | |
| 306 m_needCollectFeatures = true; | |
| 215 } | 307 } |
| 216 | 308 |
| 217 void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode) | 309 void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode) |
| 218 { | 310 { |
| 219 // FIXME: When chanking scoped attribute, scopingNode's hasScopedHTMLStyleCh ild has been already modified. | 311 // FIXME: When chanking scoped attribute, scopingNode's hasScopedHTMLStyleCh ild has been already modified. |
| 220 // So we cannot use hasScopedHTMLStyleChild flag here. | 312 // So we cannot use hasScopedHTMLStyleChild flag here. |
| 221 ScopedStyleResolver* resolver = scopingNode ? m_styleTree.lookupScopedStyleR esolverFor(scopingNode) : m_styleTree.scopedStyleResolverForDocument(); | 313 ScopedStyleResolver* resolver = scopingNode ? m_styleTree.lookupScopedStyleR esolverFor(scopingNode) : m_styleTree.scopedStyleResolverForDocument(); |
| 222 if (!resolver) | 314 if (!resolver) |
| 223 return; | 315 return; |
| 224 | 316 |
| 225 m_ruleSets.shadowDistributedRules().reset(scopingNode); | 317 m_ruleSets.shadowDistributedRules().reset(scopingNode); |
| 226 | 318 |
| 227 resolver->resetAuthorStyle(); | 319 resolver->resetAuthorStyle(); |
| 320 resetRuleFeatures(); | |
| 228 if (!scopingNode) | 321 if (!scopingNode) |
| 229 return; | 322 return; |
| 230 | 323 |
| 231 if (scopingNode->isShadowRoot()) | 324 if (scopingNode->isShadowRoot()) |
| 232 resetAtHostRules(scopingNode); | 325 resetAtHostRules(scopingNode); |
| 233 | 326 |
| 234 if (!resolver->hasOnlyEmptyRuleSets()) | 327 if (!resolver->hasOnlyEmptyRuleSets()) |
| 235 return; | 328 return; |
| 236 | 329 |
| 237 m_styleTree.remove(scopingNode); | 330 m_styleTree.remove(scopingNode); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 268 } | 361 } |
| 269 | 362 |
| 270 void StyleResolver::collectFeatures() | 363 void StyleResolver::collectFeatures() |
| 271 { | 364 { |
| 272 m_features.clear(); | 365 m_features.clear(); |
| 273 m_ruleSets.collectFeaturesTo(m_features, document().isViewSource()); | 366 m_ruleSets.collectFeaturesTo(m_features, document().isViewSource()); |
| 274 m_styleTree.collectFeaturesTo(m_features); | 367 m_styleTree.collectFeaturesTo(m_features); |
| 275 | 368 |
| 276 m_siblingRuleSet = makeRuleSet(m_features.siblingRules); | 369 m_siblingRuleSet = makeRuleSet(m_features.siblingRules); |
| 277 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); | 370 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); |
| 371 m_needCollectFeatures = false; | |
| 278 } | 372 } |
| 279 | 373 |
| 280 bool StyleResolver::hasRulesForId(const AtomicString& id) const | 374 bool StyleResolver::hasRulesForId(const AtomicString& id) const |
| 281 { | 375 { |
| 282 return m_features.idsInRules.contains(id.impl()); | 376 return m_features.idsInRules.contains(id.impl()); |
| 283 } | 377 } |
| 284 | 378 |
| 285 void StyleResolver::addToStyleSharingList(Element* element) | 379 void StyleResolver::addToStyleSharingList(Element* element) |
| 286 { | 380 { |
| 287 if (m_styleSharingList.size() >= styleSharingListSize) | 381 if (m_styleSharingList.size() >= styleSharingListSize) |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 { | 688 { |
| 595 for (size_t i = 0; i < contentAttrValues.size(); ++i) | 689 for (size_t i = 0; i < contentAttrValues.size(); ++i) |
| 596 features.attrsInRules.add(contentAttrValues[i].impl()); | 690 features.attrsInRules.add(contentAttrValues[i].impl()); |
| 597 } | 691 } |
| 598 | 692 |
| 599 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior, | 693 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior, |
| 600 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) | 694 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) |
| 601 { | 695 { |
| 602 ASSERT(document().frame()); | 696 ASSERT(document().frame()); |
| 603 ASSERT(documentSettings()); | 697 ASSERT(documentSettings()); |
| 698 ASSERT(!hasPendingAuthorStyleSheets()); | |
| 699 ASSERT(!m_needCollectFeatures); | |
| 604 | 700 |
| 605 // Once an element has a renderer, we don't try to destroy it, since otherwi se the renderer | 701 // Once an element has a renderer, we don't try to destroy it, since otherwi se the renderer |
| 606 // will vanish if a style recalc happens during loading. | 702 // will vanish if a style recalc happens during loading. |
| 607 if (sharingBehavior == AllowStyleSharing && !element->document().haveStylesh eetsLoaded() && !element->renderer()) { | 703 if (sharingBehavior == AllowStyleSharing && !element->document().haveStylesh eetsLoaded() && !element->renderer()) { |
| 608 if (!s_styleNotYetAvailable) { | 704 if (!s_styleNotYetAvailable) { |
| 609 s_styleNotYetAvailable = RenderStyle::create().leakRef(); | 705 s_styleNotYetAvailable = RenderStyle::create().leakRef(); |
| 610 s_styleNotYetAvailable->setDisplay(NONE); | 706 s_styleNotYetAvailable->setDisplay(NONE); |
| 611 s_styleNotYetAvailable->font().update(m_fontSelector); | 707 s_styleNotYetAvailable->font().update(m_fontSelector); |
| 612 } | 708 } |
| 613 element->document().setHasNodesWithPlaceholderStyle(); | 709 element->document().setHasNodesWithPlaceholderStyle(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 element->ensureActiveAnimations()->cssAnimations().setPendingUpdate(stat e.takeAnimationUpdate()); | 786 element->ensureActiveAnimations()->cssAnimations().setPendingUpdate(stat e.takeAnimationUpdate()); |
| 691 | 787 |
| 692 // Now return the style. | 788 // Now return the style. |
| 693 return state.takeStyle(); | 789 return state.takeStyle(); |
| 694 } | 790 } |
| 695 | 791 |
| 696 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const Render Style* elementStyle, const StyleKeyframe* keyframe) | 792 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const Render Style* elementStyle, const StyleKeyframe* keyframe) |
| 697 { | 793 { |
| 698 ASSERT(document().frame()); | 794 ASSERT(document().frame()); |
| 699 ASSERT(documentSettings()); | 795 ASSERT(documentSettings()); |
| 796 ASSERT(!hasPendingAuthorStyleSheets()); | |
| 700 | 797 |
| 701 if (e == document().documentElement()) | 798 if (e == document().documentElement()) |
| 702 resetDirectionAndWritingModeOnDocument(document()); | 799 resetDirectionAndWritingModeOnDocument(document()); |
| 703 StyleResolverState state(document(), e); | 800 StyleResolverState state(document(), e); |
| 704 | 801 |
| 705 MatchResult result; | 802 MatchResult result; |
| 706 if (keyframe->properties()) | 803 if (keyframe->properties()) |
| 707 result.addMatchedProperties(keyframe->properties()); | 804 result.addMatchedProperties(keyframe->properties()); |
| 708 | 805 |
| 709 ASSERT(!state.style()); | 806 ASSERT(!state.style()); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 } | 1131 } |
| 1035 | 1132 |
| 1036 document().didAccessStyleResolver(); | 1133 document().didAccessStyleResolver(); |
| 1037 | 1134 |
| 1038 // Now return the style. | 1135 // Now return the style. |
| 1039 return state.takeStyle(); | 1136 return state.takeStyle(); |
| 1040 } | 1137 } |
| 1041 | 1138 |
| 1042 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) | 1139 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) |
| 1043 { | 1140 { |
| 1141 ASSERT(!hasPendingAuthorStyleSheets()); | |
| 1044 resetDirectionAndWritingModeOnDocument(document()); | 1142 resetDirectionAndWritingModeOnDocument(document()); |
| 1045 StyleResolverState state(document(), document().documentElement()); // m_roo tElementStyle will be set to the document style. | 1143 StyleResolverState state(document(), document().documentElement()); // m_roo tElementStyle will be set to the document style. |
| 1046 | 1144 |
| 1047 state.setStyle(RenderStyle::create()); | 1145 state.setStyle(RenderStyle::create()); |
| 1048 const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootE lementStyle() : document().renderStyle(); | 1146 const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootE lementStyle() : document().renderStyle(); |
| 1049 ASSERT(rootElementStyle); | 1147 ASSERT(rootElementStyle); |
| 1050 state.style()->inheritFrom(rootElementStyle); | 1148 state.style()->inheritFrom(rootElementStyle); |
| 1051 | 1149 |
| 1052 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules()); | 1150 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules()); |
| 1053 | 1151 |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1567 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); | 1665 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); |
| 1568 | 1666 |
| 1569 fprintf(stderr, "Total:\n"); | 1667 fprintf(stderr, "Total:\n"); |
| 1570 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, | 1668 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, |
| 1571 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); | 1669 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); |
| 1572 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); | 1670 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); |
| 1573 } | 1671 } |
| 1574 #endif | 1672 #endif |
| 1575 | 1673 |
| 1576 } // namespace WebCore | 1674 } // namespace WebCore |
| OLD | NEW |