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 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (selector.match() == CSSSelector::Tag) { | 46 if (selector.match() == CSSSelector::Tag) { |
47 ASSERT(selector.tagQName().localName() == starAtom); | 47 ASSERT(selector.tagQName().localName() == starAtom); |
48 return true; | 48 return true; |
49 } | 49 } |
50 if (selector.match() == CSSSelector::PseudoElement) { | 50 if (selector.match() == CSSSelector::PseudoElement) { |
51 switch (selector.pseudoType()) { | 51 switch (selector.pseudoType()) { |
52 case CSSSelector::PseudoBefore: | 52 case CSSSelector::PseudoBefore: |
53 case CSSSelector::PseudoAfter: | 53 case CSSSelector::PseudoAfter: |
54 case CSSSelector::PseudoBackdrop: | 54 case CSSSelector::PseudoBackdrop: |
55 case CSSSelector::PseudoShadow: | 55 case CSSSelector::PseudoShadow: |
| 56 case CSSSelector::PseudoContent: |
56 return true; | 57 return true; |
57 default: | 58 default: |
58 ASSERT(!selector.isCustomPseudoElement()); | 59 ASSERT(!selector.isCustomPseudoElement()); |
59 return false; | 60 return false; |
60 } | 61 } |
61 } | 62 } |
62 if (selector.match() != CSSSelector::PseudoClass) | 63 if (selector.match() != CSSSelector::PseudoClass) |
63 return false; | 64 return false; |
64 switch (selector.pseudoType()) { | 65 switch (selector.pseudoType()) { |
65 case CSSSelector::PseudoEmpty: | 66 case CSSSelector::PseudoEmpty: |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // ContainerNode::checkForChildrenAdjacentRuleChanges. | 282 // ContainerNode::checkForChildrenAdjacentRuleChanges. |
282 // | 283 // |
283 // As we encounter a descendant type of combinator, the features only need to be
checked | 284 // As we encounter a descendant type of combinator, the features only need to be
checked |
284 // against descendants in the same subtree only. features.adjacent is set to fal
se, and | 285 // against descendants in the same subtree only. features.adjacent is set to fal
se, and |
285 // we start adding features instead of calling setWholeSubtreeInvalid. | 286 // we start adding features instead of calling setWholeSubtreeInvalid. |
286 | 287 |
287 void RuleFeatureSet::addFeaturesToInvalidationSet(DescendantInvalidationSet& inv
alidationSet, const InvalidationSetFeatures& features) | 288 void RuleFeatureSet::addFeaturesToInvalidationSet(DescendantInvalidationSet& inv
alidationSet, const InvalidationSetFeatures& features) |
288 { | 289 { |
289 if (features.treeBoundaryCrossing) | 290 if (features.treeBoundaryCrossing) |
290 invalidationSet.setTreeBoundaryCrossing(); | 291 invalidationSet.setTreeBoundaryCrossing(); |
| 292 if (features.insertionPointCrossing) |
| 293 invalidationSet.setInsertionPointCrossing(); |
291 if (features.adjacent) { | 294 if (features.adjacent) { |
292 invalidationSet.setWholeSubtreeInvalid(); | 295 invalidationSet.setWholeSubtreeInvalid(); |
293 return; | 296 return; |
294 } | 297 } |
295 if (!features.id.isEmpty()) | 298 if (!features.id.isEmpty()) |
296 invalidationSet.addId(features.id); | 299 invalidationSet.addId(features.id); |
297 if (!features.tagName.isEmpty()) | 300 if (!features.tagName.isEmpty()) |
298 invalidationSet.addTagName(features.tagName); | 301 invalidationSet.addTagName(features.tagName); |
299 for (const auto& className : features.classes) | 302 for (const auto& className : features.classes) |
300 invalidationSet.addClass(className); | 303 invalidationSet.addClass(className); |
301 for (const auto& attribute : features.attributes) | 304 for (const auto& attribute : features.attributes) |
302 invalidationSet.addAttribute(attribute); | 305 invalidationSet.addAttribute(attribute); |
303 if (features.customPseudoElement) | 306 if (features.customPseudoElement) |
304 invalidationSet.setCustomPseudoInvalid(); | 307 invalidationSet.setCustomPseudoInvalid(); |
305 } | 308 } |
306 | 309 |
307 void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
InvalidationSetFeatures& features) | 310 void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
InvalidationSetFeatures& features) |
308 { | 311 { |
309 for (const CSSSelector* current = &selector; current; current = current->tag
History()) { | 312 for (const CSSSelector* current = &selector; current; current = current->tag
History()) { |
310 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec
tor(*current)) { | 313 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec
tor(*current)) { |
311 addFeaturesToInvalidationSet(*invalidationSet, features); | 314 addFeaturesToInvalidationSet(*invalidationSet, features); |
312 } else { | 315 } else { |
313 if (current->pseudoType() == CSSSelector::PseudoHost) | 316 if (current->isTreeBoundaryCrossing()) |
314 features.treeBoundaryCrossing = true; | 317 features.treeBoundaryCrossing = true; |
| 318 if (current->isInsertionPointCrossing()) |
| 319 features.insertionPointCrossing = true; |
315 if (const CSSSelectorList* selectorList = current->selectorList()) { | 320 if (const CSSSelectorList* selectorList = current->selectorList()) { |
316 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre
nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect
or::PseudoNot); | 321 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre
nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect
or::PseudoNot); |
317 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) | 322 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) |
318 addFeaturesToInvalidationSets(*selector, features); | 323 addFeaturesToInvalidationSets(*selector, features); |
319 } | 324 } |
320 } | 325 } |
321 | 326 |
322 if (current->relation() == CSSSelector::SubSelector) | 327 if (current->relation() == CSSSelector::SubSelector) |
323 continue; | 328 continue; |
324 | 329 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 visitor->trace(uncommonAttributeRules); | 556 visitor->trace(uncommonAttributeRules); |
552 visitor->trace(m_classInvalidationSets); | 557 visitor->trace(m_classInvalidationSets); |
553 visitor->trace(m_attributeInvalidationSets); | 558 visitor->trace(m_attributeInvalidationSets); |
554 visitor->trace(m_idInvalidationSets); | 559 visitor->trace(m_idInvalidationSets); |
555 visitor->trace(m_pseudoInvalidationSets); | 560 visitor->trace(m_pseudoInvalidationSets); |
556 visitor->trace(m_styleInvalidator); | 561 visitor->trace(m_styleInvalidator); |
557 #endif | 562 #endif |
558 } | 563 } |
559 | 564 |
560 } // namespace blink | 565 } // namespace blink |
OLD | NEW |