| 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 22 matching lines...) Expand all Loading... |
| 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 blink { | 37 namespace blink { |
| 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 , m_treeBoundaryCrossing(false) |
| 43 , m_insertionPointCrossing(false) |
| 43 { | 44 { |
| 44 } | 45 } |
| 45 | 46 |
| 46 bool DescendantInvalidationSet::invalidatesElement(Element& element) const | 47 bool DescendantInvalidationSet::invalidatesElement(Element& element) const |
| 47 { | 48 { |
| 48 if (m_allDescendantsMightBeInvalid) | 49 if (m_allDescendantsMightBeInvalid) |
| 49 return true; | 50 return true; |
| 50 | 51 |
| 51 if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) | 52 if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) |
| 52 return true; | 53 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 82 setWholeSubtreeInvalid(); | 83 setWholeSubtreeInvalid(); |
| 83 return; | 84 return; |
| 84 } | 85 } |
| 85 | 86 |
| 86 if (other.customPseudoInvalid()) | 87 if (other.customPseudoInvalid()) |
| 87 setCustomPseudoInvalid(); | 88 setCustomPseudoInvalid(); |
| 88 | 89 |
| 89 if (other.treeBoundaryCrossing()) | 90 if (other.treeBoundaryCrossing()) |
| 90 setTreeBoundaryCrossing(); | 91 setTreeBoundaryCrossing(); |
| 91 | 92 |
| 93 if (other.insertionPointCrossing()) |
| 94 setInsertionPointCrossing(); |
| 95 |
| 92 if (other.m_classes) { | 96 if (other.m_classes) { |
| 93 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_classes->e
nd(); | 97 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_classes->e
nd(); |
| 94 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_classe
s->begin(); it != end; ++it) | 98 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_classe
s->begin(); it != end; ++it) |
| 95 addClass(*it); | 99 addClass(*it); |
| 96 } | 100 } |
| 97 | 101 |
| 98 if (other.m_ids) { | 102 if (other.m_ids) { |
| 99 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_ids->end()
; | 103 WillBeHeapHashSet<AtomicString>::const_iterator end = other.m_ids->end()
; |
| 100 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_ids->b
egin(); it != end; ++it) | 104 for (WillBeHeapHashSet<AtomicString>::const_iterator it = other.m_ids->b
egin(); it != end; ++it) |
| 101 addId(*it); | 105 addId(*it); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ensureAttributeSet().add(attribute); | 174 ensureAttributeSet().add(attribute); |
| 171 } | 175 } |
| 172 | 176 |
| 173 void DescendantInvalidationSet::setWholeSubtreeInvalid() | 177 void DescendantInvalidationSet::setWholeSubtreeInvalid() |
| 174 { | 178 { |
| 175 if (m_allDescendantsMightBeInvalid) | 179 if (m_allDescendantsMightBeInvalid) |
| 176 return; | 180 return; |
| 177 | 181 |
| 178 m_allDescendantsMightBeInvalid = true; | 182 m_allDescendantsMightBeInvalid = true; |
| 179 m_treeBoundaryCrossing = false; | 183 m_treeBoundaryCrossing = false; |
| 184 m_insertionPointCrossing = false; |
| 180 m_classes = nullptr; | 185 m_classes = nullptr; |
| 181 m_ids = nullptr; | 186 m_ids = nullptr; |
| 182 m_tagNames = nullptr; | 187 m_tagNames = nullptr; |
| 183 m_attributes = nullptr; | 188 m_attributes = nullptr; |
| 184 } | 189 } |
| 185 | 190 |
| 186 void DescendantInvalidationSet::trace(Visitor* visitor) | 191 void DescendantInvalidationSet::trace(Visitor* visitor) |
| 187 { | 192 { |
| 188 #if ENABLE(OILPAN) | 193 #if ENABLE(OILPAN) |
| 189 visitor->trace(m_classes); | 194 visitor->trace(m_classes); |
| 190 visitor->trace(m_ids); | 195 visitor->trace(m_ids); |
| 191 visitor->trace(m_tagNames); | 196 visitor->trace(m_tagNames); |
| 192 visitor->trace(m_attributes); | 197 visitor->trace(m_attributes); |
| 193 #endif | 198 #endif |
| 194 } | 199 } |
| 195 | 200 |
| 196 #ifndef NDEBUG | 201 #ifndef NDEBUG |
| 197 void DescendantInvalidationSet::show() const | 202 void DescendantInvalidationSet::show() const |
| 198 { | 203 { |
| 199 fprintf(stderr, "DescendantInvalidationSet { "); | 204 fprintf(stderr, "DescendantInvalidationSet { "); |
| 200 if (m_allDescendantsMightBeInvalid) | 205 if (m_allDescendantsMightBeInvalid) |
| 201 fprintf(stderr, "* "); | 206 fprintf(stderr, "* "); |
| 202 if (m_customPseudoInvalid) | 207 if (m_customPseudoInvalid) |
| 203 fprintf(stderr, "::custom "); | 208 fprintf(stderr, "::custom "); |
| 204 if (m_treeBoundaryCrossing) | 209 if (m_treeBoundaryCrossing) |
| 205 fprintf(stderr, "::shadow/deep/ "); | 210 fprintf(stderr, "::shadow/deep/ "); |
| 211 if (m_insertionPointCrossing) |
| 212 fprintf(stderr, "::content/:host-context "); |
| 206 if (m_ids) { | 213 if (m_ids) { |
| 207 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_ids->begin()
; it != m_ids->end(); ++it) | 214 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_ids->begin()
; it != m_ids->end(); ++it) |
| 208 fprintf(stderr, "#%s ", (*it).ascii().data()); | 215 fprintf(stderr, "#%s ", (*it).ascii().data()); |
| 209 } | 216 } |
| 210 if (m_classes) { | 217 if (m_classes) { |
| 211 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_classes->beg
in(); it != m_classes->end(); ++it) | 218 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_classes->beg
in(); it != m_classes->end(); ++it) |
| 212 fprintf(stderr, ".%s ", (*it).ascii().data()); | 219 fprintf(stderr, ".%s ", (*it).ascii().data()); |
| 213 } | 220 } |
| 214 if (m_tagNames) { | 221 if (m_tagNames) { |
| 215 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_tagNames->be
gin(); it != m_tagNames->end(); ++it) | 222 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_tagNames->be
gin(); it != m_tagNames->end(); ++it) |
| 216 fprintf(stderr, "<%s> ", (*it).ascii().data()); | 223 fprintf(stderr, "<%s> ", (*it).ascii().data()); |
| 217 } | 224 } |
| 218 if (m_attributes) { | 225 if (m_attributes) { |
| 219 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_attributes->
begin(); it != m_attributes->end(); ++it) | 226 for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_attributes->
begin(); it != m_attributes->end(); ++it) |
| 220 fprintf(stderr, "[%s] ", (*it).ascii().data()); | 227 fprintf(stderr, "[%s] ", (*it).ascii().data()); |
| 221 } | 228 } |
| 222 fprintf(stderr, "}\n"); | 229 fprintf(stderr, "}\n"); |
| 223 } | 230 } |
| 224 #endif // NDEBUG | 231 #endif // NDEBUG |
| 225 | 232 |
| 226 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |