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 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 102 |
| 103 bool RuleFeatureSet::updateClassInvalidationSets(const CSSSelector& selector) | 103 bool RuleFeatureSet::updateClassInvalidationSets(const CSSSelector& selector) |
| 104 { | 104 { |
| 105 if (!supportsClassDescendantInvalidation(selector)) | 105 if (!supportsClassDescendantInvalidation(selector)) |
| 106 return false; | 106 return false; |
| 107 | 107 |
| 108 Vector<AtomicString> classes; | 108 Vector<AtomicString> classes; |
| 109 AtomicString id; | 109 AtomicString id; |
| 110 AtomicString tagName; | 110 AtomicString tagName; |
| 111 | 111 |
| 112 const CSSSelector* lastSelector = &selector; | 112 bool rightmostCompoundSelector = true; |
| 113 for (; lastSelector->relation() == CSSSelector::SubSelector; lastSelector = lastSelector->tagHistory()) { | 113 for (const CSSSelector* current = &selector; current; current = current->tag History()) { |
| 114 extractClassIdOrTag(*lastSelector, classes, id, tagName); | 114 if (rightmostCompoundSelector) { |
| 115 } | 115 extractClassIdOrTag(*current, classes, id, tagName); |
| 116 extractClassIdOrTag(*lastSelector, classes, id, tagName); | 116 if (current->m_match == CSSSelector::Class) |
| 117 | 117 ensureClassInvalidationSet(current->value()); |
| 118 for (const CSSSelector* current = &selector ; current; current = current->ta gHistory()) { | 118 if (current->relation() != CSSSelector::SubSelector) |
| 119 rightmostCompoundSelector = false; | |
| 120 continue; | |
|
esprehn
2014/02/21 04:33:46
I think you want to do this as two loops like befo
rune
2014/02/21 10:17:17
Done that now. I did a break on !SubSelector inste
| |
| 121 } | |
| 119 if (current->m_match == CSSSelector::Class) { | 122 if (current->m_match == CSSSelector::Class) { |
| 120 DescendantInvalidationSet& invalidationSet = ensureClassInvalidation Set(current->value()); | 123 DescendantInvalidationSet& invalidationSet = ensureClassInvalidation Set(current->value()); |
| 121 if (!id.isEmpty()) | 124 if (!id.isEmpty()) |
| 122 invalidationSet.addId(id); | 125 invalidationSet.addId(id); |
| 123 if (!tagName.isEmpty()) | 126 if (!tagName.isEmpty()) |
| 124 invalidationSet.addTagName(tagName); | 127 invalidationSet.addTagName(tagName); |
| 125 for (Vector<AtomicString>::const_iterator it = classes.begin(); it ! = classes.end(); ++it) { | 128 for (Vector<AtomicString>::const_iterator it = classes.begin(); it ! = classes.end(); ++it) { |
| 126 invalidationSet.addClass(*it); | 129 invalidationSet.addClass(*it); |
| 127 } | 130 } |
| 128 } | 131 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 } | 421 } |
| 419 | 422 |
| 420 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); | 423 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
| 421 element->clearChildNeedsStyleInvalidation(); | 424 element->clearChildNeedsStyleInvalidation(); |
| 422 element->clearNeedsStyleInvalidation(); | 425 element->clearNeedsStyleInvalidation(); |
| 423 | 426 |
| 424 return thisElementNeedsStyleRecalc; | 427 return thisElementNeedsStyleRecalc; |
| 425 } | 428 } |
| 426 | 429 |
| 427 } // namespace WebCore | 430 } // namespace WebCore |
| OLD | NEW |