| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 StyleInvalidator::StyleInvalidator(Document& document) | 28 StyleInvalidator::StyleInvalidator(Document& document) |
| 29 : m_document(document) | 29 : m_document(document) |
| 30 , m_pendingInvalidationMap(document.styleResolver()->ruleFeatureSet().pendin
gInvalidationMap()) | 30 , m_pendingInvalidationMap(document.styleResolver()->ruleFeatureSet().pendin
gInvalidationMap()) |
| 31 { } | 31 { } |
| 32 | 32 |
| 33 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) | 33 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) |
| 34 { | 34 { |
| 35 invalidationSet.getClasses(m_invalidationClasses); | 35 invalidationSet.getClasses(m_invalidationClasses); |
| 36 invalidationSet.getAttributes(m_invalidationAttributes); | 36 invalidationSet.getAttributes(m_invalidationAttributes); |
| 37 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); |
| 37 m_foundInvalidationSet = true; | 38 m_foundInvalidationSet = true; |
| 38 } | 39 } |
| 39 | 40 |
| 40 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) | 41 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) |
| 41 { | 42 { |
| 42 if (element.hasClass()) { | 43 if (element.hasClass()) { |
| 43 const SpaceSplitString& classNames = element.classNames(); | 44 const SpaceSplitString& classNames = element.classNames(); |
| 44 for (Vector<AtomicString>::const_iterator it = m_invalidationClasses.beg
in(); it != m_invalidationClasses.end(); ++it) { | 45 for (Vector<AtomicString>::const_iterator it = m_invalidationClasses.beg
in(); it != m_invalidationClasses.end(); ++it) { |
| 45 if (classNames.contains(*it)) | 46 if (classNames.contains(*it)) |
| 46 return true; | 47 return true; |
| 47 } | 48 } |
| 48 } | 49 } |
| 49 if (element.hasAttributes()) { | 50 if (element.hasAttributes()) { |
| 50 for (Vector<AtomicString>::const_iterator it = m_invalidationAttributes.
begin(); it != m_invalidationAttributes.end(); ++it) { | 51 for (Vector<AtomicString>::const_iterator it = m_invalidationAttributes.
begin(); it != m_invalidationAttributes.end(); ++it) { |
| 51 if (element.hasAttribute(*it)) | 52 if (element.hasAttribute(*it)) |
| 52 return true; | 53 return true; |
| 53 } | 54 } |
| 54 } | 55 } |
| 56 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) |
| 57 return true; |
| 55 | 58 |
| 56 return false; | 59 return false; |
| 57 } | 60 } |
| 58 | 61 |
| 59 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element) | 62 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element) |
| 60 { | 63 { |
| 61 bool thisElementNeedsStyleRecalc = false; | 64 bool thisElementNeedsStyleRecalc = false; |
| 62 if (element.needsStyleInvalidation()) { | 65 if (element.needsStyleInvalidation()) { |
| 63 if (RuleFeatureSet::InvalidationList* invalidationList = m_pendingInvali
dationMap.get(&element)) { | 66 if (RuleFeatureSet::InvalidationList* invalidationList = m_pendingInvali
dationMap.get(&element)) { |
| 64 // FIXME: it's really only necessary to clone the render style for t
his element, not full style recalc. | 67 // FIXME: it's really only necessary to clone the render style for t
his element, not full style recalc. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 126 } |
| 124 } | 127 } |
| 125 | 128 |
| 126 element.clearChildNeedsStyleInvalidation(); | 129 element.clearChildNeedsStyleInvalidation(); |
| 127 element.clearNeedsStyleInvalidation(); | 130 element.clearNeedsStyleInvalidation(); |
| 128 | 131 |
| 129 return thisElementNeedsStyleRecalc; | 132 return thisElementNeedsStyleRecalc; |
| 130 } | 133 } |
| 131 | 134 |
| 132 } // namespace WebCore | 135 } // namespace WebCore |
| OLD | NEW |