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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 m_pendingInvalidationMap.clear(); | 52 m_pendingInvalidationMap.clear(); |
53 } | 53 } |
54 | 54 |
55 StyleInvalidator::StyleInvalidator() | 55 StyleInvalidator::StyleInvalidator() |
56 { } | 56 { } |
57 | 57 |
58 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) | 58 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) |
59 { | 59 { |
60 invalidationSet.getClasses(m_invalidationClasses); | 60 invalidationSet.getClasses(m_invalidationClasses); |
61 invalidationSet.getAttributes(m_invalidationAttributes); | 61 invalidationSet.getAttributes(m_invalidationAttributes); |
| 62 invalidationSet.getIds(m_invalidationIds); |
62 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); | 63 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); |
63 m_foundInvalidationSet = true; | 64 m_foundInvalidationSet = true; |
64 } | 65 } |
65 | 66 |
66 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) | 67 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) |
67 { | 68 { |
68 if (element.hasClass()) { | 69 if (element.hasClass()) { |
69 const SpaceSplitString& classNames = element.classNames(); | 70 const SpaceSplitString& classNames = element.classNames(); |
70 for (Vector<AtomicString>::const_iterator it = m_invalidationClasses.beg
in(); it != m_invalidationClasses.end(); ++it) { | 71 for (Vector<AtomicString>::const_iterator it = m_invalidationClasses.beg
in(); it != m_invalidationClasses.end(); ++it) { |
71 if (classNames.contains(*it)) | 72 if (classNames.contains(*it)) |
72 return true; | 73 return true; |
73 } | 74 } |
74 } | 75 } |
75 if (element.hasAttributes()) { | 76 if (element.hasAttributes()) { |
76 for (Vector<AtomicString>::const_iterator it = m_invalidationAttributes.
begin(); it != m_invalidationAttributes.end(); ++it) { | 77 for (Vector<AtomicString>::const_iterator it = m_invalidationAttributes.
begin(); it != m_invalidationAttributes.end(); ++it) { |
77 if (element.hasAttribute(*it)) | 78 if (element.hasAttribute(*it)) |
78 return true; | 79 return true; |
79 } | 80 } |
80 } | 81 } |
| 82 if (element.hasID()) { |
| 83 const AtomicString& id = element.idForStyleResolution(); |
| 84 if (m_invalidationIds.contains(id)) |
| 85 return true; |
| 86 } |
81 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) | 87 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) |
82 return true; | 88 return true; |
83 | 89 |
84 return false; | 90 return false; |
85 } | 91 } |
86 | 92 |
87 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element) | 93 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element) |
88 { | 94 { |
89 bool thisElementNeedsStyleRecalc = false; | 95 bool thisElementNeedsStyleRecalc = false; |
90 if (element.needsStyleInvalidation()) { | 96 if (element.needsStyleInvalidation()) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 157 } |
152 } | 158 } |
153 | 159 |
154 element.clearChildNeedsStyleInvalidation(); | 160 element.clearChildNeedsStyleInvalidation(); |
155 element.clearNeedsStyleInvalidation(); | 161 element.clearNeedsStyleInvalidation(); |
156 | 162 |
157 return thisElementNeedsStyleRecalc; | 163 return thisElementNeedsStyleRecalc; |
158 } | 164 } |
159 | 165 |
160 } // namespace WebCore | 166 } // namespace WebCore |
OLD | NEW |