OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 10 matching lines...) Expand all Loading... |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "CSSSelectorList.h" | 28 #include "CSSSelectorList.h" |
29 | 29 |
30 #include "CSSParserValues.h" | 30 #include "CSSParserValues.h" |
31 #include "WebCoreMemoryInstrumentation.h" | |
32 #include <wtf/text/StringBuilder.h> | 31 #include <wtf/text/StringBuilder.h> |
33 | 32 |
34 namespace WebCore { | 33 namespace WebCore { |
35 | 34 |
36 CSSSelectorList::~CSSSelectorList() | 35 CSSSelectorList::~CSSSelectorList() |
37 { | 36 { |
38 deleteSelectors(); | 37 deleteSelectors(); |
39 } | 38 } |
40 | 39 |
41 CSSSelectorList::CSSSelectorList(const CSSSelectorList& o) | 40 CSSSelectorList::CSSSelectorList(const CSSSelectorList& o) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 135 |
137 for (const CSSSelector* s = first(); s; s = next(s)) { | 136 for (const CSSSelector* s = first(); s; s = next(s)) { |
138 if (s != first()) | 137 if (s != first()) |
139 result.append(", "); | 138 result.append(", "); |
140 result.append(s->selectorText()); | 139 result.append(s->selectorText()); |
141 } | 140 } |
142 | 141 |
143 return result.toString(); | 142 return result.toString(); |
144 } | 143 } |
145 | 144 |
146 void CSSSelectorList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) cons
t | |
147 { | |
148 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
149 info.addRawBuffer(m_selectorArray, length() * sizeof(CSSSelector), "CSSSelec
tors", "selectorArray"); | |
150 } | |
151 | |
152 template <typename Functor> | 145 template <typename Functor> |
153 static bool forEachTagSelector(Functor& functor, const CSSSelector* selector) | 146 static bool forEachTagSelector(Functor& functor, const CSSSelector* selector) |
154 { | 147 { |
155 ASSERT(selector); | 148 ASSERT(selector); |
156 | 149 |
157 do { | 150 do { |
158 if (functor(selector)) | 151 if (functor(selector)) |
159 return true; | 152 return true; |
160 if (const CSSSelectorList* selectorList = selector->selectorList()) { | 153 if (const CSSSelectorList* selectorList = selector->selectorList()) { |
161 for (const CSSSelector* subSelector = selectorList->first(); subSele
ctor; subSelector = CSSSelectorList::next(subSelector)) { | 154 for (const CSSSelector* subSelector = selectorList->first(); subSele
ctor; subSelector = CSSSelectorList::next(subSelector)) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 212 } |
220 }; | 213 }; |
221 | 214 |
222 bool CSSSelectorList::hasShadowDistributedAt(size_t index) const | 215 bool CSSSelectorList::hasShadowDistributedAt(size_t index) const |
223 { | 216 { |
224 SelectorHasShadowDistributed functor; | 217 SelectorHasShadowDistributed functor; |
225 return forEachTagSelector(functor, selectorAt(index)); | 218 return forEachTagSelector(functor, selectorAt(index)); |
226 } | 219 } |
227 | 220 |
228 } // namespace WebCore | 221 } // namespace WebCore |
OLD | NEW |