| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 | 7 |
| 8 #include "core/css/invalidation/StyleInvalidator.h" | 8 #include "core/css/invalidation/StyleInvalidator.h" |
| 9 | 9 |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 StyleInvalidator::StyleInvalidator(Document& document) | 30 StyleInvalidator::StyleInvalidator(Document& document) |
| 31 : m_document(document) | 31 : m_document(document) |
| 32 , m_pendingInvalidationMap(document.styleResolver()->ruleFeatureSet().pendin
gInvalidationMap()) | 32 , m_pendingInvalidationMap(document.styleResolver()->ruleFeatureSet().pendin
gInvalidationMap()) |
| 33 { } | 33 { } |
| 34 | 34 |
| 35 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) | 35 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) |
| 36 { | 36 { |
| 37 invalidationSet.getClasses(m_invalidationClasses); | 37 invalidationSet.getClasses(m_invalidationClasses); |
| 38 invalidationSet.getAttributes(m_invalidationAttributes); |
| 38 m_foundInvalidationSet = true; | 39 m_foundInvalidationSet = true; |
| 39 } | 40 } |
| 40 | 41 |
| 41 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) | 42 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) |
| 42 { | 43 { |
| 43 if (!element.hasClass()) | 44 if (element.hasClass()) { |
| 44 return false; | 45 const SpaceSplitString& classNames = element.classNames(); |
| 45 | 46 for (Vector<AtomicString>::const_iterator it = m_invalidationClasses.beg
in(); it != m_invalidationClasses.end(); ++it) { |
| 46 const SpaceSplitString& classNames = element.classNames(); | 47 if (classNames.contains(*it)) |
| 47 for (Vector<AtomicString>::const_iterator it = m_invalidationClasses.begin()
; it != m_invalidationClasses.end(); ++it) { | 48 return true; |
| 48 if (classNames.contains(*it)) | 49 } |
| 49 return true; | 50 } |
| 51 if (element.hasAttributes()) { |
| 52 for (Vector<AtomicString>::const_iterator it = m_invalidationAttributes.
begin(); it != m_invalidationAttributes.end(); ++it) { |
| 53 if (element.hasAttribute(*it)) |
| 54 return true; |
| 55 } |
| 50 } | 56 } |
| 51 | 57 |
| 52 return false; | 58 return false; |
| 53 } | 59 } |
| 54 | 60 |
| 55 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element) | 61 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element) |
| 56 { | 62 { |
| 57 bool thisElementNeedsStyleRecalc = false; | 63 bool thisElementNeedsStyleRecalc = false; |
| 58 if (element.needsStyleInvalidation()) { | 64 if (element.needsStyleInvalidation()) { |
| 59 if (RuleFeatureSet::InvalidationList* invalidationList = m_pendingInvali
dationMap.get(&element)) { | 65 if (RuleFeatureSet::InvalidationList* invalidationList = m_pendingInvali
dationMap.get(&element)) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 125 } |
| 120 } | 126 } |
| 121 | 127 |
| 122 element.clearChildNeedsStyleInvalidation(); | 128 element.clearChildNeedsStyleInvalidation(); |
| 123 element.clearNeedsStyleInvalidation(); | 129 element.clearNeedsStyleInvalidation(); |
| 124 | 130 |
| 125 return thisElementNeedsStyleRecalc; | 131 return thisElementNeedsStyleRecalc; |
| 126 } | 132 } |
| 127 | 133 |
| 128 } // namespace WebCore | 134 } // namespace WebCore |
| OLD | NEW |