| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void InvalidationSet::combine(const InvalidationSet& other) | 105 void InvalidationSet::combine(const InvalidationSet& other) |
| 106 { | 106 { |
| 107 ASSERT(type() == other.type()); | 107 RELEASE_ASSERT(m_isAlive); |
| 108 RELEASE_ASSERT(other.m_isAlive); |
| 109 RELEASE_ASSERT(&other != this); |
| 110 RELEASE_ASSERT(type() == other.type()); |
| 108 if (type() == InvalidateSiblings) { | 111 if (type() == InvalidateSiblings) { |
| 109 SiblingInvalidationSet& siblings = toSiblingInvalidationSet(*this); | 112 SiblingInvalidationSet& siblings = toSiblingInvalidationSet(*this); |
| 110 const SiblingInvalidationSet& otherSiblings = toSiblingInvalidationSet(o
ther); | 113 const SiblingInvalidationSet& otherSiblings = toSiblingInvalidationSet(o
ther); |
| 111 | 114 |
| 112 siblings.updateMaxDirectAdjacentSelectors(otherSiblings.maxDirectAdjacen
tSelectors()); | 115 siblings.updateMaxDirectAdjacentSelectors(otherSiblings.maxDirectAdjacen
tSelectors()); |
| 113 if (otherSiblings.siblingDescendants()) | 116 if (otherSiblings.siblingDescendants()) |
| 114 siblings.ensureSiblingDescendants().combine(*otherSiblings.siblingDe
scendants()); | 117 siblings.ensureSiblingDescendants().combine(*otherSiblings.siblingDe
scendants()); |
| 115 if (otherSiblings.descendants()) | 118 if (otherSiblings.descendants()) |
| 116 siblings.ensureDescendants().combine(*otherSiblings.descendants()); | 119 siblings.ensureDescendants().combine(*otherSiblings.descendants()); |
| 117 } | 120 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 { | 197 { |
| 195 if (!m_attributes) | 198 if (!m_attributes) |
| 196 m_attributes = wrapUnique(new HashSet<AtomicString>); | 199 m_attributes = wrapUnique(new HashSet<AtomicString>); |
| 197 return *m_attributes; | 200 return *m_attributes; |
| 198 } | 201 } |
| 199 | 202 |
| 200 void InvalidationSet::addClass(const AtomicString& className) | 203 void InvalidationSet::addClass(const AtomicString& className) |
| 201 { | 204 { |
| 202 if (wholeSubtreeInvalid()) | 205 if (wholeSubtreeInvalid()) |
| 203 return; | 206 return; |
| 207 RELEASE_ASSERT(!className.isEmpty()); |
| 204 ensureClassSet().add(className); | 208 ensureClassSet().add(className); |
| 205 } | 209 } |
| 206 | 210 |
| 207 void InvalidationSet::addId(const AtomicString& id) | 211 void InvalidationSet::addId(const AtomicString& id) |
| 208 { | 212 { |
| 209 if (wholeSubtreeInvalid()) | 213 if (wholeSubtreeInvalid()) |
| 210 return; | 214 return; |
| 215 RELEASE_ASSERT(!id.isEmpty()); |
| 211 ensureIdSet().add(id); | 216 ensureIdSet().add(id); |
| 212 } | 217 } |
| 213 | 218 |
| 214 void InvalidationSet::addTagName(const AtomicString& tagName) | 219 void InvalidationSet::addTagName(const AtomicString& tagName) |
| 215 { | 220 { |
| 216 if (wholeSubtreeInvalid()) | 221 if (wholeSubtreeInvalid()) |
| 217 return; | 222 return; |
| 223 RELEASE_ASSERT(!tagName.isEmpty()); |
| 218 ensureTagNameSet().add(tagName); | 224 ensureTagNameSet().add(tagName); |
| 219 } | 225 } |
| 220 | 226 |
| 221 void InvalidationSet::addAttribute(const AtomicString& attribute) | 227 void InvalidationSet::addAttribute(const AtomicString& attribute) |
| 222 { | 228 { |
| 223 if (wholeSubtreeInvalid()) | 229 if (wholeSubtreeInvalid()) |
| 224 return; | 230 return; |
| 231 RELEASE_ASSERT(!attribute.isEmpty()); |
| 225 ensureAttributeSet().add(attribute); | 232 ensureAttributeSet().add(attribute); |
| 226 } | 233 } |
| 227 | 234 |
| 228 void InvalidationSet::setWholeSubtreeInvalid() | 235 void InvalidationSet::setWholeSubtreeInvalid() |
| 229 { | 236 { |
| 230 if (m_allDescendantsMightBeInvalid) | 237 if (m_allDescendantsMightBeInvalid) |
| 231 return; | 238 return; |
| 232 | 239 |
| 233 m_allDescendantsMightBeInvalid = true; | 240 m_allDescendantsMightBeInvalid = true; |
| 234 m_customPseudoInvalid = false; | 241 m_customPseudoInvalid = false; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 322 } |
| 316 | 323 |
| 317 DescendantInvalidationSet& SiblingInvalidationSet::ensureDescendants() | 324 DescendantInvalidationSet& SiblingInvalidationSet::ensureDescendants() |
| 318 { | 325 { |
| 319 if (!m_descendantInvalidationSet) | 326 if (!m_descendantInvalidationSet) |
| 320 m_descendantInvalidationSet = DescendantInvalidationSet::create(); | 327 m_descendantInvalidationSet = DescendantInvalidationSet::create(); |
| 321 return *m_descendantInvalidationSet; | 328 return *m_descendantInvalidationSet; |
| 322 } | 329 } |
| 323 | 330 |
| 324 } // namespace blink | 331 } // namespace blink |
| OLD | NEW |