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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // FIXME: it would be better to use setNeedsStyleRecalc for all shad
ow hosts matching | 59 // FIXME: it would be better to use setNeedsStyleRecalc for all shad
ow hosts matching |
60 // scopeSelector. Currently requests full style recalc. | 60 // scopeSelector. Currently requests full style recalc. |
61 if (relation == CSSSelector::DescendantTree || relation == CSSSelect
or::ChildTree) | 61 if (relation == CSSSelector::ShadowDeep || relation == CSSSelector::
ShadowAll) |
62 return false; | 62 return false; |
63 if (relation != CSSSelector::Descendant && relation != CSSSelector::
Child && relation != CSSSelector::SubSelector) | 63 if (relation != CSSSelector::Descendant && relation != CSSSelector::
Child && relation != CSSSelector::SubSelector) |
64 break; | 64 break; |
65 } | 65 } |
66 if (!scopeSelector) | 66 if (!scopeSelector) |
67 return false; | 67 return false; |
68 ASSERT(scopeSelector->m_match == CSSSelector::Class || scopeSelector->m_
match == CSSSelector::Id); | 68 ASSERT(scopeSelector->m_match == CSSSelector::Class || scopeSelector->m_
match == CSSSelector::Id); |
69 if (scopeSelector->m_match == CSSSelector::Id) | 69 if (scopeSelector->m_match == CSSSelector::Id) |
70 idScopes.add(scopeSelector->value().impl()); | 70 idScopes.add(scopeSelector->value().impl()); |
71 else | 71 else |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 element->setNeedsStyleRecalc(SubtreeStyleChange); | 212 element->setNeedsStyleRecalc(SubtreeStyleChange); |
213 // The whole subtree is now invalidated, we can skip to the next sib
ling. | 213 // The whole subtree is now invalidated, we can skip to the next sib
ling. |
214 element = ElementTraversal::nextSkippingChildren(*element); | 214 element = ElementTraversal::nextSkippingChildren(*element); |
215 continue; | 215 continue; |
216 } | 216 } |
217 element = ElementTraversal::next(*element); | 217 element = ElementTraversal::next(*element); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 } | 221 } |
OLD | NEW |