Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp

Issue 2622473002: Replace HTMLAttributeMode with HTMLStandardMode (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } else { 185 } else {
186 cacheValue = nullptr; 186 cacheValue = nullptr;
187 } 187 }
188 188
189 StylePropertySet* style = nullptr; 189 StylePropertySet* style = nullptr;
190 if (cacheHash && cacheValue->value) { 190 if (cacheHash && cacheValue->value) {
191 style = cacheValue->value->value; 191 style = cacheValue->value->value;
192 cacheCleaner.didHitPresentationAttributeCache(); 192 cacheCleaner.didHitPresentationAttributeCache();
193 } else { 193 } else {
194 style = MutableStylePropertySet::create( 194 style = MutableStylePropertySet::create(
195 element.isSVGElement() ? SVGAttributeMode : HTMLAttributeMode); 195 element.isSVGElement() ? SVGAttributeMode : HTMLStandardMode);
196 AttributeCollection attributes = element.attributesWithoutUpdate(); 196 AttributeCollection attributes = element.attributesWithoutUpdate();
197 for (const Attribute& attr : attributes) 197 for (const Attribute& attr : attributes)
198 element.collectStyleForPresentationAttribute( 198 element.collectStyleForPresentationAttribute(
199 attr.name(), attr.value(), toMutableStylePropertySet(style)); 199 attr.name(), attr.value(), toMutableStylePropertySet(style));
200 } 200 }
201 201
202 if (!cacheHash || cacheValue->value) 202 if (!cacheHash || cacheValue->value)
203 return style; 203 return style;
204 204
205 PresentationAttributeCacheEntry* newEntry = 205 PresentationAttributeCacheEntry* newEntry =
206 new PresentationAttributeCacheEntry; 206 new PresentationAttributeCacheEntry;
207 newEntry->key = cacheKey; 207 newEntry->key = cacheKey;
208 newEntry->value = style; 208 newEntry->value = style;
209 209
210 static const unsigned presentationAttributeCacheMaximumSize = 4096; 210 static const unsigned presentationAttributeCacheMaximumSize = 4096;
211 if (presentationAttributeCache().size() > 211 if (presentationAttributeCache().size() >
212 presentationAttributeCacheMaximumSize) { 212 presentationAttributeCacheMaximumSize) {
213 // FIXME: Discarding the entire cache when it gets too big is probably bad 213 // FIXME: Discarding the entire cache when it gets too big is probably bad
214 // since it creates a perf "cliff". Perhaps we should use an LRU? 214 // since it creates a perf "cliff". Perhaps we should use an LRU?
215 presentationAttributeCache().clear(); 215 presentationAttributeCache().clear();
216 presentationAttributeCache().set(cacheHash, newEntry); 216 presentationAttributeCache().set(cacheHash, newEntry);
217 } else { 217 } else {
218 cacheValue->value = newEntry; 218 cacheValue->value = newEntry;
219 } 219 }
220 220
221 return style; 221 return style;
222 } 222 }
223 223
224 } // namespace blink 224 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698