| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class TracedValue; | 47 class TracedValue; |
| 48 | 48 |
| 49 enum InvalidationType { InvalidateDescendants, InvalidateSiblings }; | 49 enum InvalidationType { InvalidateDescendants, InvalidateSiblings }; |
| 50 | 50 |
| 51 // Tracks data to determine which descendants in a DOM subtree, or | 51 // Tracks data to determine which descendants in a DOM subtree, or |
| 52 // siblings and their descendants, need to have style recalculated. | 52 // siblings and their descendants, need to have style recalculated. |
| 53 // | 53 // |
| 54 // Some example invalidation sets: | 54 // Some example invalidation sets: |
| 55 // | 55 // |
| 56 // .z {} | 56 // .z {} |
| 57 // For class z we will have a DescendantInvalidationSet with invalidatesSelf (
the element itself is invalidated). | 57 // For class z we will have a DescendantInvalidationSet with invalidatesSelf |
| 58 // (the element itself is invalidated). |
| 58 // | 59 // |
| 59 // .y .z {} | 60 // .y .z {} |
| 60 // For class y we will have a DescendantInvalidationSet containing class z. | 61 // For class y we will have a DescendantInvalidationSet containing class z. |
| 61 // | 62 // |
| 62 // .x ~ .z {} | 63 // .x ~ .z {} |
| 63 // For class x we will have a SiblingInvalidationSet containing class z, with
invalidatesSelf (the sibling itself is invalidated). | 64 // For class x we will have a SiblingInvalidationSet containing class z, with |
| 65 // invalidatesSelf (the sibling itself is invalidated). |
| 64 // | 66 // |
| 65 // .w ~ .y .z {} | 67 // .w ~ .y .z {} |
| 66 // For class w we will have a SiblingInvalidationSet containing class y, with
the SiblingInvalidationSet havings siblingDescendants containing class z. | 68 // For class w we will have a SiblingInvalidationSet containing class y, with |
| 69 // the SiblingInvalidationSet havings siblingDescendants containing class z. |
| 67 // | 70 // |
| 68 // .v * {} | 71 // .v * {} |
| 69 // For class v we will have a DescendantInvalidationSet with wholeSubtreeInval
id. | 72 // For class v we will have a DescendantInvalidationSet with |
| 73 // wholeSubtreeInvalid. |
| 70 // | 74 // |
| 71 // .u ~ * {} | 75 // .u ~ * {} |
| 72 // For class u we will have a SiblingInvalidationSet with wholeSubtreeInvalid
and invalidatesSelf (for all siblings, the sibling itself is invalidated). | 76 // For class u we will have a SiblingInvalidationSet with wholeSubtreeInvalid |
| 77 // and invalidatesSelf (for all siblings, the sibling itself is invalidated). |
| 73 // | 78 // |
| 74 // .t .v, .t ~ .z {} | 79 // .t .v, .t ~ .z {} |
| 75 // For class t we will have a SiblingInvalidationSet containing class z, with
the SiblingInvalidationSet also holding descendants containing class v. | 80 // For class t we will have a SiblingInvalidationSet containing class z, with |
| 81 // the SiblingInvalidationSet also holding descendants containing class v. |
| 76 // | 82 // |
| 77 // We avoid virtual functions to minimize space consumption. | 83 // We avoid virtual functions to minimize space consumption. |
| 78 class CORE_EXPORT InvalidationSet { | 84 class CORE_EXPORT InvalidationSet { |
| 79 WTF_MAKE_NONCOPYABLE(InvalidationSet); | 85 WTF_MAKE_NONCOPYABLE(InvalidationSet); |
| 80 USING_FAST_MALLOC_WITH_TYPE_NAME(blink::InvalidationSet); | 86 USING_FAST_MALLOC_WITH_TYPE_NAME(blink::InvalidationSet); |
| 81 | 87 |
| 82 public: | 88 public: |
| 83 InvalidationType type() const { | 89 InvalidationType type() const { |
| 84 return static_cast<InvalidationType>(m_type); | 90 return static_cast<InvalidationType>(m_type); |
| 85 } | 91 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 int m_refCount; | 186 int m_refCount; |
| 181 | 187 |
| 182 // FIXME: optimize this if it becomes a memory issue. | 188 // FIXME: optimize this if it becomes a memory issue. |
| 183 std::unique_ptr<HashSet<AtomicString>> m_classes; | 189 std::unique_ptr<HashSet<AtomicString>> m_classes; |
| 184 std::unique_ptr<HashSet<AtomicString>> m_ids; | 190 std::unique_ptr<HashSet<AtomicString>> m_ids; |
| 185 std::unique_ptr<HashSet<AtomicString>> m_tagNames; | 191 std::unique_ptr<HashSet<AtomicString>> m_tagNames; |
| 186 std::unique_ptr<HashSet<AtomicString>> m_attributes; | 192 std::unique_ptr<HashSet<AtomicString>> m_attributes; |
| 187 | 193 |
| 188 unsigned m_type : 1; | 194 unsigned m_type : 1; |
| 189 | 195 |
| 190 // If true, all descendants might be invalidated, so a full subtree recalc is
required. | 196 // If true, all descendants might be invalidated, so a full subtree recalc is |
| 197 // required. |
| 191 unsigned m_allDescendantsMightBeInvalid : 1; | 198 unsigned m_allDescendantsMightBeInvalid : 1; |
| 192 | 199 |
| 193 // If true, the element or sibling itself is invalid. | 200 // If true, the element or sibling itself is invalid. |
| 194 unsigned m_invalidatesSelf : 1; | 201 unsigned m_invalidatesSelf : 1; |
| 195 | 202 |
| 196 // If true, all descendants which are custom pseudo elements must be invalidat
ed. | 203 // If true, all descendants which are custom pseudo elements must be |
| 204 // invalidated. |
| 197 unsigned m_customPseudoInvalid : 1; | 205 unsigned m_customPseudoInvalid : 1; |
| 198 | 206 |
| 199 // If true, the invalidation must traverse into ShadowRoots with this set. | 207 // If true, the invalidation must traverse into ShadowRoots with this set. |
| 200 unsigned m_treeBoundaryCrossing : 1; | 208 unsigned m_treeBoundaryCrossing : 1; |
| 201 | 209 |
| 202 // If true, insertion point descendants must be invalidated. | 210 // If true, insertion point descendants must be invalidated. |
| 203 unsigned m_insertionPointCrossing : 1; | 211 unsigned m_insertionPointCrossing : 1; |
| 204 | 212 |
| 205 // If true, distributed nodes of <slot> elements need to be invalidated. | 213 // If true, distributed nodes of <slot> elements need to be invalidated. |
| 206 unsigned m_invalidatesSlotted : 1; | 214 unsigned m_invalidatesSlotted : 1; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 value.isDescendantInvalidationSet()); | 281 value.isDescendantInvalidationSet()); |
| 274 DEFINE_TYPE_CASTS(SiblingInvalidationSet, | 282 DEFINE_TYPE_CASTS(SiblingInvalidationSet, |
| 275 InvalidationSet, | 283 InvalidationSet, |
| 276 value, | 284 value, |
| 277 value->isSiblingInvalidationSet(), | 285 value->isSiblingInvalidationSet(), |
| 278 value.isSiblingInvalidationSet()); | 286 value.isSiblingInvalidationSet()); |
| 279 | 287 |
| 280 } // namespace blink | 288 } // namespace blink |
| 281 | 289 |
| 282 #endif // InvalidationSet_h | 290 #endif // InvalidationSet_h |
| OLD | NEW |