| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 StyleInvalidationAnalysis::StyleInvalidationAnalysis(const Vector<StyleSheetCont
ents*>& sheets) | 40 StyleInvalidationAnalysis::StyleInvalidationAnalysis(const Vector<StyleSheetCont
ents*>& sheets) |
| 41 : m_dirtiesAllStyle(false) | 41 : m_dirtiesAllStyle(false) |
| 42 { | 42 { |
| 43 for (unsigned i = 0; i < sheets.size() && !m_dirtiesAllStyle; ++i) | 43 for (unsigned i = 0; i < sheets.size() && !m_dirtiesAllStyle; ++i) |
| 44 analyzeStyleSheet(sheets[i]); | 44 analyzeStyleSheet(sheets[i]); |
| 45 } | 45 } |
| 46 | 46 |
| 47 static bool determineSelectorScopes(const CSSSelectorList& selectorList, HashSet
<StringImpl*>& idScopes, HashSet<StringImpl*>& classScopes) | 47 static bool determineSelectorScopes(const CSSSelectorList& selectorList, HashSet
<StringImpl*>& idScopes, HashSet<StringImpl*>& classScopes) |
| 48 { | 48 { |
| 49 for (const CSSSelector* selector = selectorList.first(); selector; selector
= CSSSelectorList::next(selector)) { | 49 for (const CSSSelector* selector = selectorList.first(); selector; selector
= CSSSelectorList::next(*selector)) { |
| 50 const CSSSelector* scopeSelector = 0; | 50 const CSSSelector* scopeSelector = 0; |
| 51 // This picks the widest scope, not the narrowest, to minimize the numbe
r of found scopes. | 51 // This picks the widest scope, not the narrowest, to minimize the numbe
r of found scopes. |
| 52 for (const CSSSelector* current = selector; current; current = current->
tagHistory()) { | 52 for (const CSSSelector* current = selector; current; current = current->
tagHistory()) { |
| 53 // Prefer ids over classes. | 53 // Prefer ids over classes. |
| 54 if (current->m_match == CSSSelector::Id) | 54 if (current->m_match == CSSSelector::Id) |
| 55 scopeSelector = current; | 55 scopeSelector = current; |
| 56 else if (current->m_match == CSSSelector::Class && (!scopeSelector |
| scopeSelector->m_match != CSSSelector::Id)) | 56 else if (current->m_match == CSSSelector::Class && (!scopeSelector |
| scopeSelector->m_match != CSSSelector::Id)) |
| 57 scopeSelector = current; | 57 scopeSelector = current; |
| 58 CSSSelector::Relation relation = current->relation(); | 58 CSSSelector::Relation relation = current->relation(); |
| 59 if (relation != CSSSelector::Descendant && relation != CSSSelector::
Child && relation != CSSSelector::SubSelector) | 59 if (relation != CSSSelector::Descendant && relation != CSSSelector::
Child && relation != CSSSelector::SubSelector) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 element->setNeedsStyleRecalc(); | 209 element->setNeedsStyleRecalc(); |
| 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 |