| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->match() == CSSSelector::Id) | 54 if (current->match() == CSSSelector::Id) |
| 55 scopeSelector = current; | 55 scopeSelector = current; |
| 56 else if (current->match() == CSSSelector::Class && (!scopeSelector |
| scopeSelector->match() != CSSSelector::Id)) | 56 else if (current->match() == CSSSelector::Class && (!scopeSelector |
| scopeSelector->match() != CSSSelector::Id)) |
| 57 scopeSelector = current; | 57 scopeSelector = current; |
| 58 CSSSelector::Relation relation = current->relation(); | 58 CSSSelector::RelationType 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::ShadowDeep || relation == CSSSelector::
ShadowPseudo) | 61 if (relation == CSSSelector::ShadowDeep || relation == CSSSelector::
ShadowPseudo) |
| 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->match() == CSSSelector::Class || scopeSelector->ma
tch() == CSSSelector::Id); | 68 ASSERT(scopeSelector->match() == CSSSelector::Class || scopeSelector->ma
tch() == CSSSelector::Id); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::StyleSheetChange)); | 173 element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::StyleSheetChange)); |
| 174 // The whole subtree is now invalidated, we can skip to the next sib
ling. | 174 // The whole subtree is now invalidated, we can skip to the next sib
ling. |
| 175 element = ElementTraversal::nextSkippingChildren(*element); | 175 element = ElementTraversal::nextSkippingChildren(*element); |
| 176 continue; | 176 continue; |
| 177 } | 177 } |
| 178 element = ElementTraversal::next(*element); | 178 element = ElementTraversal::next(*element); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |