| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 case CSSSelector::PseudoHostContext: | 195 case CSSSelector::PseudoHostContext: |
| 196 // :host-context matches a shadow host, yet the simple selectors inside | 196 // :host-context matches a shadow host, yet the simple selectors inside |
| 197 // :host-context matches an ancestor of the shadow host. | 197 // :host-context matches an ancestor of the shadow host. |
| 198 return true; | 198 return true; |
| 199 default: | 199 default: |
| 200 DCHECK(supportsInvalidation(selector.getPseudoType())); | 200 DCHECK(supportsInvalidation(selector.getPseudoType())); |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 template<class Map> | 205 InvalidationSet& storedInvalidationSet(RefPtr<InvalidationSet>& invalidationSet,
InvalidationType type) |
| 206 InvalidationSet& ensureInvalidationSet(Map& map, const typename Map::KeyType& ke
y, InvalidationType type) | |
| 207 { | 206 { |
| 208 typename Map::AddResult addResult = map.add(key, nullptr); | 207 if (!invalidationSet) { |
| 209 if (addResult.isNewEntry) { | |
| 210 if (type == InvalidateDescendants) | 208 if (type == InvalidateDescendants) |
| 211 addResult.storedValue->value = DescendantInvalidationSet::create(); | 209 invalidationSet = DescendantInvalidationSet::create(); |
| 212 else | 210 else |
| 213 addResult.storedValue->value = SiblingInvalidationSet::create(nullpt
r); | 211 invalidationSet = SiblingInvalidationSet::create(nullptr); |
| 214 return *addResult.storedValue->value; | 212 return *invalidationSet; |
| 215 } | 213 } |
| 216 if (addResult.storedValue->value->type() == type) | 214 if (invalidationSet->type() == type) |
| 217 return *addResult.storedValue->value; | 215 return *invalidationSet; |
| 218 | 216 |
| 219 if (type == InvalidateDescendants) | 217 if (type == InvalidateDescendants) |
| 220 return toSiblingInvalidationSet(addResult.storedValue->value.get())->ens
ureDescendants(); | 218 return toSiblingInvalidationSet(*invalidationSet).ensureDescendants(); |
| 221 | 219 |
| 222 RefPtr<InvalidationSet> descendants = addResult.storedValue->value; | 220 RefPtr<InvalidationSet> descendants = invalidationSet; |
| 223 RefPtr<InvalidationSet> siblings = SiblingInvalidationSet::create(toDescenda
ntInvalidationSet(descendants.get())); | 221 invalidationSet = SiblingInvalidationSet::create(toDescendantInvalidationSet
(descendants.get())); |
| 224 addResult.storedValue->value = siblings; | 222 return *invalidationSet; |
| 225 return *addResult.storedValue->value; | 223 } |
| 224 |
| 225 InvalidationSet& ensureInvalidationSet(HashMap<AtomicString, RefPtr<Invalidation
Set>>& map, const AtomicString& key, InvalidationType type) |
| 226 { |
| 227 RefPtr<InvalidationSet>& invalidationSet = map.add(key, nullptr).storedValue
->value; |
| 228 return storedInvalidationSet(invalidationSet, type); |
| 229 } |
| 230 |
| 231 InvalidationSet& ensureInvalidationSet(HashMap<CSSSelector::PseudoType, RefPtr<I
nvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsi
gned>>& map, CSSSelector::PseudoType key, InvalidationType type) |
| 232 { |
| 233 RefPtr<InvalidationSet>& invalidationSet = map.add(key, nullptr).storedValue
->value; |
| 234 return storedInvalidationSet(invalidationSet, type); |
| 226 } | 235 } |
| 227 | 236 |
| 228 void extractInvalidationSets(InvalidationSet* invalidationSet, DescendantInvalid
ationSet*& descendants, SiblingInvalidationSet*& siblings) | 237 void extractInvalidationSets(InvalidationSet* invalidationSet, DescendantInvalid
ationSet*& descendants, SiblingInvalidationSet*& siblings) |
| 229 { | 238 { |
| 230 RELEASE_ASSERT(invalidationSet->isAlive()); | 239 RELEASE_ASSERT(invalidationSet->isAlive()); |
| 231 if (invalidationSet->type() == InvalidateDescendants) { | 240 if (invalidationSet->type() == InvalidateDescendants) { |
| 232 descendants = toDescendantInvalidationSet(invalidationSet); | 241 descendants = toDescendantInvalidationSet(invalidationSet); |
| 233 siblings = nullptr; | 242 siblings = nullptr; |
| 234 return; | 243 return; |
| 235 } | 244 } |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1070 |
| 1062 bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const | 1071 bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const |
| 1063 { | 1072 { |
| 1064 return !classes.isEmpty() | 1073 return !classes.isEmpty() |
| 1065 || !attributes.isEmpty() | 1074 || !attributes.isEmpty() |
| 1066 || !ids.isEmpty() | 1075 || !ids.isEmpty() |
| 1067 || !tagNames.isEmpty(); | 1076 || !tagNames.isEmpty(); |
| 1068 } | 1077 } |
| 1069 | 1078 |
| 1070 } // namespace blink | 1079 } // namespace blink |
| OLD | NEW |