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