| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 m_medium = adoptPtr(new MediaQueryEvaluator("all")); | 166 m_medium = adoptPtr(new MediaQueryEvaluator("all")); |
| 167 | 167 |
| 168 if (root) | 168 if (root) |
| 169 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc
hOnlyUserAgentRules); | 169 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc
hOnlyUserAgentRules); |
| 170 | 170 |
| 171 if (m_rootDefaultStyle && view) | 171 if (m_rootDefaultStyle && view) |
| 172 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), &view->fr
ame(), m_rootDefaultStyle.get())); | 172 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), &view->fr
ame(), m_rootDefaultStyle.get())); |
| 173 | 173 |
| 174 m_styleTree.clear(); | 174 m_styleTree.clear(); |
| 175 | 175 |
| 176 StyleEngine* styleSheetCollection = document.styleEngine(); | 176 m_ruleSets.initWatchedSelectorRules(CSSSelectorWatch::from(document).watched
CallbackSelectors()); |
| 177 m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(docume
nt).watchedCallbackSelectors(), *m_medium, *this); | |
| 178 | 177 |
| 179 #if ENABLE(SVG_FONTS) | 178 #if ENABLE(SVG_FONTS) |
| 180 if (document.svgExtensions()) { | 179 if (document.svgExtensions()) { |
| 181 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx
tensions()->svgFontFaceElements(); | 180 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx
tensions()->svgFontFaceElements(); |
| 182 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e
nd(); | 181 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e
nd(); |
| 183 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen
ts.begin(); it != end; ++it) | 182 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen
ts.begin(); it != end; ++it) |
| 184 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); | 183 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); |
| 185 } | 184 } |
| 186 #endif | 185 #endif |
| 187 | 186 |
| 188 styleSheetCollection->appendActiveAuthorStyleSheets(this); | 187 document.styleEngine()->appendActiveAuthorStyleSheets(this); |
| 189 } | 188 } |
| 190 | 189 |
| 191 void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefP
tr<CSSStyleSheet> >& styleSheets) | 190 void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefP
tr<CSSStyleSheet> >& styleSheets) |
| 192 { | 191 { |
| 193 // This handles sheets added to the end of the stylesheet list only. In othe
r cases the style resolver | 192 // This handles sheets added to the end of the stylesheet list only. In othe
r cases the style resolver |
| 194 // needs to be reconstructed. To handle insertions too the rule order number
s would need to be updated. | 193 // needs to be reconstructed. To handle insertions too the rule order number
s would need to be updated. |
| 195 unsigned size = styleSheets.size(); | 194 unsigned size = styleSheets.size(); |
| 196 for (unsigned i = firstNew; i < size; ++i) { | 195 for (unsigned i = firstNew; i < size; ++i) { |
| 197 CSSStyleSheet* cssSheet = styleSheets[i].get(); | 196 CSSStyleSheet* cssSheet = styleSheets[i].get(); |
| 198 ASSERT(!cssSheet->disabled()); | 197 ASSERT(!cssSheet->disabled()); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // FIXME: Need to clarify how to treat style scoped. | 469 // FIXME: Need to clarify how to treat style scoped. |
| 471 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply
AuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && r
esolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder); | 470 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply
AuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && r
esolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder); |
| 472 } | 471 } |
| 473 | 472 |
| 474 collectTreeBoundaryCrossingRules(collector, includeEmptyRules); | 473 collectTreeBoundaryCrossingRules(collector, includeEmptyRules); |
| 475 collector.sortAndTransferMatchedRules(); | 474 collector.sortAndTransferMatchedRules(); |
| 476 | 475 |
| 477 matchHostRules(element, resolvers.first(), collector, includeEmptyRules); | 476 matchHostRules(element, resolvers.first(), collector, includeEmptyRules); |
| 478 } | 477 } |
| 479 | 478 |
| 480 void StyleResolver::matchUserRules(ElementRuleCollector& collector, bool include
EmptyRules) | 479 void StyleResolver::matchWatchSelectorRules(ElementRuleCollector& collector) |
| 481 { | 480 { |
| 482 if (!m_ruleSets.userStyle()) | 481 if (!m_ruleSets.watchedSelectorRules()) |
| 483 return; | 482 return; |
| 484 | 483 |
| 485 collector.clearMatchedRules(); | 484 collector.clearMatchedRules(); |
| 486 collector.matchedResult().ranges.lastUserRule = collector.matchedResult().ma
tchedProperties.size() - 1; | 485 collector.matchedResult().ranges.lastUserRule = collector.matchedResult().ma
tchedProperties.size() - 1; |
| 487 | 486 |
| 488 MatchRequest matchRequest(m_ruleSets.userStyle(), includeEmptyRules); | 487 MatchRequest matchRequest(m_ruleSets.watchedSelectorRules()); |
| 489 RuleRange ruleRange = collector.matchedResult().ranges.userRuleRange(); | 488 RuleRange ruleRange = collector.matchedResult().ranges.userRuleRange(); |
| 490 collector.collectMatchingRules(matchRequest, ruleRange); | 489 collector.collectMatchingRules(matchRequest, ruleRange); |
| 491 collector.collectMatchingRulesForRegion(matchRequest, ruleRange); | 490 collector.collectMatchingRulesForRegion(matchRequest, ruleRange); |
| 492 | 491 |
| 493 collector.sortAndTransferMatchedRules(); | 492 collector.sortAndTransferMatchedRules(); |
| 494 } | 493 } |
| 495 | 494 |
| 496 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 495 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 497 { | 496 { |
| 498 collector.setMatchingUARules(true); | 497 collector.setMatchingUARules(true); |
| 499 | 498 |
| 500 // First we match rules from the user agent sheet. | 499 // First we match rules from the user agent sheet. |
| 501 if (CSSDefaultStyleSheets::simpleDefaultStyleSheet) | 500 if (CSSDefaultStyleSheets::simpleDefaultStyleSheet) |
| 502 collector.matchedResult().isCacheable = false; | 501 collector.matchedResult().isCacheable = false; |
| 503 | 502 |
| 504 RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print") | 503 RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print") |
| 505 ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defa
ultStyle; | 504 ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defa
ultStyle; |
| 506 matchUARules(collector, userAgentStyleSheet); | 505 matchUARules(collector, userAgentStyleSheet); |
| 507 | 506 |
| 508 // In quirks mode, we match rules from the quirks user agent sheet. | 507 // In quirks mode, we match rules from the quirks user agent sheet. |
| 509 if (document().inQuirksMode()) | 508 if (document().inQuirksMode()) |
| 510 matchUARules(collector, CSSDefaultStyleSheets::defaultQuirksStyle); | 509 matchUARules(collector, CSSDefaultStyleSheets::defaultQuirksStyle); |
| 511 | 510 |
| 512 // If document uses view source styles (in view source mode or in xml viewer
mode), then we match rules from the view source style sheet. | 511 // If document uses view source styles (in view source mode or in xml viewer
mode), then we match rules from the view source style sheet. |
| 513 if (document().isViewSource()) | 512 if (document().isViewSource()) |
| 514 matchUARules(collector, CSSDefaultStyleSheets::viewSourceStyle()); | 513 matchUARules(collector, CSSDefaultStyleSheets::viewSourceStyle()); |
| 515 | 514 |
| 516 collector.setMatchingUARules(false); | 515 collector.setMatchingUARules(false); |
| 516 |
| 517 matchWatchSelectorRules(collector); |
| 517 } | 518 } |
| 518 | 519 |
| 519 void StyleResolver::matchUARules(ElementRuleCollector& collector, RuleSet* rules
) | 520 void StyleResolver::matchUARules(ElementRuleCollector& collector, RuleSet* rules
) |
| 520 { | 521 { |
| 521 collector.clearMatchedRules(); | 522 collector.clearMatchedRules(); |
| 522 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; | 523 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; |
| 523 | 524 |
| 524 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); | 525 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); |
| 525 collector.collectMatchingRules(MatchRequest(rules), ruleRange); | 526 collector.collectMatchingRules(MatchRequest(rules), ruleRange); |
| 526 | 527 |
| 527 collector.sortAndTransferMatchedRules(); | 528 collector.sortAndTransferMatchedRules(); |
| 528 } | 529 } |
| 529 | 530 |
| 530 void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
r& collector, bool includeSMILProperties) | 531 void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
r& collector, bool includeSMILProperties) |
| 531 { | 532 { |
| 532 matchUARules(collector); | 533 matchUARules(collector); |
| 533 matchUserRules(collector, false); | |
| 534 | 534 |
| 535 // Now check author rules, beginning first with presentational attributes ma
pped from HTML. | 535 // Now check author rules, beginning first with presentational attributes ma
pped from HTML. |
| 536 if (state.element()->isStyledElement()) { | 536 if (state.element()->isStyledElement()) { |
| 537 collector.addElementStyleProperties(state.element()->presentationAttribu
teStyle()); | 537 collector.addElementStyleProperties(state.element()->presentationAttribu
teStyle()); |
| 538 | 538 |
| 539 // Now we check additional mapped declarations. | 539 // Now we check additional mapped declarations. |
| 540 // Tables and table cells share an additional mapped rule that must be a
pplied | 540 // Tables and table cells share an additional mapped rule that must be a
pplied |
| 541 // after all attributes, since their mapped style depends on the values
of multiple attributes. | 541 // after all attributes, since their mapped style depends on the values
of multiple attributes. |
| 542 collector.addElementStyleProperties(state.element()->additionalPresentat
ionAttributeStyle()); | 542 collector.addElementStyleProperties(state.element()->additionalPresentat
ionAttributeStyle()); |
| 543 | 543 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 | 1027 |
| 1028 // Since we don't use pseudo-elements in any of our quirk/print | 1028 // Since we don't use pseudo-elements in any of our quirk/print |
| 1029 // user agent rules, don't waste time walking those rules. | 1029 // user agent rules, don't waste time walking those rules. |
| 1030 | 1030 |
| 1031 { | 1031 { |
| 1032 // Check UA, user and author rules. | 1032 // Check UA, user and author rules. |
| 1033 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 1033 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 1034 collector.setPseudoStyleRequest(pseudoStyleRequest); | 1034 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 1035 | 1035 |
| 1036 matchUARules(collector); | 1036 matchUARules(collector); |
| 1037 matchUserRules(collector, false); | |
| 1038 matchAuthorRules(state.element(), collector, false); | 1037 matchAuthorRules(state.element(), collector, false); |
| 1039 | 1038 |
| 1040 if (collector.matchedResult().matchedProperties.isEmpty()) | 1039 if (collector.matchedResult().matchedProperties.isEmpty()) |
| 1041 return 0; | 1040 return 0; |
| 1042 | 1041 |
| 1043 state.style()->setStyleType(pseudoStyleRequest.pseudoId); | 1042 state.style()->setStyleType(pseudoStyleRequest.pseudoId); |
| 1044 | 1043 |
| 1045 applyMatchedProperties(state, collector.matchedResult(), e->pseudoElemen
t(pseudoStyleRequest.pseudoId)); | 1044 applyMatchedProperties(state, collector.matchedResult(), e->pseudoElemen
t(pseudoStyleRequest.pseudoId)); |
| 1046 | 1045 |
| 1047 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); | 1046 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1070 state.setStyle(RenderStyle::create()); | 1069 state.setStyle(RenderStyle::create()); |
| 1071 const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootE
lementStyle() : document().renderStyle(); | 1070 const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootE
lementStyle() : document().renderStyle(); |
| 1072 ASSERT(rootElementStyle); | 1071 ASSERT(rootElementStyle); |
| 1073 state.style()->inheritFrom(rootElementStyle); | 1072 state.style()->inheritFrom(rootElementStyle); |
| 1074 | 1073 |
| 1075 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta
te.useSVGZoomRules()); | 1074 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta
te.useSVGZoomRules()); |
| 1076 | 1075 |
| 1077 PageRuleCollector collector(rootElementStyle, pageIndex); | 1076 PageRuleCollector collector(rootElementStyle, pageIndex); |
| 1078 | 1077 |
| 1079 collector.matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle); | 1078 collector.matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle); |
| 1080 collector.matchPageRules(m_ruleSets.userStyle()); | |
| 1081 | 1079 |
| 1082 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) | 1080 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) |
| 1083 scopedResolver->matchPageRules(collector); | 1081 scopedResolver->matchPageRules(collector); |
| 1084 | 1082 |
| 1085 state.setLineHeightValue(0); | 1083 state.setLineHeightValue(0); |
| 1086 bool inheritedOnly = false; | 1084 bool inheritedOnly = false; |
| 1087 | 1085 |
| 1088 MatchResult& result = collector.matchedResult(); | 1086 MatchResult& result = collector.matchedResult(); |
| 1089 applyMatchedProperties<VariableDefinitions>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); | 1087 applyMatchedProperties<VariableDefinitions>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); |
| 1090 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu
lt.matchedProperties.size() - 1, inheritedOnly); | 1088 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu
lt.matchedProperties.size() - 1, inheritedOnly); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1109 return state.takeStyle(); | 1107 return state.takeStyle(); |
| 1110 } | 1108 } |
| 1111 | 1109 |
| 1112 void StyleResolver::collectViewportRules() | 1110 void StyleResolver::collectViewportRules() |
| 1113 { | 1111 { |
| 1114 viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::default
Style, ViewportStyleResolver::UserAgentOrigin); | 1112 viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::default
Style, ViewportStyleResolver::UserAgentOrigin); |
| 1115 | 1113 |
| 1116 if (document().isMobileDocument()) | 1114 if (document().isMobileDocument()) |
| 1117 viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::xht
mlMobileProfileStyle(), ViewportStyleResolver::UserAgentOrigin); | 1115 viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::xht
mlMobileProfileStyle(), ViewportStyleResolver::UserAgentOrigin); |
| 1118 | 1116 |
| 1119 if (m_ruleSets.userStyle()) | |
| 1120 viewportStyleResolver()->collectViewportRules(m_ruleSets.userStyle(), Vi
ewportStyleResolver::UserAgentOrigin); | |
| 1121 | |
| 1122 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) | 1117 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) |
| 1123 scopedResolver->collectViewportRulesTo(this); | 1118 scopedResolver->collectViewportRulesTo(this); |
| 1124 | 1119 |
| 1125 viewportStyleResolver()->resolve(); | 1120 viewportStyleResolver()->resolve(); |
| 1126 } | 1121 } |
| 1127 | 1122 |
| 1128 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 1123 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
| 1129 { | 1124 { |
| 1130 StyleResolverState state(document(), 0); | 1125 StyleResolverState state(document(), 0); |
| 1131 state.setStyle(RenderStyle::create()); | 1126 state.setStyle(RenderStyle::create()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1145 Node* parentNode = NodeRenderingTraversal::parent(textNode, &parentDetails); | 1140 Node* parentNode = NodeRenderingTraversal::parent(textNode, &parentDetails); |
| 1146 if (!parentNode || !parentNode->renderStyle() || parentDetails.resetStyleInh
eritance()) | 1141 if (!parentNode || !parentNode->renderStyle() || parentDetails.resetStyleInh
eritance()) |
| 1147 return defaultStyleForElement(); | 1142 return defaultStyleForElement(); |
| 1148 return parentNode->renderStyle(); | 1143 return parentNode->renderStyle(); |
| 1149 } | 1144 } |
| 1150 | 1145 |
| 1151 bool StyleResolver::checkRegionStyle(Element* regionElement) | 1146 bool StyleResolver::checkRegionStyle(Element* regionElement) |
| 1152 { | 1147 { |
| 1153 // FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style she
ets for the moment, | 1148 // FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style she
ets for the moment, |
| 1154 // so all region rules are global by default. Verify whether that can stand
or needs changing. | 1149 // so all region rules are global by default. Verify whether that can stand
or needs changing. |
| 1155 | 1150 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) { |
| 1156 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) | |
| 1157 if (scopedResolver->checkRegionStyle(regionElement)) | 1151 if (scopedResolver->checkRegionStyle(regionElement)) |
| 1158 return true; | 1152 return true; |
| 1159 | |
| 1160 if (m_ruleSets.userStyle()) { | |
| 1161 unsigned rulesSize = m_ruleSets.userStyle()->m_regionSelectorsAndRuleSet
s.size(); | |
| 1162 for (unsigned i = 0; i < rulesSize; ++i) { | |
| 1163 ASSERT(m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.at(i).ru
leSet.get()); | |
| 1164 if (checkRegionSelector(m_ruleSets.userStyle()->m_regionSelectorsAnd
RuleSets.at(i).selector, regionElement)) | |
| 1165 return true; | |
| 1166 } | |
| 1167 } | 1153 } |
| 1168 | |
| 1169 return false; | 1154 return false; |
| 1170 } | 1155 } |
| 1171 | 1156 |
| 1172 void StyleResolver::updateFont(StyleResolverState& state) | 1157 void StyleResolver::updateFont(StyleResolverState& state) |
| 1173 { | 1158 { |
| 1174 state.fontBuilder().createFont(m_fontSelector, state.parentStyle(), state.st
yle()); | 1159 state.fontBuilder().createFont(m_fontSelector, state.parentStyle(), state.st
yle()); |
| 1175 } | 1160 } |
| 1176 | 1161 |
| 1177 PassRefPtr<StyleRuleList> StyleResolver::styleRulesForElement(Element* element,
unsigned rulesToInclude) | 1162 PassRefPtr<StyleRuleList> StyleResolver::styleRulesForElement(Element* element,
unsigned rulesToInclude) |
| 1178 { | 1163 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1196 | 1181 |
| 1197 PassRefPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* element, unsi
gned rulesToInclude, ShouldIncludeStyleSheetInCSSOMWrapper includeDocument) | 1182 PassRefPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* element, unsi
gned rulesToInclude, ShouldIncludeStyleSheetInCSSOMWrapper includeDocument) |
| 1198 { | 1183 { |
| 1199 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude, includeDo
cument); | 1184 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude, includeDo
cument); |
| 1200 } | 1185 } |
| 1201 | 1186 |
| 1202 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 1187 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
| 1203 { | 1188 { |
| 1204 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 1189 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
| 1205 | 1190 |
| 1206 if (rulesToInclude & UAAndUserCSSRules) { | 1191 if (rulesToInclude & UAAndUserCSSRules) |
| 1207 // First we match rules from the user agent sheet. | |
| 1208 matchUARules(collector); | 1192 matchUARules(collector); |
| 1209 matchUserRules(collector, rulesToInclude & EmptyCSSRules); | |
| 1210 } | |
| 1211 | 1193 |
| 1212 if (rulesToInclude & AuthorCSSRules) { | 1194 if (rulesToInclude & AuthorCSSRules) { |
| 1213 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); | 1195 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); |
| 1214 | |
| 1215 // Check the rules in author sheets. | |
| 1216 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); | 1196 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); |
| 1217 } | 1197 } |
| 1218 } | 1198 } |
| 1219 | 1199 |
| 1220 // -----------------------------------------------------------------------------
-------- | 1200 // -----------------------------------------------------------------------------
-------- |
| 1221 // this is mostly boring stuff on how to apply a certain rule to the renderstyle
... | 1201 // this is mostly boring stuff on how to apply a certain rule to the renderstyle
... |
| 1222 | 1202 |
| 1223 template <StyleResolver::StyleApplicationPass pass> | 1203 template <StyleResolver::StyleApplicationPass pass> |
| 1224 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ani
mationEffect::CompositableValueMap& compositableValues) | 1204 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ani
mationEffect::CompositableValueMap& compositableValues) |
| 1225 { | 1205 { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); | 1578 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); |
| 1599 | 1579 |
| 1600 fprintf(stderr, "Total:\n"); | 1580 fprintf(stderr, "Total:\n"); |
| 1601 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, | 1581 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, |
| 1602 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); | 1582 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); |
| 1603 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); | 1583 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); |
| 1604 } | 1584 } |
| 1605 #endif | 1585 #endif |
| 1606 | 1586 |
| 1607 } // namespace WebCore | 1587 } // namespace WebCore |
| OLD | NEW |