OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 return false; | 192 return false; |
193 } | 193 } |
194 | 194 |
195 void StyleInvalidationAnalysis::invalidateStyle(Document& document) | 195 void StyleInvalidationAnalysis::invalidateStyle(Document& document) |
196 { | 196 { |
197 ASSERT(!m_dirtiesAllStyle); | 197 ASSERT(!m_dirtiesAllStyle); |
198 | 198 |
199 if (!m_scopingNodes.isEmpty()) { | 199 if (!m_scopingNodes.isEmpty()) { |
200 for (unsigned i = 0; i < m_scopingNodes.size(); ++i) | 200 for (unsigned i = 0; i < m_scopingNodes.size(); ++i) |
201 m_scopingNodes.at(i)->setNeedsStyleRecalc(); | 201 m_scopingNodes.at(i)->setNeedsStyleRecalc(SubtreeStyleChange); |
202 } | 202 } |
203 | 203 |
204 if (m_idScopes.isEmpty() && m_classScopes.isEmpty()) | 204 if (m_idScopes.isEmpty() && m_classScopes.isEmpty()) |
205 return; | 205 return; |
206 Element* element = ElementTraversal::firstWithin(document); | 206 Element* element = ElementTraversal::firstWithin(document); |
207 while (element) { | 207 while (element) { |
208 if (elementMatchesSelectorScopes(element, m_idScopes, m_classScopes)) { | 208 if (elementMatchesSelectorScopes(element, m_idScopes, m_classScopes)) { |
209 element->setNeedsStyleRecalc(); | 209 element->setNeedsStyleRecalc(SubtreeStyleChange); |
210 // The whole subtree is now invalidated, we can skip to the next sib
ling. | 210 // The whole subtree is now invalidated, we can skip to the next sib
ling. |
211 element = ElementTraversal::nextSkippingChildren(*element); | 211 element = ElementTraversal::nextSkippingChildren(*element); |
212 continue; | 212 continue; |
213 } | 213 } |
214 element = ElementTraversal::next(*element); | 214 element = ElementTraversal::next(*element); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 } | 218 } |
OLD | NEW |