| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) { | 433 for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) { |
| 434 ScopedStyleResolver* resolver = resolvers.at(i); | 434 ScopedStyleResolver* resolver = resolvers.at(i); |
| 435 // FIXME: Need to clarify how to treat style scoped. | 435 // FIXME: Need to clarify how to treat style scoped. |
| 436 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply
AuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && r
esolver->treeScope().rootNode().isShadowRoot() ? 0 : cascadeOrder); | 436 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply
AuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && r
esolver->treeScope().rootNode().isShadowRoot() ? 0 : cascadeOrder); |
| 437 } | 437 } |
| 438 | 438 |
| 439 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec
tor, includeEmptyRules); | 439 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec
tor, includeEmptyRules); |
| 440 collector.sortAndTransferMatchedRules(); | 440 collector.sortAndTransferMatchedRules(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void StyleResolver::matchWatchSelectorRules(ElementRuleCollector& collector) | |
| 444 { | |
| 445 if (!m_watchedSelectorsRules) | |
| 446 return; | |
| 447 | |
| 448 collector.clearMatchedRules(); | |
| 449 collector.matchedResult().ranges.lastUserRule = collector.matchedResult().ma
tchedProperties.size() - 1; | |
| 450 | |
| 451 MatchRequest matchRequest(m_watchedSelectorsRules.get()); | |
| 452 RuleRange ruleRange = collector.matchedResult().ranges.userRuleRange(); | |
| 453 collector.collectMatchingRules(matchRequest, ruleRange); | |
| 454 | |
| 455 collector.sortAndTransferMatchedRules(); | |
| 456 } | |
| 457 | |
| 458 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 443 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 459 { | 444 { |
| 460 collector.setMatchingUARules(true); | 445 collector.setMatchingUARules(true); |
| 461 | 446 |
| 462 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); | 447 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); |
| 463 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default
PrintStyle() : defaultStyleSheets.defaultStyle(); | 448 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default
PrintStyle() : defaultStyleSheets.defaultStyle(); |
| 464 matchUARules(collector, userAgentStyleSheet); | 449 matchUARules(collector, userAgentStyleSheet); |
| 465 | 450 |
| 466 // In quirks mode, we match rules from the quirks user agent sheet. | 451 // In quirks mode, we match rules from the quirks user agent sheet. |
| 467 if (document().inQuirksMode()) | 452 if (document().inQuirksMode()) |
| 468 matchUARules(collector, defaultStyleSheets.defaultQuirksStyle()); | 453 matchUARules(collector, defaultStyleSheets.defaultQuirksStyle()); |
| 469 | 454 |
| 470 // 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. | 455 // 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. |
| 471 if (document().isViewSource()) | 456 if (document().isViewSource()) |
| 472 matchUARules(collector, defaultStyleSheets.defaultViewSourceStyle()); | 457 matchUARules(collector, defaultStyleSheets.defaultViewSourceStyle()); |
| 473 | 458 |
| 474 if (document().isTransitionDocument()) | 459 if (document().isTransitionDocument()) |
| 475 matchUARules(collector, defaultStyleSheets.defaultTransitionStyle()); | 460 matchUARules(collector, defaultStyleSheets.defaultTransitionStyle()); |
| 476 | 461 |
| 477 collector.setMatchingUARules(false); | 462 collector.setMatchingUARules(false); |
| 478 | |
| 479 matchWatchSelectorRules(collector); | |
| 480 } | 463 } |
| 481 | 464 |
| 482 void StyleResolver::matchUARules(ElementRuleCollector& collector, RuleSet* rules
) | 465 void StyleResolver::matchUARules(ElementRuleCollector& collector, RuleSet* rules
) |
| 483 { | 466 { |
| 484 collector.clearMatchedRules(); | 467 collector.clearMatchedRules(); |
| 485 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; | 468 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; |
| 486 | 469 |
| 487 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); | 470 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); |
| 488 collector.collectMatchingRules(MatchRequest(rules), ruleRange); | 471 collector.collectMatchingRules(MatchRequest(rules), ruleRange); |
| 489 | 472 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 CSSDefaultStyleSheets::instance().ensureDefaultStyleSheetsForElement(element
, needsCollection); | 629 CSSDefaultStyleSheets::instance().ensureDefaultStyleSheetsForElement(element
, needsCollection); |
| 647 if (needsCollection) | 630 if (needsCollection) |
| 648 collectFeatures(); | 631 collectFeatures(); |
| 649 | 632 |
| 650 { | 633 { |
| 651 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 634 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 652 | 635 |
| 653 matchAllRules(state, collector, matchingBehavior != MatchAllRulesExcludi
ngSMIL); | 636 matchAllRules(state, collector, matchingBehavior != MatchAllRulesExcludi
ngSMIL); |
| 654 | 637 |
| 655 applyMatchedProperties(state, collector.matchedResult()); | 638 applyMatchedProperties(state, collector.matchedResult()); |
| 639 applyCallbackSelectors(state); |
| 656 | 640 |
| 657 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); | 641 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 658 } | 642 } |
| 659 | 643 |
| 660 // Cache our original display. | 644 // Cache our original display. |
| 661 state.style()->setOriginalDisplay(state.style()->display()); | 645 state.style()->setOriginalDisplay(state.style()->display()); |
| 662 | 646 |
| 663 adjustRenderStyle(state, element); | 647 adjustRenderStyle(state, element); |
| 664 | 648 |
| 665 // FIXME: The CSSWG wants to specify that the effects of animations are appl
ied before | 649 // FIXME: The CSSWG wants to specify that the effects of animations are appl
ied before |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 | 800 |
| 817 matchUARules(collector); | 801 matchUARules(collector); |
| 818 matchAuthorRules(state.element(), collector, false); | 802 matchAuthorRules(state.element(), collector, false); |
| 819 | 803 |
| 820 if (collector.matchedResult().matchedProperties.isEmpty()) | 804 if (collector.matchedResult().matchedProperties.isEmpty()) |
| 821 return false; | 805 return false; |
| 822 | 806 |
| 823 state.style()->setStyleType(pseudoStyleRequest.pseudoId); | 807 state.style()->setStyleType(pseudoStyleRequest.pseudoId); |
| 824 | 808 |
| 825 applyMatchedProperties(state, collector.matchedResult()); | 809 applyMatchedProperties(state, collector.matchedResult()); |
| 810 applyCallbackSelectors(state); |
| 826 | 811 |
| 827 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); | 812 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 828 } | 813 } |
| 829 | 814 |
| 830 // Cache our original display. | 815 // Cache our original display. |
| 831 state.style()->setOriginalDisplay(state.style()->display()); | 816 state.style()->setOriginalDisplay(state.style()->display()); |
| 832 | 817 |
| 833 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 818 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
| 834 // in the adjustRenderStyle code. | 819 // in the adjustRenderStyle code. |
| 835 adjustRenderStyle(state, 0); | 820 adjustRenderStyle(state, 0); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 if (CSSPropertyMetadata::isInheritedProperty(propertyId)) | 1324 if (CSSPropertyMetadata::isInheritedProperty(propertyId)) |
| 1340 value = cssValuePool().createInheritedValue().get(); | 1325 value = cssValuePool().createInheritedValue().get(); |
| 1341 else | 1326 else |
| 1342 value = cssValuePool().createExplicitInitialValue().get(); | 1327 value = cssValuePool().createExplicitInitialValue().get(); |
| 1343 } | 1328 } |
| 1344 StyleBuilder::applyProperty(propertyId, state, value); | 1329 StyleBuilder::applyProperty(propertyId, state, value); |
| 1345 } | 1330 } |
| 1346 } | 1331 } |
| 1347 | 1332 |
| 1348 template <StyleResolver::StyleApplicationPass pass> | 1333 template <StyleResolver::StyleApplicationPass pass> |
| 1349 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper
tyWhitelistType propertyWhitelistType) | 1334 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p
ropertyWhitelistType) |
| 1350 { | 1335 { |
| 1351 state.setCurrentRule(rule); | |
| 1352 | |
| 1353 unsigned propertyCount = properties->propertyCount(); | 1336 unsigned propertyCount = properties->propertyCount(); |
| 1354 for (unsigned i = 0; i < propertyCount; ++i) { | 1337 for (unsigned i = 0; i < propertyCount; ++i) { |
| 1355 StylePropertySet::PropertyReference current = properties->propertyAt(i); | 1338 StylePropertySet::PropertyReference current = properties->propertyAt(i); |
| 1356 if (isImportant != current.isImportant()) | 1339 if (isImportant != current.isImportant()) |
| 1357 continue; | 1340 continue; |
| 1358 | 1341 |
| 1359 CSSPropertyID property = current.id(); | 1342 CSSPropertyID property = current.id(); |
| 1360 if (property == CSSPropertyAll) { | 1343 if (property == CSSPropertyAll) { |
| 1361 applyAllProperty<pass>(state, current.value()); | 1344 applyAllProperty<pass>(state, current.value()); |
| 1362 continue; | 1345 continue; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1390 return; | 1373 return; |
| 1391 | 1374 |
| 1392 if (state.style()->insideLink() != NotInsideLink) { | 1375 if (state.style()->insideLink() != NotInsideLink) { |
| 1393 for (int i = startIndex; i <= endIndex; ++i) { | 1376 for (int i = startIndex; i <= endIndex; ++i) { |
| 1394 const MatchedProperties& matchedProperties = matchResult.matchedProp
erties[i]; | 1377 const MatchedProperties& matchedProperties = matchResult.matchedProp
erties[i]; |
| 1395 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; | 1378 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; |
| 1396 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. | 1379 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. |
| 1397 state.setApplyPropertyToRegularStyle(linkMatchType & SelectorChecker
::MatchLink); | 1380 state.setApplyPropertyToRegularStyle(linkMatchType & SelectorChecker
::MatchLink); |
| 1398 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & SelectorChe
cker::MatchVisited); | 1381 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & SelectorChe
cker::MatchVisited); |
| 1399 | 1382 |
| 1400 applyProperties<pass>(state, matchedProperties.properties.get(), mat
chResult.matchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitel
istType>(matchedProperties.m_types.whitelistType)); | 1383 applyProperties<pass>(state, matchedProperties.properties.get(), isI
mportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.m_
types.whitelistType)); |
| 1401 } | 1384 } |
| 1402 state.setApplyPropertyToRegularStyle(true); | 1385 state.setApplyPropertyToRegularStyle(true); |
| 1403 state.setApplyPropertyToVisitedLinkStyle(false); | 1386 state.setApplyPropertyToVisitedLinkStyle(false); |
| 1404 return; | 1387 return; |
| 1405 } | 1388 } |
| 1406 for (int i = startIndex; i <= endIndex; ++i) { | 1389 for (int i = startIndex; i <= endIndex; ++i) { |
| 1407 const MatchedProperties& matchedProperties = matchResult.matchedProperti
es[i]; | 1390 const MatchedProperties& matchedProperties = matchResult.matchedProperti
es[i]; |
| 1408 applyProperties<pass>(state, matchedProperties.properties.get(), matchRe
sult.matchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitelistT
ype>(matchedProperties.m_types.whitelistType)); | 1391 applyProperties<pass>(state, matchedProperties.properties.get(), isImpor
tant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.m_type
s.whitelistType)); |
| 1409 } | 1392 } |
| 1410 } | 1393 } |
| 1411 | 1394 |
| 1412 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties
, unsigned size) | 1395 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties
, unsigned size) |
| 1413 { | 1396 { |
| 1414 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); | 1397 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); |
| 1415 } | 1398 } |
| 1416 | 1399 |
| 1417 void StyleResolver::invalidateMatchedPropertiesCache() | 1400 void StyleResolver::invalidateMatchedPropertiesCache() |
| 1418 { | 1401 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 applyInheritedOnly = true; | 1441 applyInheritedOnly = true; |
| 1459 } | 1442 } |
| 1460 | 1443 |
| 1461 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply | 1444 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply |
| 1462 // high-priority properties first, i.e., those properties that other propert
ies depend on. | 1445 // high-priority properties first, i.e., those properties that other propert
ies depend on. |
| 1463 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important | 1446 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important |
| 1464 // and (4) normal important. | 1447 // and (4) normal important. |
| 1465 state.setLineHeightValue(0); | 1448 state.setLineHeightValue(0); |
| 1466 applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0,
matchResult.matchedProperties.size() - 1, applyInheritedOnly); | 1449 applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0,
matchResult.matchedProperties.size() - 1, applyInheritedOnly); |
| 1467 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherit
edOnly); | 1450 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherit
edOnly); |
| 1468 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOn
ly); | |
| 1469 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1451 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
| 1470 | 1452 |
| 1471 if (UNLIKELY(isSVGForeignObjectElement(element))) { | 1453 if (UNLIKELY(isSVGForeignObjectElement(element))) { |
| 1472 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. | 1454 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. |
| 1473 // | 1455 // |
| 1474 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the | 1456 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the |
| 1475 // correct font-size in case of zooming. 'zoom' is part of HighPriorityP
roperties, along with other font-related | 1457 // correct font-size in case of zooming. 'zoom' is part of HighPriorityP
roperties, along with other font-related |
| 1476 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the | 1458 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the |
| 1477 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll | 1459 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll |
| 1478 // need to find another way of handling the SVG zoom model. | 1460 // need to find another way of handling the SVG zoom model. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1497 | 1479 |
| 1498 // Now do the normal priority UA properties. | 1480 // Now do the normal priority UA properties. |
| 1499 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat
chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1481 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat
chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
| 1500 | 1482 |
| 1501 // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle. | 1483 // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle. |
| 1502 state.cacheUserAgentBorderAndBackground(); | 1484 state.cacheUserAgentBorderAndBackground(); |
| 1503 | 1485 |
| 1504 // Now do the author and user normal priority properties and all the !import
ant properties. | 1486 // Now do the author and user normal priority properties and all the !import
ant properties. |
| 1505 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat
chResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyI
nheritedOnly); | 1487 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat
chResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyI
nheritedOnly); |
| 1506 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherite
dOnly); | 1488 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherite
dOnly); |
| 1507 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnl
y); | |
| 1508 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1489 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); |
| 1509 | 1490 |
| 1510 loadPendingResources(state); | 1491 loadPendingResources(state); |
| 1511 | 1492 |
| 1512 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, state.style(), state.parentStyle())) { | 1493 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, state.style(), state.parentStyle())) { |
| 1513 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); | 1494 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); |
| 1514 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa
sh, matchResult); | 1495 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa
sh, matchResult); |
| 1515 } | 1496 } |
| 1516 | 1497 |
| 1517 ASSERT(!state.fontBuilder().fontDirty()); | 1498 ASSERT(!state.fontBuilder().fontDirty()); |
| 1518 } | 1499 } |
| 1519 | 1500 |
| 1501 void StyleResolver::applyCallbackSelectors(StyleResolverState& state) |
| 1502 { |
| 1503 if (!m_watchedSelectorsRules) |
| 1504 return; |
| 1505 |
| 1506 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); |
| 1507 collector.setMode(SelectorChecker::CollectingStyleRules); |
| 1508 |
| 1509 MatchRequest matchRequest(m_watchedSelectorsRules.get(), true); |
| 1510 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
| 1511 collector.collectMatchingRules(matchRequest, ruleRange); |
| 1512 collector.sortAndTransferMatchedRules(); |
| 1513 |
| 1514 RefPtrWillBeRawPtr<StyleRuleList> rules = collector.matchedStyleRuleList(); |
| 1515 if (!rules) |
| 1516 return; |
| 1517 for (size_t i = 0; i < rules->m_list.size(); i++) |
| 1518 state.style()->addCallbackSelector(rules->m_list[i]->selectorList().sele
ctorsText()); |
| 1519 } |
| 1520 |
| 1520 CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& pro
pertySet) | 1521 CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& pro
pertySet) |
| 1521 : property(id), value(propertySet.getPropertyCSSValue(id).get()) | 1522 : property(id), value(propertySet.getPropertyCSSValue(id).get()) |
| 1522 { } | 1523 { } |
| 1523 | 1524 |
| 1524 void StyleResolver::enableStats(StatsReportType reportType) | 1525 void StyleResolver::enableStats(StatsReportType reportType) |
| 1525 { | 1526 { |
| 1526 if (m_styleResolverStats) | 1527 if (m_styleResolverStats) |
| 1527 return; | 1528 return; |
| 1528 m_styleResolverStats = StyleResolverStats::create(); | 1529 m_styleResolverStats = StyleResolverStats::create(); |
| 1529 m_styleResolverStatsTotals = StyleResolverStats::create(); | 1530 m_styleResolverStatsTotals = StyleResolverStats::create(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 visitor->trace(m_uncommonAttributeRuleSet); | 1604 visitor->trace(m_uncommonAttributeRuleSet); |
| 1604 visitor->trace(m_watchedSelectorsRules); | 1605 visitor->trace(m_watchedSelectorsRules); |
| 1605 visitor->trace(m_treeBoundaryCrossingRules); | 1606 visitor->trace(m_treeBoundaryCrossingRules); |
| 1606 visitor->trace(m_styleSharingLists); | 1607 visitor->trace(m_styleSharingLists); |
| 1607 visitor->trace(m_pendingStyleSheets); | 1608 visitor->trace(m_pendingStyleSheets); |
| 1608 visitor->trace(m_document); | 1609 visitor->trace(m_document); |
| 1609 #endif | 1610 #endif |
| 1610 } | 1611 } |
| 1611 | 1612 |
| 1612 } // namespace blink | 1613 } // namespace blink |
| OLD | NEW |