| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 matchRuleSet(collector, userAgentStyleSheet); | 406 matchRuleSet(collector, userAgentStyleSheet); |
| 407 | 407 |
| 408 // In quirks mode, we match rules from the quirks user agent sheet. | 408 // In quirks mode, we match rules from the quirks user agent sheet. |
| 409 if (document().inQuirksMode()) | 409 if (document().inQuirksMode()) |
| 410 matchRuleSet(collector, defaultStyleSheets.defaultQuirksStyle()); | 410 matchRuleSet(collector, defaultStyleSheets.defaultQuirksStyle()); |
| 411 | 411 |
| 412 // 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. | 412 // 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. |
| 413 if (document().isViewSource()) | 413 if (document().isViewSource()) |
| 414 matchRuleSet(collector, defaultStyleSheets.defaultViewSourceStyle()); | 414 matchRuleSet(collector, defaultStyleSheets.defaultViewSourceStyle()); |
| 415 | 415 |
| 416 collector.finishAddingUARules(); |
| 416 collector.setMatchingUARules(false); | 417 collector.setMatchingUARules(false); |
| 417 } | 418 } |
| 418 | 419 |
| 419 void StyleResolver::matchRuleSet(ElementRuleCollector& collector, RuleSet* rules
) | 420 void StyleResolver::matchRuleSet(ElementRuleCollector& collector, RuleSet* rules
) |
| 420 { | 421 { |
| 421 collector.clearMatchedRules(); | 422 collector.clearMatchedRules(); |
| 422 collector.collectMatchingRules(MatchRequest(rules)); | 423 collector.collectMatchingRules(MatchRequest(rules)); |
| 423 collector.sortAndTransferMatchedRules(); | 424 collector.sortAndTransferMatchedRules(); |
| 424 } | 425 } |
| 425 | 426 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 452 if (state.element()->inlineStyle()) { | 453 if (state.element()->inlineStyle()) { |
| 453 // Inline style is immutable as long as there is no CSSOM wrapper. | 454 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 454 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); | 455 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); |
| 455 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); | 456 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); |
| 456 } | 457 } |
| 457 | 458 |
| 458 // Now check SMIL animation override style. | 459 // Now check SMIL animation override style. |
| 459 if (includeSMILProperties && state.element()->isSVGElement()) | 460 if (includeSMILProperties && state.element()->isSVGElement()) |
| 460 collector.addElementStyleProperties(toSVGElement(state.element())->a
nimatedSMILStyleProperties(), false /* isCacheable */); | 461 collector.addElementStyleProperties(toSVGElement(state.element())->a
nimatedSMILStyleProperties(), false /* isCacheable */); |
| 461 } | 462 } |
| 463 |
| 464 collector.finishAddingAuthorRulesForTreeScope(); |
| 462 } | 465 } |
| 463 | 466 |
| 464 PassRefPtr<ComputedStyle> StyleResolver::styleForDocument(Document& document) | 467 PassRefPtr<ComputedStyle> StyleResolver::styleForDocument(Document& document) |
| 465 { | 468 { |
| 466 const LocalFrame* frame = document.frame(); | 469 const LocalFrame* frame = document.frame(); |
| 467 | 470 |
| 468 RefPtr<ComputedStyle> documentStyle = ComputedStyle::create(); | 471 RefPtr<ComputedStyle> documentStyle = ComputedStyle::create(); |
| 469 documentStyle->setRTLOrdering(document.visuallyOrdered() ? VisualOrder : Log
icalOrder); | 472 documentStyle->setRTLOrdering(document.visuallyOrdered() ? VisualOrder : Log
icalOrder); |
| 470 documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor
() : 1); | 473 documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor
() : 1); |
| 471 documentStyle->setLocale(document.contentLanguage()); | 474 documentStyle->setLocale(document.contentLanguage()); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 // Since we don't use pseudo-elements in any of our quirk/print | 752 // Since we don't use pseudo-elements in any of our quirk/print |
| 750 // user agent rules, don't waste time walking those rules. | 753 // user agent rules, don't waste time walking those rules. |
| 751 | 754 |
| 752 if (!baseComputedStyle) { | 755 if (!baseComputedStyle) { |
| 753 // Check UA, user and author rules. | 756 // Check UA, user and author rules. |
| 754 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 757 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 755 collector.setPseudoStyleRequest(pseudoStyleRequest); | 758 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 756 | 759 |
| 757 matchUARules(collector); | 760 matchUARules(collector); |
| 758 matchAuthorRules(state.element(), collector, false); | 761 matchAuthorRules(state.element(), collector, false); |
| 762 collector.finishAddingAuthorRulesForTreeScope(); |
| 759 | 763 |
| 760 if (collector.matchedResult().matchedProperties.isEmpty()) | 764 if (!collector.matchedResult().hasMatchedProperties()) |
| 761 return false; | 765 return false; |
| 762 | 766 |
| 763 applyMatchedProperties(state, collector.matchedResult()); | 767 applyMatchedProperties(state, collector.matchedResult()); |
| 764 applyCallbackSelectors(state); | 768 applyCallbackSelectors(state); |
| 765 | 769 |
| 766 // Cache our original display. | 770 // Cache our original display. |
| 767 state.style()->setOriginalDisplay(state.style()->display()); | 771 state.style()->setOriginalDisplay(state.style()->display()); |
| 768 | 772 |
| 769 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 773 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
| 770 // in the adjustComputedStyle code. | 774 // in the adjustComputedStyle code. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 PageRuleCollector collector(rootElementStyle, pageIndex); | 827 PageRuleCollector collector(rootElementStyle, pageIndex); |
| 824 | 828 |
| 825 collector.matchPageRules(CSSDefaultStyleSheets::instance().defaultPrintStyle
()); | 829 collector.matchPageRules(CSSDefaultStyleSheets::instance().defaultPrintStyle
()); |
| 826 | 830 |
| 827 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) | 831 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) |
| 828 scopedResolver->matchPageRules(collector); | 832 scopedResolver->matchPageRules(collector); |
| 829 | 833 |
| 830 bool inheritedOnly = false; | 834 bool inheritedOnly = false; |
| 831 | 835 |
| 832 const MatchResult& result = collector.matchedResult(); | 836 const MatchResult& result = collector.matchedResult(); |
| 833 applyMatchedProperties<HighPropertyPriority>(state, result, false, result.be
gin(), result.end(), inheritedOnly); | 837 applyMatchedProperties<HighPropertyPriority>(state, result.allRules(), false
, inheritedOnly); |
| 834 | 838 |
| 835 // If our font got dirtied, go ahead and update it now. | 839 // If our font got dirtied, go ahead and update it now. |
| 836 updateFont(state); | 840 updateFont(state); |
| 837 | 841 |
| 838 applyMatchedProperties<LowPropertyPriority>(state, result, false, result.beg
in(), result.end(), inheritedOnly); | 842 applyMatchedProperties<LowPropertyPriority>(state, result.allRules(), false,
inheritedOnly); |
| 839 | 843 |
| 840 loadPendingResources(state); | 844 loadPendingResources(state); |
| 841 | 845 |
| 842 didAccess(); | 846 didAccess(); |
| 843 | 847 |
| 844 // Now return the style. | 848 // Now return the style. |
| 845 return state.takeStyle(); | 849 return state.takeStyle(); |
| 846 } | 850 } |
| 847 | 851 |
| 848 PassRefPtr<ComputedStyle> StyleResolver::initialStyleForElement() | 852 PassRefPtr<ComputedStyle> StyleResolver::initialStyleForElement() |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 } | 1230 } |
| 1227 | 1231 |
| 1228 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) | 1232 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) |
| 1229 continue; | 1233 continue; |
| 1230 | 1234 |
| 1231 StyleBuilder::applyProperty(current.id(), state, current.value()); | 1235 StyleBuilder::applyProperty(current.id(), state, current.value()); |
| 1232 } | 1236 } |
| 1233 } | 1237 } |
| 1234 | 1238 |
| 1235 template <CSSPropertyPriority priority> | 1239 template <CSSPropertyPriority priority> |
| 1236 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult, bool isImportant, unsigned startIndex, unsigned endIndex,
bool inheritedOnly) | 1240 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hedPropertiesRange& range, bool isImportant, bool inheritedOnly) |
| 1237 { | 1241 { |
| 1238 if (startIndex == endIndex) | 1242 if (range.isEmpty()) |
| 1239 return; | 1243 return; |
| 1240 | 1244 |
| 1241 ASSERT_WITH_SECURITY_IMPLICATION(endIndex <= matchResult.matchedProperties.s
ize()); | |
| 1242 | |
| 1243 if (state.style()->insideLink() != NotInsideLink) { | 1245 if (state.style()->insideLink() != NotInsideLink) { |
| 1244 for (unsigned i = startIndex; i < endIndex; ++i) { | 1246 for (const auto& matchedProperties : range) { |
| 1245 const MatchedProperties& matchedProperties = matchResult.matchedProp
erties[i]; | |
| 1246 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; | 1247 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; |
| 1247 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. | 1248 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. |
| 1248 state.setApplyPropertyToRegularStyle(linkMatchType & CSSSelector::Ma
tchLink); | 1249 state.setApplyPropertyToRegularStyle(linkMatchType & CSSSelector::Ma
tchLink); |
| 1249 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & CSSSelector
::MatchVisited); | 1250 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & CSSSelector
::MatchVisited); |
| 1250 | 1251 |
| 1251 applyProperties<priority>(state, matchedProperties.properties.get(),
isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedPropertie
s.m_types.whitelistType)); | 1252 applyProperties<priority>(state, matchedProperties.properties.get(),
isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedPropertie
s.m_types.whitelistType)); |
| 1252 } | 1253 } |
| 1253 state.setApplyPropertyToRegularStyle(true); | 1254 state.setApplyPropertyToRegularStyle(true); |
| 1254 state.setApplyPropertyToVisitedLinkStyle(false); | 1255 state.setApplyPropertyToVisitedLinkStyle(false); |
| 1255 return; | 1256 return; |
| 1256 } | 1257 } |
| 1257 for (unsigned i = startIndex; i < endIndex; ++i) { | 1258 for (const auto& matchedProperties : range) |
| 1258 const MatchedProperties& matchedProperties = matchResult.matchedProperti
es[i]; | |
| 1259 applyProperties<priority>(state, matchedProperties.properties.get(), isI
mportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.m_
types.whitelistType)); | 1259 applyProperties<priority>(state, matchedProperties.properties.get(), isI
mportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.m_
types.whitelistType)); |
| 1260 } | |
| 1261 } | 1260 } |
| 1262 | 1261 |
| 1263 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties
, unsigned size) | 1262 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties
, unsigned size) |
| 1264 { | 1263 { |
| 1265 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); | 1264 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); |
| 1266 } | 1265 } |
| 1267 | 1266 |
| 1268 void StyleResolver::invalidateMatchedPropertiesCache() | 1267 void StyleResolver::invalidateMatchedPropertiesCache() |
| 1269 { | 1268 { |
| 1270 m_matchedPropertiesCache.clear(); | 1269 m_matchedPropertiesCache.clear(); |
| 1271 } | 1270 } |
| 1272 | 1271 |
| 1273 void StyleResolver::notifyResizeForViewportUnits() | 1272 void StyleResolver::notifyResizeForViewportUnits() |
| 1274 { | 1273 { |
| 1275 m_viewportStyleResolver->collectViewportRules(); | 1274 m_viewportStyleResolver->collectViewportRules(); |
| 1276 m_matchedPropertiesCache.clearViewportDependent(); | 1275 m_matchedPropertiesCache.clearViewportDependent(); |
| 1277 } | 1276 } |
| 1278 | 1277 |
| 1279 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult) | 1278 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult) |
| 1280 { | 1279 { |
| 1281 const Element* element = state.element(); | 1280 const Element* element = state.element(); |
| 1282 ASSERT(element); | 1281 ASSERT(element); |
| 1283 | 1282 |
| 1284 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply, 1); | 1283 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply, 1); |
| 1285 | 1284 |
| 1286 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash(
matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; | 1285 unsigned cacheHash = matchResult.isCacheable() ? computeMatchedPropertiesHas
h(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()
) : 0; |
| 1287 bool applyInheritedOnly = false; | 1286 bool applyInheritedOnly = false; |
| 1288 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match
edPropertiesCache.find(cacheHash, state, matchResult) : 0; | 1287 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match
edPropertiesCache.find(cacheHash, state, matchResult.matchedProperties()) : 0; |
| 1289 | 1288 |
| 1290 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(element,
*state.style(), *state.parentStyle())) { | 1289 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(element,
*state.style(), *state.parentStyle())) { |
| 1291 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit, 1); | 1290 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit, 1); |
| 1292 // We can build up the style by copying non-inherited properties from an
earlier style object built using the same exact | 1291 // We can build up the style by copying non-inherited properties from an
earlier style object built using the same exact |
| 1293 // style declarations. We then only need to apply the inherited properti
es, if any, as their values can depend on the | 1292 // style declarations. We then only need to apply the inherited properti
es, if any, as their values can depend on the |
| 1294 // element context. This is fast and saves memory by reusing the style d
ata structures. | 1293 // element context. This is fast and saves memory by reusing the style d
ata structures. |
| 1295 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->comp
utedStyle); | 1294 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->comp
utedStyle); |
| 1296 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p
arentComputedStyle) && !isAtShadowBoundary(element) | 1295 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p
arentComputedStyle) && !isAtShadowBoundary(element) |
| 1297 && (!state.distributedToInsertionPoint() || state.style()->userModif
y() == READ_ONLY)) { | 1296 && (!state.distributedToInsertionPoint() || state.style()->userModif
y() == READ_ONLY)) { |
| 1298 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi
t, 1); | 1297 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi
t, 1); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1309 | 1308 |
| 1310 return; | 1309 return; |
| 1311 } | 1310 } |
| 1312 applyInheritedOnly = true; | 1311 applyInheritedOnly = true; |
| 1313 } | 1312 } |
| 1314 | 1313 |
| 1315 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply | 1314 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply |
| 1316 // high-priority properties first, i.e., those properties that other propert
ies depend on. | 1315 // high-priority properties first, i.e., those properties that other propert
ies depend on. |
| 1317 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important | 1316 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important |
| 1318 // and (4) normal important. | 1317 // and (4) normal important. |
| 1319 applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, matc
hResult.begin(), matchResult.end(), applyInheritedOnly); | 1318 applyMatchedProperties<HighPropertyPriority>(state, matchResult.allRules(),
false, applyInheritedOnly); |
| 1320 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); | 1319 for (auto range : ImportantAuthorRanges(matchResult)) |
| 1321 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.beginUA(), matchResult.endUA(), applyInheritedOnly); | 1320 applyMatchedProperties<HighPropertyPriority>(state, range, true, applyIn
heritedOnly); |
| 1321 applyMatchedProperties<HighPropertyPriority>(state, matchResult.uaRules(), t
rue, applyInheritedOnly); |
| 1322 | 1322 |
| 1323 if (UNLIKELY(isSVGForeignObjectElement(element))) { | 1323 if (UNLIKELY(isSVGForeignObjectElement(element))) { |
| 1324 // LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. | 1324 // LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. |
| 1325 // | 1325 // |
| 1326 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the | 1326 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the |
| 1327 // correct font-size in case of zooming. 'zoom' has HighPropertyPriority
, along with other font-related | 1327 // correct font-size in case of zooming. 'zoom' has HighPropertyPriority
, along with other font-related |
| 1328 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the | 1328 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the |
| 1329 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll | 1329 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll |
| 1330 // need to find another way of handling the SVG zoom model. | 1330 // need to find another way of handling the SVG zoom model. |
| 1331 state.setEffectiveZoom(ComputedStyle::initialZoom()); | 1331 state.setEffectiveZoom(ComputedStyle::initialZoom()); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->effec
tiveZoom() != state.style()->effectiveZoom()) { | 1334 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->effec
tiveZoom() != state.style()->effectiveZoom()) { |
| 1335 state.fontBuilder().didChangeEffectiveZoom(); | 1335 state.fontBuilder().didChangeEffectiveZoom(); |
| 1336 applyInheritedOnly = false; | 1336 applyInheritedOnly = false; |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 // If our font got dirtied, go ahead and update it now. | 1339 // If our font got dirtied, go ahead and update it now. |
| 1340 updateFont(state); | 1340 updateFont(state); |
| 1341 | 1341 |
| 1342 // Many properties depend on the font. If it changes we just apply all prope
rties. | 1342 // Many properties depend on the font. If it changes we just apply all prope
rties. |
| 1343 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->fontD
escription() != state.style()->fontDescription()) | 1343 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->fontD
escription() != state.style()->fontDescription()) |
| 1344 applyInheritedOnly = false; | 1344 applyInheritedOnly = false; |
| 1345 | 1345 |
| 1346 // Now do the normal priority UA properties. | 1346 // Now do the normal priority UA properties. |
| 1347 applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, match
Result.beginUA(), matchResult.endUA(), applyInheritedOnly); | 1347 applyMatchedProperties<LowPropertyPriority>(state, matchResult.uaRules(), fa
lse, applyInheritedOnly); |
| 1348 | 1348 |
| 1349 // Cache the UA properties to pass them to LayoutTheme in adjustComputedStyl
e. | 1349 // Cache the UA properties to pass them to LayoutTheme in adjustComputedStyl
e. |
| 1350 state.cacheUserAgentBorderAndBackground(); | 1350 state.cacheUserAgentBorderAndBackground(); |
| 1351 | 1351 |
| 1352 // Now do the author and user normal priority properties and all the !import
ant properties. | 1352 // Now do the author and user normal priority properties and all the !import
ant properties. |
| 1353 applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, match
Result.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); | 1353 applyMatchedProperties<LowPropertyPriority>(state, matchResult.authorRules()
, false, applyInheritedOnly); |
| 1354 applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchR
esult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); | 1354 for (auto range : ImportantAuthorRanges(matchResult)) |
| 1355 applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchR
esult.beginUA(), matchResult.endUA(), applyInheritedOnly); | 1355 applyMatchedProperties<LowPropertyPriority>(state, range, true, applyInh
eritedOnly); |
| 1356 applyMatchedProperties<LowPropertyPriority>(state, matchResult.uaRules(), tr
ue, applyInheritedOnly); |
| 1356 | 1357 |
| 1357 loadPendingResources(state); | 1358 loadPendingResources(state); |
| 1358 | 1359 |
| 1359 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, *state.style(), *state.parentStyle())) { | 1360 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, *state.style(), *state.parentStyle())) { |
| 1360 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded, 1); | 1361 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded, 1); |
| 1361 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache
Hash, matchResult); | 1362 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache
Hash, matchResult.matchedProperties()); |
| 1362 } | 1363 } |
| 1363 | 1364 |
| 1364 ASSERT(!state.fontBuilder().fontDirty()); | 1365 ASSERT(!state.fontBuilder().fontDirty()); |
| 1365 } | 1366 } |
| 1366 | 1367 |
| 1367 void StyleResolver::applyCallbackSelectors(StyleResolverState& state) | 1368 void StyleResolver::applyCallbackSelectors(StyleResolverState& state) |
| 1368 { | 1369 { |
| 1369 if (!m_watchedSelectorsRules) | 1370 if (!m_watchedSelectorsRules) |
| 1370 return; | 1371 return; |
| 1371 | 1372 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 visitor->trace(m_watchedSelectorsRules); | 1448 visitor->trace(m_watchedSelectorsRules); |
| 1448 visitor->trace(m_treeBoundaryCrossingRules); | 1449 visitor->trace(m_treeBoundaryCrossingRules); |
| 1449 visitor->trace(m_styleResourceLoader); | 1450 visitor->trace(m_styleResourceLoader); |
| 1450 visitor->trace(m_styleSharingLists); | 1451 visitor->trace(m_styleSharingLists); |
| 1451 visitor->trace(m_pendingStyleSheets); | 1452 visitor->trace(m_pendingStyleSheets); |
| 1452 visitor->trace(m_document); | 1453 visitor->trace(m_document); |
| 1453 #endif | 1454 #endif |
| 1454 } | 1455 } |
| 1455 | 1456 |
| 1456 } // namespace blink | 1457 } // namespace blink |
| OLD | NEW |