| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 // Prefer rule sets in order of most likely to apply infrequently. | 103 // Prefer rule sets in order of most likely to apply infrequently. |
| 104 if (!id.isEmpty()) { | 104 if (!id.isEmpty()) { |
| 105 addToRuleSet(id, ensurePendingRules()->idRules, ruleData); | 105 addToRuleSet(id, ensurePendingRules()->idRules, ruleData); |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 if (!className.isEmpty()) { | 108 if (!className.isEmpty()) { |
| 109 addToRuleSet(className, ensurePendingRules()->classRules, ruleData); | 109 addToRuleSet(className, ensurePendingRules()->classRules, ruleData); |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 if (!customPseudoElementName.isEmpty()) { | |
| 113 // Custom pseudos come before ids and classes in the order of tagHistory
, and have a relation of | |
| 114 // ShadowPseudo between them. Therefore we should never be a situation w
here extractValuesforSelector | |
| 115 // finsd id and className in addition to custom pseudo. | |
| 116 ASSERT(id.isEmpty() && className.isEmpty()); | |
| 117 addToRuleSet(customPseudoElementName, ensurePendingRules()->shadowPseudo
ElementRules, ruleData); | |
| 118 return true; | |
| 119 } | |
| 120 | 112 |
| 121 if (!tagName.isEmpty()) { | 113 if (!tagName.isEmpty()) { |
| 122 addToRuleSet(tagName, ensurePendingRules()->tagRules, ruleData); | 114 addToRuleSet(tagName, ensurePendingRules()->tagRules, ruleData); |
| 123 return true; | 115 return true; |
| 124 } | 116 } |
| 125 | 117 |
| 126 return false; | 118 return false; |
| 127 } | 119 } |
| 128 | 120 |
| 129 void RuleSet::addRule(StyleRule* rule, unsigned selectorIndex) | 121 void RuleSet::addRule(StyleRule* rule, unsigned selectorIndex) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 193 } |
| 202 } | 194 } |
| 203 | 195 |
| 204 void RuleSet::compactRules() | 196 void RuleSet::compactRules() |
| 205 { | 197 { |
| 206 ASSERT(m_pendingRules); | 198 ASSERT(m_pendingRules); |
| 207 OwnPtr<PendingRuleMaps> pendingRules = m_pendingRules.release(); | 199 OwnPtr<PendingRuleMaps> pendingRules = m_pendingRules.release(); |
| 208 compactPendingRules(pendingRules->idRules, m_idRules); | 200 compactPendingRules(pendingRules->idRules, m_idRules); |
| 209 compactPendingRules(pendingRules->classRules, m_classRules); | 201 compactPendingRules(pendingRules->classRules, m_classRules); |
| 210 compactPendingRules(pendingRules->tagRules, m_tagRules); | 202 compactPendingRules(pendingRules->tagRules, m_tagRules); |
| 211 compactPendingRules(pendingRules->shadowPseudoElementRules, m_shadowPseudoEl
ementRules); | |
| 212 m_universalRules.shrinkToFit(); | 203 m_universalRules.shrinkToFit(); |
| 213 m_fontFaceRules.shrinkToFit(); | 204 m_fontFaceRules.shrinkToFit(); |
| 214 m_keyframesRules.shrinkToFit(); | 205 m_keyframesRules.shrinkToFit(); |
| 215 } | 206 } |
| 216 | 207 |
| 217 #ifndef NDEBUG | 208 #ifndef NDEBUG |
| 218 void RuleSet::show() | 209 void RuleSet::show() |
| 219 { | 210 { |
| 220 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu
les.end(); ++it) | 211 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu
les.end(); ++it) |
| 221 it->selector().show(); | 212 it->selector().show(); |
| 222 } | 213 } |
| 223 #endif | 214 #endif |
| 224 | 215 |
| 225 } // namespace blink | 216 } // namespace blink |
| OLD | NEW |