| 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 25 matching lines...) Expand all Loading... |
| 36 #include "sky/engine/core/css/SelectorChecker.h" | 36 #include "sky/engine/core/css/SelectorChecker.h" |
| 37 #include "sky/engine/core/css/StyleRuleKeyframes.h" | 37 #include "sky/engine/core/css/StyleRuleKeyframes.h" |
| 38 #include "sky/engine/core/css/StyleSheetContents.h" | 38 #include "sky/engine/core/css/StyleSheetContents.h" |
| 39 #include "sky/engine/platform/TraceEvent.h" | 39 #include "sky/engine/platform/TraceEvent.h" |
| 40 #include "sky/engine/wtf/TerminatedArrayBuilder.h" | 40 #include "sky/engine/wtf/TerminatedArrayBuilder.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 // ----------------------------------------------------------------- | 44 // ----------------------------------------------------------------- |
| 45 | 45 |
| 46 // FIXME(sky): Track attribute selectors properly in maps. | |
| 47 static inline bool selectorListContainsAttributeSelector(const CSSSelector* sele
ctor) | |
| 48 { | |
| 49 const CSSSelectorList* selectorList = selector->selectorList(); | |
| 50 if (!selectorList) | |
| 51 return false; | |
| 52 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { | |
| 53 for (const CSSSelector* component = selector; component; component = com
ponent->tagHistory()) { | |
| 54 if (component->isAttributeSelector()) | |
| 55 return true; | |
| 56 } | |
| 57 } | |
| 58 return false; | |
| 59 } | |
| 60 | |
| 61 static inline bool containsAttributeSelector(const CSSSelector& selector) | |
| 62 { | |
| 63 for (const CSSSelector* current = &selector; current; current = current->tag
History()) { | |
| 64 if (current->isAttributeSelector()) | |
| 65 return true; | |
| 66 if (selectorListContainsAttributeSelector(current)) | |
| 67 return true; | |
| 68 } | |
| 69 return false; | |
| 70 } | |
| 71 | |
| 72 RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position, A
ddRuleFlags addRuleFlags) | 46 RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position, A
ddRuleFlags addRuleFlags) |
| 73 : m_rule(rule) | 47 : m_rule(rule) |
| 74 , m_selectorIndex(selectorIndex) | 48 , m_selectorIndex(selectorIndex) |
| 75 , m_isLastInArray(false) | 49 , m_isLastInArray(false) |
| 76 , m_position(position) | 50 , m_position(position) |
| 77 , m_containsAttributeSelector(blink::containsAttributeSelector(selector())) | |
| 78 { | 51 { |
| 79 ASSERT(m_position == position); | 52 ASSERT(m_position == position); |
| 80 ASSERT(m_selectorIndex == selectorIndex); | 53 ASSERT(m_selectorIndex == selectorIndex); |
| 81 } | 54 } |
| 82 | 55 |
| 83 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R
uleData& ruleData) | 56 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R
uleData& ruleData) |
| 84 { | 57 { |
| 85 OwnPtr<LinkedStack<RuleData> >& rules = map.add(key, nullptr).storedValue->v
alue; | 58 OwnPtr<LinkedStack<RuleData> >& rules = map.add(key, nullptr).storedValue->v
alue; |
| 86 if (!rules) | 59 if (!rules) |
| 87 rules = adoptPtr(new LinkedStack<RuleData>); | 60 rules = adoptPtr(new LinkedStack<RuleData>); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 221 |
| 249 #ifndef NDEBUG | 222 #ifndef NDEBUG |
| 250 void RuleSet::show() | 223 void RuleSet::show() |
| 251 { | 224 { |
| 252 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu
les.end(); ++it) | 225 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu
les.end(); ++it) |
| 253 it->selector().show(); | 226 it->selector().show(); |
| 254 } | 227 } |
| 255 #endif | 228 #endif |
| 256 | 229 |
| 257 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |