| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 if (!treeScope) | 376 if (!treeScope) |
| 377 return nullptr; | 377 return nullptr; |
| 378 if (element->shadowPseudoId().isEmpty() && !element->isVTTElement()) | 378 if (element->shadowPseudoId().isEmpty() && !element->isVTTElement()) |
| 379 return nullptr; | 379 return nullptr; |
| 380 return treeScope->scopedStyleResolver(); | 380 return treeScope->scopedStyleResolver(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
lector, bool includeEmptyRules) | 383 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
lector, bool includeEmptyRules) |
| 384 { | 384 { |
| 385 collector.clearMatchedRules(); | 385 collector.clearMatchedRules(); |
| 386 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; | |
| 387 | 386 |
| 388 CascadeOrder cascadeOrder = 0; | 387 CascadeOrder cascadeOrder = 0; |
| 389 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad
owTree; | 388 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad
owTree; |
| 390 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); | 389 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); |
| 391 | 390 |
| 392 // Apply :host and :host-context rules from inner scopes. | 391 // Apply :host and :host-context rules from inner scopes. |
| 393 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) | 392 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) |
| 394 resolversInShadowTree.at(j)->collectMatchingShadowHostRules(collector, i
ncludeEmptyRules, ++cascadeOrder); | 393 resolversInShadowTree.at(j)->collectMatchingShadowHostRules(collector, i
ncludeEmptyRules, ++cascadeOrder); |
| 395 | 394 |
| 396 // Apply normal rules from element scope. | 395 // Apply normal rules from element scope. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 417 // 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. | 416 // 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. |
| 418 if (document().isViewSource()) | 417 if (document().isViewSource()) |
| 419 matchRuleSet(collector, defaultStyleSheets.defaultViewSourceStyle()); | 418 matchRuleSet(collector, defaultStyleSheets.defaultViewSourceStyle()); |
| 420 | 419 |
| 421 collector.setMatchingUARules(false); | 420 collector.setMatchingUARules(false); |
| 422 } | 421 } |
| 423 | 422 |
| 424 void StyleResolver::matchRuleSet(ElementRuleCollector& collector, RuleSet* rules
) | 423 void StyleResolver::matchRuleSet(ElementRuleCollector& collector, RuleSet* rules
) |
| 425 { | 424 { |
| 426 collector.clearMatchedRules(); | 425 collector.clearMatchedRules(); |
| 427 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; | 426 collector.collectMatchingRules(MatchRequest(rules)); |
| 428 | |
| 429 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); | |
| 430 collector.collectMatchingRules(MatchRequest(rules), ruleRange); | |
| 431 | |
| 432 collector.sortAndTransferMatchedRules(); | 427 collector.sortAndTransferMatchedRules(); |
| 433 } | 428 } |
| 434 | 429 |
| 435 void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
r& collector, bool includeSMILProperties) | 430 void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
r& collector, bool includeSMILProperties) |
| 436 { | 431 { |
| 437 matchUARules(collector); | 432 matchUARules(collector); |
| 438 | 433 |
| 439 // Now check author rules, beginning first with presentational attributes ma
pped from HTML. | 434 // Now check author rules, beginning first with presentational attributes ma
pped from HTML. |
| 440 if (state.element()->isStyledElement()) { | 435 if (state.element()->isStyledElement()) { |
| 441 collector.addElementStyleProperties(state.element()->presentationAttribu
teStyle()); | 436 collector.addElementStyleProperties(state.element()->presentationAttribu
teStyle()); |
| 442 | 437 |
| 443 // Now we check additional mapped declarations. | 438 // Now we check additional mapped declarations. |
| 444 // Tables and table cells share an additional mapped rule that must be a
pplied | 439 // Tables and table cells share an additional mapped rule that must be a
pplied |
| 445 // after all attributes, since their mapped style depends on the values
of multiple attributes. | 440 // after all attributes, since their mapped style depends on the values
of multiple attributes. |
| 446 collector.addElementStyleProperties(state.element()->additionalPresentat
ionAttributeStyle()); | 441 collector.addElementStyleProperties(state.element()->additionalPresentat
ionAttributeStyle()); |
| 447 | 442 |
| 448 if (state.element()->isHTMLElement()) { | 443 if (state.element()->isHTMLElement()) { |
| 449 bool isAuto; | 444 bool isAuto; |
| 450 TextDirection textDirection = toHTMLElement(state.element())->direct
ionalityIfhasDirAutoAttribute(isAuto); | 445 TextDirection textDirection = toHTMLElement(state.element())->direct
ionalityIfhasDirAutoAttribute(isAuto); |
| 451 if (isAuto) { | 446 if (isAuto) { |
| 452 state.setHasDirAutoAttribute(true); | 447 state.setHasDirAutoAttribute(true); |
| 453 collector.matchedResult().addMatchedProperties(textDirection ==
LTR ? leftToRightDeclaration() : rightToLeftDeclaration()); | 448 collector.addElementStyleProperties(textDirection == LTR ? leftT
oRightDeclaration() : rightToLeftDeclaration()); |
| 454 } | 449 } |
| 455 } | 450 } |
| 456 } | 451 } |
| 457 | 452 |
| 458 matchAuthorRules(state.element(), collector, false); | 453 matchAuthorRules(state.element(), collector, false); |
| 459 | 454 |
| 460 if (state.element()->isStyledElement()) { | 455 if (state.element()->isStyledElement()) { |
| 461 if (state.element()->inlineStyle()) { | 456 if (state.element()->inlineStyle()) { |
| 462 // Inline style is immutable as long as there is no CSSOM wrapper. | 457 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 463 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); | 458 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 | 660 |
| 666 // Create the style | 661 // Create the style |
| 667 state.setStyle(ComputedStyle::clone(elementStyle)); | 662 state.setStyle(ComputedStyle::clone(elementStyle)); |
| 668 | 663 |
| 669 // We don't need to bother with !important. Since there is only ever one | 664 // We don't need to bother with !important. Since there is only ever one |
| 670 // decl, there's nothing to override. So just add the first properties. | 665 // decl, there's nothing to override. So just add the first properties. |
| 671 // We also don't need to bother with animation properties since the only | 666 // We also don't need to bother with animation properties since the only |
| 672 // relevant one is animation-timing-function and we special-case that in | 667 // relevant one is animation-timing-function and we special-case that in |
| 673 // CSSAnimations.cpp | 668 // CSSAnimations.cpp |
| 674 bool inheritedOnly = false; | 669 bool inheritedOnly = false; |
| 675 applyMatchedProperties<HighPropertyPriority>(state, result, false, 0, result
.matchedProperties.size() - 1, inheritedOnly); | 670 applyMatchedProperties<HighPropertyPriority>(state, result, false, result.fi
rstRule(), result.lastRule(), inheritedOnly); |
| 676 | 671 |
| 677 // If our font got dirtied, go ahead and update it now. | 672 // If our font got dirtied, go ahead and update it now. |
| 678 updateFont(state); | 673 updateFont(state); |
| 679 | 674 |
| 680 // Now do rest of the properties. | 675 // Now do rest of the properties. |
| 681 applyMatchedProperties<LowPropertyPriority>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); | 676 applyMatchedProperties<LowPropertyPriority>(state, result, false, result.fir
stRule(), result.lastRule(), inheritedOnly); |
| 682 | 677 |
| 683 loadPendingResources(state); | 678 loadPendingResources(state); |
| 684 | 679 |
| 685 didAccess(); | 680 didAccess(); |
| 686 | 681 |
| 687 return state.takeStyle(); | 682 return state.takeStyle(); |
| 688 } | 683 } |
| 689 | 684 |
| 690 // This function is used by the WebAnimations JavaScript API method animate(). | 685 // This function is used by the WebAnimations JavaScript API method animate(). |
| 691 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. | 686 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 854 |
| 860 PageRuleCollector collector(rootElementStyle, pageIndex); | 855 PageRuleCollector collector(rootElementStyle, pageIndex); |
| 861 | 856 |
| 862 collector.matchPageRules(CSSDefaultStyleSheets::instance().defaultPrintStyle
()); | 857 collector.matchPageRules(CSSDefaultStyleSheets::instance().defaultPrintStyle
()); |
| 863 | 858 |
| 864 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) | 859 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) |
| 865 scopedResolver->matchPageRules(collector); | 860 scopedResolver->matchPageRules(collector); |
| 866 | 861 |
| 867 bool inheritedOnly = false; | 862 bool inheritedOnly = false; |
| 868 | 863 |
| 869 MatchResult& result = collector.matchedResult(); | 864 const MatchResult& result = collector.matchedResult(); |
| 870 applyMatchedProperties<HighPropertyPriority>(state, result, false, 0, result
.matchedProperties.size() - 1, inheritedOnly); | 865 applyMatchedProperties<HighPropertyPriority>(state, result, false, result.fi
rstRule(), result.lastRule(), inheritedOnly); |
| 871 | 866 |
| 872 // If our font got dirtied, go ahead and update it now. | 867 // If our font got dirtied, go ahead and update it now. |
| 873 updateFont(state); | 868 updateFont(state); |
| 874 | 869 |
| 875 applyMatchedProperties<LowPropertyPriority>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); | 870 applyMatchedProperties<LowPropertyPriority>(state, result, false, result.fir
stRule(), result.lastRule(), inheritedOnly); |
| 876 | 871 |
| 877 loadPendingResources(state); | 872 loadPendingResources(state); |
| 878 | 873 |
| 879 didAccess(); | 874 didAccess(); |
| 880 | 875 |
| 881 // Now return the style. | 876 // Now return the style. |
| 882 return state.takeStyle(); | 877 return state.takeStyle(); |
| 883 } | 878 } |
| 884 | 879 |
| 885 PassRefPtr<ComputedStyle> StyleResolver::initialStyleForElement() | 880 PassRefPtr<ComputedStyle> StyleResolver::initialStyleForElement() |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 StyleBuilder::applyProperty(current.id(), state, current.value()); | 1263 StyleBuilder::applyProperty(current.id(), state, current.value()); |
| 1269 } | 1264 } |
| 1270 } | 1265 } |
| 1271 | 1266 |
| 1272 template <CSSPropertyPriority priority> | 1267 template <CSSPropertyPriority priority> |
| 1273 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult, bool isImportant, int startIndex, int endIndex, bool inher
itedOnly) | 1268 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult, bool isImportant, int startIndex, int endIndex, bool inher
itedOnly) |
| 1274 { | 1269 { |
| 1275 if (startIndex == -1) | 1270 if (startIndex == -1) |
| 1276 return; | 1271 return; |
| 1277 | 1272 |
| 1273 ASSERT(startIndex >= 0 && endIndex < static_cast<int>(matchResult.matchedPro
perties.size())); |
| 1274 |
| 1278 if (state.style()->insideLink() != NotInsideLink) { | 1275 if (state.style()->insideLink() != NotInsideLink) { |
| 1279 for (int i = startIndex; i <= endIndex; ++i) { | 1276 for (int i = startIndex; i <= endIndex; ++i) { |
| 1280 const MatchedProperties& matchedProperties = matchResult.matchedProp
erties[i]; | 1277 const MatchedProperties& matchedProperties = matchResult.matchedProp
erties[i]; |
| 1281 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; | 1278 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; |
| 1282 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. | 1279 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. |
| 1283 state.setApplyPropertyToRegularStyle(linkMatchType & CSSSelector::Ma
tchLink); | 1280 state.setApplyPropertyToRegularStyle(linkMatchType & CSSSelector::Ma
tchLink); |
| 1284 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & CSSSelector
::MatchVisited); | 1281 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & CSSSelector
::MatchVisited); |
| 1285 | 1282 |
| 1286 applyProperties<priority>(state, matchedProperties.properties.get(),
isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedPropertie
s.m_types.whitelistType)); | 1283 applyProperties<priority>(state, matchedProperties.properties.get(),
isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedPropertie
s.m_types.whitelistType)); |
| 1287 } | 1284 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 | 1341 |
| 1345 return; | 1342 return; |
| 1346 } | 1343 } |
| 1347 applyInheritedOnly = true; | 1344 applyInheritedOnly = true; |
| 1348 } | 1345 } |
| 1349 | 1346 |
| 1350 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply | 1347 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply |
| 1351 // high-priority properties first, i.e., those properties that other propert
ies depend on. | 1348 // high-priority properties first, i.e., those properties that other propert
ies depend on. |
| 1352 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important | 1349 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important |
| 1353 // and (4) normal important. | 1350 // and (4) normal important. |
| 1354 applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, 0, m
atchResult.matchedProperties.size() - 1, applyInheritedOnly); | 1351 applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, matc
hResult.firstRule(), matchResult.lastRule(), applyInheritedOnly); |
| 1355 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherited
Only); | 1352 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.firstAuthorRule(), matchResult.lastAuthorRule(), applyInheritedOnly); |
| 1356 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1353 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.firstUARule(), matchResult.lastUARule(), applyInheritedOnly); |
| 1357 | 1354 |
| 1358 if (UNLIKELY(isSVGForeignObjectElement(element))) { | 1355 if (UNLIKELY(isSVGForeignObjectElement(element))) { |
| 1359 // LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. | 1356 // LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. |
| 1360 // | 1357 // |
| 1361 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the | 1358 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the |
| 1362 // correct font-size in case of zooming. 'zoom' has HighPropertyPriority
, along with other font-related | 1359 // correct font-size in case of zooming. 'zoom' has HighPropertyPriority
, along with other font-related |
| 1363 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the | 1360 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the |
| 1364 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll | 1361 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll |
| 1365 // need to find another way of handling the SVG zoom model. | 1362 // need to find another way of handling the SVG zoom model. |
| 1366 state.setEffectiveZoom(ComputedStyle::initialZoom()); | 1363 state.setEffectiveZoom(ComputedStyle::initialZoom()); |
| 1367 } | 1364 } |
| 1368 | 1365 |
| 1369 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->effec
tiveZoom() != state.style()->effectiveZoom()) { | 1366 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->effec
tiveZoom() != state.style()->effectiveZoom()) { |
| 1370 state.fontBuilder().didChangeEffectiveZoom(); | 1367 state.fontBuilder().didChangeEffectiveZoom(); |
| 1371 applyInheritedOnly = false; | 1368 applyInheritedOnly = false; |
| 1372 } | 1369 } |
| 1373 | 1370 |
| 1374 // If our font got dirtied, go ahead and update it now. | 1371 // If our font got dirtied, go ahead and update it now. |
| 1375 updateFont(state); | 1372 updateFont(state); |
| 1376 | 1373 |
| 1377 // Many properties depend on the font. If it changes we just apply all prope
rties. | 1374 // Many properties depend on the font. If it changes we just apply all prope
rties. |
| 1378 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->fontD
escription() != state.style()->fontDescription()) | 1375 if (cachedMatchedProperties && cachedMatchedProperties->computedStyle->fontD
escription() != state.style()->fontDescription()) |
| 1379 applyInheritedOnly = false; | 1376 applyInheritedOnly = false; |
| 1380 | 1377 |
| 1381 // Now do the normal priority UA properties. | 1378 // Now do the normal priority UA properties. |
| 1382 applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, match
Result.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1379 applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, match
Result.firstUARule(), matchResult.lastUARule(), applyInheritedOnly); |
| 1383 | 1380 |
| 1384 // Cache the UA properties to pass them to LayoutTheme in adjustComputedStyl
e. | 1381 // Cache the UA properties to pass them to LayoutTheme in adjustComputedStyl
e. |
| 1385 state.cacheUserAgentBorderAndBackground(); | 1382 state.cacheUserAgentBorderAndBackground(); |
| 1386 | 1383 |
| 1387 // Now do the author and user normal priority properties and all the !import
ant properties. | 1384 // Now do the author and user normal priority properties and all the !import
ant properties. |
| 1388 applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, match
Result.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInh
eritedOnly); | 1385 applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, match
Result.firstAuthorRule(), matchResult.lastAuthorRule(), applyInheritedOnly); |
| 1389 applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchR
esult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedO
nly); | 1386 applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchR
esult.firstAuthorRule(), matchResult.lastAuthorRule(), applyInheritedOnly); |
| 1390 applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchR
esult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1387 applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchR
esult.firstUARule(), matchResult.lastUARule(), applyInheritedOnly); |
| 1391 | 1388 |
| 1392 loadPendingResources(state); | 1389 loadPendingResources(state); |
| 1393 | 1390 |
| 1394 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, *state.style(), *state.parentStyle())) { | 1391 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, *state.style(), *state.parentStyle())) { |
| 1395 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); | 1392 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); |
| 1396 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache
Hash, matchResult); | 1393 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache
Hash, matchResult); |
| 1397 } | 1394 } |
| 1398 | 1395 |
| 1399 ASSERT(!state.fontBuilder().fontDirty()); | 1396 ASSERT(!state.fontBuilder().fontDirty()); |
| 1400 } | 1397 } |
| 1401 | 1398 |
| 1402 void StyleResolver::applyCallbackSelectors(StyleResolverState& state) | 1399 void StyleResolver::applyCallbackSelectors(StyleResolverState& state) |
| 1403 { | 1400 { |
| 1404 if (!m_watchedSelectorsRules) | 1401 if (!m_watchedSelectorsRules) |
| 1405 return; | 1402 return; |
| 1406 | 1403 |
| 1407 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); | 1404 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); |
| 1408 collector.setMode(SelectorChecker::CollectingStyleRules); | 1405 collector.setMode(SelectorChecker::CollectingStyleRules); |
| 1409 | 1406 |
| 1410 MatchRequest matchRequest(m_watchedSelectorsRules.get(), true); | 1407 MatchRequest matchRequest(m_watchedSelectorsRules.get(), true); |
| 1411 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | 1408 collector.collectMatchingRules(matchRequest); |
| 1412 collector.collectMatchingRules(matchRequest, ruleRange); | |
| 1413 collector.sortAndTransferMatchedRules(); | 1409 collector.sortAndTransferMatchedRules(); |
| 1414 | 1410 |
| 1415 RefPtrWillBeRawPtr<StyleRuleList> rules = collector.matchedStyleRuleList(); | 1411 RefPtrWillBeRawPtr<StyleRuleList> rules = collector.matchedStyleRuleList(); |
| 1416 if (!rules) | 1412 if (!rules) |
| 1417 return; | 1413 return; |
| 1418 for (size_t i = 0; i < rules->m_list.size(); i++) | 1414 for (size_t i = 0; i < rules->m_list.size(); i++) |
| 1419 state.style()->addCallbackSelector(rules->m_list[i]->selectorList().sele
ctorsText()); | 1415 state.style()->addCallbackSelector(rules->m_list[i]->selectorList().sele
ctorsText()); |
| 1420 } | 1416 } |
| 1421 | 1417 |
| 1422 void StyleResolver::enableStats(StatsReportType reportType) | 1418 void StyleResolver::enableStats(StatsReportType reportType) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 visitor->trace(m_watchedSelectorsRules); | 1495 visitor->trace(m_watchedSelectorsRules); |
| 1500 visitor->trace(m_treeBoundaryCrossingRules); | 1496 visitor->trace(m_treeBoundaryCrossingRules); |
| 1501 visitor->trace(m_styleResourceLoader); | 1497 visitor->trace(m_styleResourceLoader); |
| 1502 visitor->trace(m_styleSharingLists); | 1498 visitor->trace(m_styleSharingLists); |
| 1503 visitor->trace(m_pendingStyleSheets); | 1499 visitor->trace(m_pendingStyleSheets); |
| 1504 visitor->trace(m_document); | 1500 visitor->trace(m_document); |
| 1505 #endif | 1501 #endif |
| 1506 } | 1502 } |
| 1507 | 1503 |
| 1508 } // namespace blink | 1504 } // namespace blink |
| OLD | NEW |