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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 HashSet<AtomicString>::const_iterator end = other.m_ids->end(); | 62 HashSet<AtomicString>::const_iterator end = other.m_ids->end(); |
63 for (HashSet<AtomicString>::const_iterator it = other.m_ids->begin(); it
!= end; ++it) | 63 for (HashSet<AtomicString>::const_iterator it = other.m_ids->begin(); it
!= end; ++it) |
64 addId(*it); | 64 addId(*it); |
65 } | 65 } |
66 | 66 |
67 if (other.m_tagNames) { | 67 if (other.m_tagNames) { |
68 HashSet<AtomicString>::const_iterator end = other.m_tagNames->end(); | 68 HashSet<AtomicString>::const_iterator end = other.m_tagNames->end(); |
69 for (HashSet<AtomicString>::const_iterator it = other.m_tagNames->begin(
); it != end; ++it) | 69 for (HashSet<AtomicString>::const_iterator it = other.m_tagNames->begin(
); it != end; ++it) |
70 addTagName(*it); | 70 addTagName(*it); |
71 } | 71 } |
| 72 |
| 73 if (other.m_attributes) { |
| 74 HashSet<AtomicString>::const_iterator end = other.m_attributes->end(); |
| 75 for (HashSet<AtomicString>::const_iterator it = other.m_attributes->begi
n(); it != end; ++it) |
| 76 addAttribute(*it); |
| 77 } |
72 } | 78 } |
73 | 79 |
74 HashSet<AtomicString>& DescendantInvalidationSet::ensureClassSet() | 80 HashSet<AtomicString>& DescendantInvalidationSet::ensureClassSet() |
75 { | 81 { |
76 if (!m_classes) | 82 if (!m_classes) |
77 m_classes = adoptPtr(new HashSet<AtomicString>); | 83 m_classes = adoptPtr(new HashSet<AtomicString>); |
78 return *m_classes; | 84 return *m_classes; |
79 } | 85 } |
80 | 86 |
81 HashSet<AtomicString>& DescendantInvalidationSet::ensureIdSet() | 87 HashSet<AtomicString>& DescendantInvalidationSet::ensureIdSet() |
82 { | 88 { |
83 if (!m_ids) | 89 if (!m_ids) |
84 m_ids = adoptPtr(new HashSet<AtomicString>); | 90 m_ids = adoptPtr(new HashSet<AtomicString>); |
85 return *m_ids; | 91 return *m_ids; |
86 } | 92 } |
87 | 93 |
88 HashSet<AtomicString>& DescendantInvalidationSet::ensureTagNameSet() | 94 HashSet<AtomicString>& DescendantInvalidationSet::ensureTagNameSet() |
89 { | 95 { |
90 if (!m_tagNames) | 96 if (!m_tagNames) |
91 m_tagNames = adoptPtr(new HashSet<AtomicString>); | 97 m_tagNames = adoptPtr(new HashSet<AtomicString>); |
92 return *m_tagNames; | 98 return *m_tagNames; |
93 } | 99 } |
94 | 100 |
| 101 HashSet<AtomicString>& DescendantInvalidationSet::ensureAttributeSet() |
| 102 { |
| 103 if (!m_attributes) |
| 104 m_attributes = adoptPtr(new HashSet<AtomicString>); |
| 105 return *m_attributes; |
| 106 } |
| 107 |
95 void DescendantInvalidationSet::addClass(const AtomicString& className) | 108 void DescendantInvalidationSet::addClass(const AtomicString& className) |
96 { | 109 { |
97 if (wholeSubtreeInvalid()) | 110 if (wholeSubtreeInvalid()) |
98 return; | 111 return; |
99 ensureClassSet().add(className); | 112 ensureClassSet().add(className); |
100 } | 113 } |
101 | 114 |
102 void DescendantInvalidationSet::addId(const AtomicString& id) | 115 void DescendantInvalidationSet::addId(const AtomicString& id) |
103 { | 116 { |
104 if (wholeSubtreeInvalid()) | 117 if (wholeSubtreeInvalid()) |
105 return; | 118 return; |
106 ensureIdSet().add(id); | 119 ensureIdSet().add(id); |
107 } | 120 } |
108 | 121 |
109 void DescendantInvalidationSet::addTagName(const AtomicString& tagName) | 122 void DescendantInvalidationSet::addTagName(const AtomicString& tagName) |
110 { | 123 { |
111 if (wholeSubtreeInvalid()) | 124 if (wholeSubtreeInvalid()) |
112 return; | 125 return; |
113 ensureTagNameSet().add(tagName); | 126 ensureTagNameSet().add(tagName); |
114 } | 127 } |
115 | 128 |
| 129 void DescendantInvalidationSet::addAttribute(const AtomicString& attribute) |
| 130 { |
| 131 if (wholeSubtreeInvalid()) |
| 132 return; |
| 133 ensureAttributeSet().add(attribute); |
| 134 } |
| 135 |
116 void DescendantInvalidationSet::getClasses(Vector<AtomicString>& classes) const | 136 void DescendantInvalidationSet::getClasses(Vector<AtomicString>& classes) const |
117 { | 137 { |
118 if (!m_classes) | 138 if (!m_classes) |
119 return; | 139 return; |
120 for (HashSet<AtomicString>::const_iterator it = m_classes->begin(); it != m_
classes->end(); ++it) | 140 for (HashSet<AtomicString>::const_iterator it = m_classes->begin(); it != m_
classes->end(); ++it) |
121 classes.append(*it); | 141 classes.append(*it); |
122 } | 142 } |
123 | 143 |
| 144 void DescendantInvalidationSet::getAttributes(Vector<AtomicString>& attributes)
const |
| 145 { |
| 146 if (!m_attributes) |
| 147 return; |
| 148 for (HashSet<AtomicString>::const_iterator it = m_attributes->begin(); it !=
m_attributes->end(); ++it) |
| 149 attributes.append(*it); |
| 150 } |
| 151 |
124 void DescendantInvalidationSet::setWholeSubtreeInvalid() | 152 void DescendantInvalidationSet::setWholeSubtreeInvalid() |
125 { | 153 { |
126 if (m_allDescendantsMightBeInvalid) | 154 if (m_allDescendantsMightBeInvalid) |
127 return; | 155 return; |
128 | 156 |
129 m_allDescendantsMightBeInvalid = true; | 157 m_allDescendantsMightBeInvalid = true; |
130 m_classes = nullptr; | 158 m_classes = nullptr; |
131 m_ids = nullptr; | 159 m_ids = nullptr; |
132 m_tagNames = nullptr; | 160 m_tagNames = nullptr; |
| 161 m_attributes = nullptr; |
133 } | 162 } |
134 | 163 |
135 } // namespace WebCore | 164 } // namespace WebCore |
OLD | NEW |