OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 { | 156 { |
157 DEFINE_STATIC_LOCAL(PresentationAttributeCacheCleaner, cacheCleaner, ()); | 157 DEFINE_STATIC_LOCAL(PresentationAttributeCacheCleaner, cacheCleaner, ()); |
158 | 158 |
159 ASSERT(element.isStyledElement()); | 159 ASSERT(element.isStyledElement()); |
160 | 160 |
161 PresentationAttributeCacheKey cacheKey; | 161 PresentationAttributeCacheKey cacheKey; |
162 makePresentationAttributeCacheKey(element, cacheKey); | 162 makePresentationAttributeCacheKey(element, cacheKey); |
163 | 163 |
164 unsigned cacheHash = computePresentationAttributeCacheHash(cacheKey); | 164 unsigned cacheHash = computePresentationAttributeCacheHash(cacheKey); |
165 | 165 |
166 PresentationAttributeCache::iterator cacheIterator; | 166 PresentationAttributeCache::ValueType* cacheIterator; |
Erik Corry
2014/02/04 14:27:15
It seems wrong to call this 'iterator'.
| |
167 if (cacheHash) { | 167 if (cacheHash) { |
168 cacheIterator = presentationAttributeCache().add(cacheHash, nullptr).ite rator; | 168 cacheIterator = presentationAttributeCache().add(cacheHash, nullptr).ite rator; |
169 if (cacheIterator->value && cacheIterator->value->key != cacheKey) | 169 if (cacheIterator->value && cacheIterator->value->key != cacheKey) |
170 cacheHash = 0; | 170 cacheHash = 0; |
171 } else { | 171 } else { |
172 cacheIterator = presentationAttributeCache().end(); | 172 cacheIterator = 0; |
173 } | 173 } |
174 | 174 |
175 RefPtr<StylePropertySet> style; | 175 RefPtr<StylePropertySet> style; |
176 if (cacheHash && cacheIterator->value) { | 176 if (cacheHash && cacheIterator->value) { |
177 style = cacheIterator->value->value; | 177 style = cacheIterator->value->value; |
178 cacheCleaner.didHitPresentationAttributeCache(); | 178 cacheCleaner.didHitPresentationAttributeCache(); |
179 } else { | 179 } else { |
180 style = MutableStylePropertySet::create(element.isSVGElement() ? SVGAttr ibuteMode : HTMLAttributeMode); | 180 style = MutableStylePropertySet::create(element.isSVGElement() ? SVGAttr ibuteMode : HTMLAttributeMode); |
181 unsigned size = element.attributeCount(); | 181 unsigned size = element.attributeCount(); |
182 for (unsigned i = 0; i < size; ++i) { | 182 for (unsigned i = 0; i < size; ++i) { |
(...skipping 16 matching lines...) Expand all Loading... | |
199 presentationAttributeCache().clear(); | 199 presentationAttributeCache().clear(); |
200 presentationAttributeCache().set(cacheHash, newEntry.release()); | 200 presentationAttributeCache().set(cacheHash, newEntry.release()); |
201 } else { | 201 } else { |
202 cacheIterator->value = newEntry.release(); | 202 cacheIterator->value = newEntry.release(); |
203 } | 203 } |
204 | 204 |
205 return style.release(); | 205 return style.release(); |
206 } | 206 } |
207 | 207 |
208 } // namespace WebCore | 208 } // namespace WebCore |
OLD | NEW |