| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/css/invalidation/DescendantInvalidationSet.h" | 32 #include "core/css/invalidation/DescendantInvalidationSet.h" |
| 33 | 33 |
| 34 #include "core/css/resolver/StyleResolver.h" | 34 #include "core/css/resolver/StyleResolver.h" |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 DescendantInvalidationSet::DescendantInvalidationSet() | 39 DescendantInvalidationSet::DescendantInvalidationSet() |
| 40 : m_allDescendantsMightBeInvalid(false) | 40 : m_allDescendantsMightBeInvalid(false) |
| 41 , m_customPseudoInvalid(false) | 41 , m_customPseudoInvalid(false) |
| 42 , m_treeBoundaryCrossing(false) |
| 42 { | 43 { |
| 43 } | 44 } |
| 44 | 45 |
| 45 bool DescendantInvalidationSet::invalidatesElement(Element& element) const | 46 bool DescendantInvalidationSet::invalidatesElement(Element& element) const |
| 46 { | 47 { |
| 47 if (m_allDescendantsMightBeInvalid) | 48 if (m_allDescendantsMightBeInvalid) |
| 48 return true; | 49 return true; |
| 49 | 50 |
| 50 if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) | 51 if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) |
| 51 return true; | 52 return true; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 return; | 79 return; |
| 79 | 80 |
| 80 if (other.wholeSubtreeInvalid()) { | 81 if (other.wholeSubtreeInvalid()) { |
| 81 setWholeSubtreeInvalid(); | 82 setWholeSubtreeInvalid(); |
| 82 return; | 83 return; |
| 83 } | 84 } |
| 84 | 85 |
| 85 if (other.customPseudoInvalid()) | 86 if (other.customPseudoInvalid()) |
| 86 setCustomPseudoInvalid(); | 87 setCustomPseudoInvalid(); |
| 87 | 88 |
| 89 if (other.treeBoundaryCrossing()) |
| 90 setTreeBoundaryCrossing(); |
| 91 |
| 88 if (other.m_classes) { | 92 if (other.m_classes) { |
| 89 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_classes->e
nd(); | 93 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_classes->e
nd(); |
| 90 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_classe
s->begin(); it != end; ++it) | 94 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_classe
s->begin(); it != end; ++it) |
| 91 addClass(*it); | 95 addClass(*it); |
| 92 } | 96 } |
| 93 | 97 |
| 94 if (other.m_ids) { | 98 if (other.m_ids) { |
| 95 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_ids->end()
; | 99 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_ids->end()
; |
| 96 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_ids->b
egin(); it != end; ++it) | 100 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_ids->b
egin(); it != end; ++it) |
| 97 addId(*it); | 101 addId(*it); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return; | 169 return; |
| 166 ensureAttributeSet().add(attribute); | 170 ensureAttributeSet().add(attribute); |
| 167 } | 171 } |
| 168 | 172 |
| 169 void DescendantInvalidationSet::setWholeSubtreeInvalid() | 173 void DescendantInvalidationSet::setWholeSubtreeInvalid() |
| 170 { | 174 { |
| 171 if (m_allDescendantsMightBeInvalid) | 175 if (m_allDescendantsMightBeInvalid) |
| 172 return; | 176 return; |
| 173 | 177 |
| 174 m_allDescendantsMightBeInvalid = true; | 178 m_allDescendantsMightBeInvalid = true; |
| 179 m_treeBoundaryCrossing = false; |
| 175 m_classes = nullptr; | 180 m_classes = nullptr; |
| 176 m_ids = nullptr; | 181 m_ids = nullptr; |
| 177 m_tagNames = nullptr; | 182 m_tagNames = nullptr; |
| 178 m_attributes = nullptr; | 183 m_attributes = nullptr; |
| 179 } | 184 } |
| 180 | 185 |
| 181 void DescendantInvalidationSet::trace(Visitor* visitor) | 186 void DescendantInvalidationSet::trace(Visitor* visitor) |
| 182 { | 187 { |
| 183 #if ENABLE(OILPAN) | 188 #if ENABLE(OILPAN) |
| 184 visitor->trace(m_classes); | 189 visitor->trace(m_classes); |
| 185 visitor->trace(m_ids); | 190 visitor->trace(m_ids); |
| 186 visitor->trace(m_tagNames); | 191 visitor->trace(m_tagNames); |
| 187 visitor->trace(m_attributes); | 192 visitor->trace(m_attributes); |
| 188 #endif | 193 #endif |
| 189 } | 194 } |
| 190 | 195 |
| 191 } // namespace WebCore | 196 } // namespace WebCore |
| OLD | NEW |